[FIX] account: fix fiscal position with delivery address

The goal is to take into consideration that in case the TAX ID
is issued by the same member state as the vendor's,
then VAT charge is not reversed.

The VAT ID must be foreign as from the vendor's point of view.

closes odoo/odoo#74566

Task: 2596204
X-original-commit: c92ebc91e261827dfafa602eae5408de2a072609
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
John (jol)
2021-08-02 12:28:47 +00:00
parent 7ea7e79541
commit 5d7574fa26
+3 -4
View File
@@ -183,11 +183,10 @@ class AccountFiscalPosition(models.Model):
# This can be easily overridden to apply more complex fiscal rules
PartnerObj = self.env['res.partner']
partner = PartnerObj.browse(partner_id)
delivery = PartnerObj.browse(delivery_id)
# if no delivery use invoicing
if delivery_id:
delivery = PartnerObj.browse(delivery_id)
else:
# 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]):
delivery = partner
# partner manually set fiscal position always win