summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2016-10-24 11:05:08 +0200
committerOlivier Dony <odo@openerp.com>2016-10-24 13:58:29 +0200
commita3d6e7f2ff216e2b3672fa1579d331801f9d5c0e (patch)
treeef718f386bdb0878d3ef9cf58191c52c730f5622
parent6690bfb14a9f6c2e28d30842d3b175044aef7233 (diff)
[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
-rw-r--r--addons/sale/sale.py2
1 files changed, 1 insertions, 1 deletions
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.