[FIX] account: Use the invoice shipping address to select the fiscal position

Tribute to Ray Carnes

PURPOSE
=======

Since the fields shipping_partner_id has been added on the invoice model, the onchange triggered by the partner_id hasn't been modified.

SPECIFICATION
=============

The shipping_partner_id will be picked by default to select the fiscal position. If there's no shipping partner, it will check if a 'shipping' partner is a child on the partner_id.
This commit is contained in:
Yannick Tivisse
2017-04-07 14:33:02 +02:00
parent b3c949b0c5
commit 1452a9903c
+2 -2
View File
@@ -483,9 +483,9 @@ class AccountInvoice(models.Model):
else:
account_id = pay_account.id
payment_term_id = p.property_supplier_payment_term_id.id
addr = self.partner_id.address_get(['delivery'])
fiscal_position = self.env['account.fiscal.position'].get_fiscal_position(self.partner_id.id, delivery_id=addr['delivery'])
delivery_partner_id = self.partner_shipping_id.id or self.partner_id.address_get(['delivery'])['delivery']
fiscal_position = self.env['account.fiscal.position'].get_fiscal_position(self.partner_id.id, delivery_id=delivery_partner_id)
# If partner has no warning, check its company
if p.invoice_warn == 'no-message' and p.parent_id: