[FIX] account: _onchange_partner_id not matching fiscal position

When changing partner_id on an invoice, the fiscal positions with auto_apply=True,
must be checked to apply the right one.

To have the same behavior as in 10.0

Backport of this commit: 4b11e3e3a5

opw:715511
This commit is contained in:
Goffin Simon
2017-03-09 16:21:37 +01:00
parent a8efeffbf2
commit e6d790e340
+2 -1
View File
@@ -488,7 +488,8 @@ class AccountInvoice(models.Model):
else:
account_id = pay_account.id
payment_term_id = p.property_supplier_payment_term_id.id
fiscal_position = p.property_account_position_id.id
addr = p.address_get(['delivery'])
fiscal_position = self.env['account.fiscal.position'].get_fiscal_position(p.id, delivery_id=addr['delivery'])
self.account_id = account_id
self.payment_term_id = payment_term_id