Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][IMP] l10n_do_accounting: set Gasto Menor no matter company partner tax payer type #1074

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion l10n_do_accounting/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"category": "Localization",
"license": "LGPL-3",
"website": "https://github.com/odoo-dominicana",
"version": "15.0.0.10.7",
"version": "15.0.0.11.0",
# any module necessary for this one to work correctly
"depends": ["l10n_latam_invoice_document", "l10n_do"],
# always loaded
Expand Down
19 changes: 10 additions & 9 deletions l10n_do_accounting/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ def _get_all_ncf_types(self, types_list, invoice=False):
# create fiscal sequences
return types_list + ecf_types

if (
invoice.is_purchase_document()
and invoice.partner_id.l10n_do_dgii_tax_payer_type
and invoice.partner_id.l10n_do_dgii_tax_payer_type
in ("non_payer", "foreigner")
if invoice.is_purchase_document() and any(
t in types_list for t in ("minor", "informal", "exterior")
):
# Return ncf/ecf types depending on company ECF issuing status
return ecf_types if self.company_id.l10n_do_ecf_issuer else types_list
Expand Down Expand Up @@ -117,10 +114,14 @@ def _get_journal_ncf_types(self, counterpart_partner=False, invoice=False):
)
return self._get_all_ncf_types(res)
if counterpart_partner.l10n_do_dgii_tax_payer_type:
counterpart_ncf_types = ncf_types_data[
"issued" if self.type == "sale" else "received"
][counterpart_partner.l10n_do_dgii_tax_payer_type]
ncf_types = list(set(ncf_types) & set(counterpart_ncf_types))

if counterpart_partner == self.company_id.partner_id:
ncf_types = ["minor"]
else:
counterpart_ncf_types = ncf_types_data[
"issued" if self.type == "sale" else "received"
][counterpart_partner.l10n_do_dgii_tax_payer_type]
ncf_types = list(set(ncf_types) & set(counterpart_ncf_types))
else:
raise ValidationError(
_("Partner (%s) %s is needed to issue a fiscal invoice")
Expand Down
Loading