From ae350636cf21c2d71bc6741b07c504342de80beb Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Thu, 29 Aug 2024 17:03:11 +0530 Subject: [PATCH] Aug 29: [FIX] Bug Fixed 'inter_company_synchronization' --- inter_company_synchronization/doc/RELEASE_NOTES.md | 5 +++++ inter_company_synchronization/models/sale_order.py | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/inter_company_synchronization/doc/RELEASE_NOTES.md b/inter_company_synchronization/doc/RELEASE_NOTES.md index c98c65545..24e4aaed1 100644 --- a/inter_company_synchronization/doc/RELEASE_NOTES.md +++ b/inter_company_synchronization/doc/RELEASE_NOTES.md @@ -4,3 +4,8 @@ #### Version 17.0.1.0.0 #### ADD - Initial Commit for Inter Company Sale and Purchase Synchronization + +#### 27.08.2024 +#### Version 17.0.1.0.1 +##### UPDT +- Bug Fix - Resolved the error while confirming quotation \ No newline at end of file diff --git a/inter_company_synchronization/models/sale_order.py b/inter_company_synchronization/models/sale_order.py index 863bab0e0..ea08eb32c 100644 --- a/inter_company_synchronization/models/sale_order.py +++ b/inter_company_synchronization/models/sale_order.py @@ -30,11 +30,14 @@ class SaleOrder(models.Model): def _create_purchase_order(self): """Create a purchase order based on the current sale order.""" - company_id = self.env['res.company'].search( + company = self.env['res.company'].search( [('partner_id', '=', self.partner_id.id)], limit=1) + if not company: + return False + purchase_order_vals = { 'partner_id': self.company_id.partner_id.id, - 'company_id': company_id.id, + 'company_id': company.id, 'origin': self.name, 'order_line': [(0, 0, { 'product_id': line.product_id.id, @@ -43,6 +46,7 @@ class SaleOrder(models.Model): 'price_subtotal': line.price_subtotal, }) for line in self.order_line], } + return self.env['purchase.order'].create(purchase_order_vals) def action_confirm(self):