From d007b6a6d6905b792eee54bdf3be05370fe69b86 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Mon, 23 Mar 2020 07:01:13 +0000 Subject: [PATCH] [FIX] sale: correct dependency for SO line currency Ensure that the currency of a line always matches the currency of its order; indeed, with the previous depends, changing the currency of an order (through its pricelist) would not trigger the recompute of the SO line's currency. Was initially fixed in 2dfc0ea8c then reverted at 34e679598 for breaking a test. I'd rather have the fix and adapt the test though, since this breaks excpected relations. Closes #48156 closes odoo/odoo#49491 X-original-commit: 36383d69802503606125f63d7641d4e733908b60 Related: odoo/enterprise#9844 Signed-off-by: Damien Bouvy (dbo) --- addons/sale/models/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 6d18891c65b..ec8c308267e 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1323,7 +1323,7 @@ class SaleOrderLine(models.Model): untaxed_amount_to_invoice = fields.Monetary("Untaxed Amount To Invoice", compute='_compute_untaxed_amount_to_invoice', compute_sudo=True, store=True) salesman_id = fields.Many2one(related='order_id.user_id', store=True, string='Salesperson', readonly=True) - currency_id = fields.Many2one(related='order_id.currency_id', store=True, string='Currency', readonly=True) + currency_id = fields.Many2one(related='order_id.currency_id', depends=['order_id.currency_id'], store=True, string='Currency', readonly=True) company_id = fields.Many2one(related='order_id.company_id', string='Company', store=True, readonly=True, index=True) order_partner_id = fields.Many2one(related='order_id.partner_id', store=True, string='Customer', readonly=False) analytic_tag_ids = fields.Many2many(