diff options
| author | Nicolás Mac Rouillon <nmr@adhoc.com.ar> | 2020-09-30 18:53:31 +0000 |
|---|---|---|
| committer | Josse Colpaert <jco@odoo.com> | 2020-10-13 13:47:00 +0000 |
| commit | bbbccbfc6476a3b8e34cb2bd92e8b26d0e9d9a26 (patch) | |
| tree | 56f1f7cdf776f27580f49e4105dff1687b7a8a89 | |
| parent | 81a00e3469f93cb4686c92db5695316db92eb84c (diff) | |
[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 <jco@openerp.com>
| -rw-r--r-- | addons/l10n_ar/models/account_fiscal_position.py | 12 |
1 files changed, 12 insertions, 0 deletions
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( |
