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

[14.0][IMP] l10n_it_fatturapa_in: Rimozione dipendenza da ritenute #2410

Closed
Closed
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
1 change: 0 additions & 1 deletion l10n_it_fatturapa_in/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"base_vat",
"l10n_it_fatturapa",
"l10n_it_fiscal_document_type",
"l10n_it_withholding_tax_reason",
],
"data": [
"views/account_view.xml",
Expand Down
26 changes: 26 additions & 0 deletions l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,32 @@ def set_withholding_tax(self, FatturaBody, invoice_data):
Withholdings = FatturaBody.DatiGenerali.DatiGeneraliDocumento.DatiRitenuta
if not Withholdings:
return None
withholdings_module_name = "l10n_it_withholding_tax_reason"
withholdings_module = self.env["ir.module.module"].search(
[
("name", "=", withholdings_module_name),
("state", "in", ("installed", "to upgrade")),
]
)
if not withholdings_module:
fatturapa_attachment = self.env["fatturapa.attachment.in"].browse(
invoice_data.get("fatturapa_attachment_in_id")
)
invoice_ref = FatturaBody.DatiGenerali.DatiGeneraliDocumento.Numero
raise UserError(
_(
"The bill having reference {invoice_ref} "
"included in e-invoice {e_invoice_name} "
"contains withholding taxes but "
"{withholdings_module_name} is not installed.\n"
"In order to import the e-invoice {e_invoice_name}, "
"install {withholdings_module_name} module and try again."
).format(
withholdings_module_name=withholdings_module_name,
invoice_ref=invoice_ref,
e_invoice_name=fatturapa_attachment.name,
)
)
invoice_data["ftpa_withholding_ids"] = []
wt_founds = []
for Withholding in Withholdings:
Expand Down