Skip to content

Commit

Permalink
[FIX] sale: fix recompute of fiscal position
Browse files Browse the repository at this point in the history
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
  • Loading branch information
odony committed Oct 24, 2016
1 parent 6690bfb commit a3d6e7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/sale/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _track_subtype(self, init_values):
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.
Expand Down

0 comments on commit a3d6e7f

Please sign in to comment.