[FIX] account: Correct fiscal position on delivery

closes odoo/odoo#74670

X-original-commit: f11c807217cccd96fa18fe24c0cbb436bb1830d1
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
Denis Roussel
2021-08-03 18:00:34 +00:00
parent 98c403a1bf
commit 19624a7a98
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -186,7 +186,7 @@ class AccountFiscalPosition(models.Model):
delivery = PartnerObj.browse(delivery_id)
# If partner and delivery have the same vat prefix, use invoicing
if not delivery.vat or (partner.vat and delivery.vat[:2] == partner.vat[:2]):
if not delivery or (delivery.vat and partner.vat and delivery.vat[:2] == partner.vat[:2]):
delivery = partner
# partner manually set fiscal position always win
@@ -154,3 +154,15 @@ class TestFiscalPosition(common.TransactionCase):
mapped_taxes = self.fp2m.map_tax(self.src_tax)
self.assertEqual(mapped_taxes, self.dst1_tax | self.dst2_tax)
def test_30_fp_country_delivery(self):
"""
Customer is in Belgium
Delivery is in France
Check if fiscal position is France
"""
self.george.vat = False
self.assertEqual(
self.fp.get_fiscal_position(self.ben.id, self.george.id).id,
self.fr_b2c.id,
"FR B2C should be set")