From bbbccbfc6476a3b8e34cb2bd92e8b26d0e9d9a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Mac=20Rouillon?= Date: Wed, 30 Sep 2020 18:53:31 +0000 Subject: [FIX] l10n_ar: Previous verify for the partner property fpos then use auto_apply. The problem here is before this changes, the fiscal position only take into account if them has "auto_apply" True, and for the cases that the partner has their property fiscal position configurate for a company this is not taking into account. After this changes we evaluate for the property fiscal position for the partner and then if non result we seek a fiscal position with the auto apply and the responsability of afip. So this the same as the original method do. closes odoo/odoo#59864 X-original-commit: 5ddcad3cb1d6063b7be89e4f0bd35b89885f746b Signed-off-by: Josse Colpaert --- addons/l10n_ar/models/account_fiscal_position.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'addons') diff --git a/addons/l10n_ar/models/account_fiscal_position.py b/addons/l10n_ar/models/account_fiscal_position.py index 7c21abba2cb..40875efb53e 100644 --- a/addons/l10n_ar/models/account_fiscal_position.py +++ b/addons/l10n_ar/models/account_fiscal_position.py @@ -16,6 +16,18 @@ class AccountFiscalPosition(models.Model): """ Take into account the partner afip responsibility in order to auto-detect the fiscal position """ company = self.env.company if company.country_id == self.env.ref('base.ar'): + PartnerObj = self.env['res.partner'] + partner = PartnerObj.browse(partner_id) + + # if no delivery use invoicing + if delivery_id: + delivery = PartnerObj.browse(delivery_id) + else: + delivery = partner + + # partner manually set fiscal position always win + if delivery.property_account_position_id or partner.property_account_position_id: + return delivery.property_account_position_id or partner.property_account_position_id domain = [ ('auto_apply', '=', True), ('l10n_ar_afip_responsibility_type_ids', '=', self.env['res.partner'].browse( -- cgit v1.2.3