From 70c8fd7f759de9109eee2dd29f2573c5f60594e9 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 27 Feb 2019 09:39:32 +0000 Subject: [PATCH] [FIX] sale_management: optional product - Activate 'Multiple prices per product' - Create a Product A, and add an entry in the 'Pricing' section of the product form - Create a SO, a product, and add A in the 'Optional Products' tab. - Click on 'Add to order lines' A crash occurs at currency conversion. When getting the conversion rate, the company is empty in method `_get_conversion_rate`. This is because the company is a stored related field, which is computed after creation. However, the method `_prepare_add_missing_fields` is called before creation. This method calls several onchange methods, one of them computing a price conversion. We explicitly add the company when creating the SO line. opw-1939106 closes odoo/odoo#31455 --- addons/sale_management/models/sale_order.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sale_management/models/sale_order.py b/addons/sale_management/models/sale_order.py index afa13aed50d..6ebed05a2bc 100644 --- a/addons/sale_management/models/sale_order.py +++ b/addons/sale_management/models/sale_order.py @@ -209,4 +209,5 @@ class SaleOrderOption(models.Model): 'product_uom_qty': self.quantity, 'product_uom': self.uom_id.id, 'discount': self.discount, + 'company_id': self.order_id.company_id.id, }