From a3d6e7f2ff216e2b3672fa1579d331801f9d5c0e Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 24 Oct 2016 11:05:08 +0200 Subject: [PATCH] [FIX] sale: fix recompute of fiscal position The `fiscal_position_id` field actually depends on both the `shipping_partner_id` and the `partner_id` field, not just the former. Theoretically the recompute should trigger on both fields anyway because changing the `partner_id` will automatically change the `shipping_partner_id`. Unfortunately this onchange chaining does not work as expected as of Odoo 9, at least when the `partner_id` field is set to the same value (was done for optimization reasons). This special case really happens when you edit the Partner from a sales order form view, and save the changes. It triggers a "dummy on_change" for the `partner_id` value, with the same value as before. If the edit changed the fiscal position or another field on which it depends, a recompute is really needed. Adding the direct dependency works around this limitation, and is semantically valid, too. An extra fix of this special case in the framework might still be nice to have, though. Ref: feedback ID 29042 --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 29b12b5f111..661880cfd98 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -173,7 +173,7 @@ class SaleOrder(models.Model): return super(SaleOrder, self)._track_subtype(init_values) @api.multi - @api.onchange('partner_shipping_id') + @api.onchange('partner_shipping_id', 'partner_id') def onchange_partner_shipping_id(self): """ Trigger the change of fiscal position when the shipping address is modified.