diff --git a/l10n_it_fatturapa_in/__manifest__.py b/l10n_it_fatturapa_in/__manifest__.py index 3f1433c1cd3f..a9ea2dcf2d82 100644 --- a/l10n_it_fatturapa_in/__manifest__.py +++ b/l10n_it_fatturapa_in/__manifest__.py @@ -15,6 +15,7 @@ "license": "AGPL-3", "depends": [ "l10n_it_fatturapa", + "l10n_it_fiscal_document_type", "l10n_it_withholding_tax_reason", ], "data": [ diff --git a/l10n_it_fatturapa_in/models/attachment.py b/l10n_it_fatturapa_in/models/attachment.py index 6f8dcf6e1cc5..ad4710e33825 100644 --- a/l10n_it_fatturapa_in/models/attachment.py +++ b/l10n_it_fatturapa_in/models/attachment.py @@ -93,24 +93,23 @@ def _compute_xml_data(self): wiz_obj = self.env["wizard.import.fatturapa"].with_context( from_attachment=att ) - if wiz_obj: - fatt = wiz_obj.get_invoice_obj(att) - cedentePrestatore = fatt.FatturaElettronicaHeader.CedentePrestatore - partner_id = wiz_obj.getCedPrest(cedentePrestatore) - att.xml_supplier_id = partner_id - att.invoices_number = len(fatt.FatturaElettronicaBody) - att.invoices_total = 0 - invoices_date = [] - for invoice_body in fatt.FatturaElettronicaBody: - dgd = invoice_body.DatiGenerali.DatiGeneraliDocumento - att.invoices_total += float(dgd.ImportoTotaleDocumento or 0) - invoice_date = format_date( - att.with_context(lang=att.env.user.lang).env, - fields.Date.from_string(dgd.Data), - ) - if invoice_date not in invoices_date: - invoices_date.append(invoice_date) - att.invoices_date = " ".join(invoices_date) + fatt = wiz_obj.get_invoice_obj(att) + cedentePrestatore = fatt.FatturaElettronicaHeader.CedentePrestatore + partner_id = wiz_obj.getCedPrest(cedentePrestatore) + att.xml_supplier_id = partner_id + att.invoices_number = len(fatt.FatturaElettronicaBody) + att.invoices_total = 0 + invoices_date = [] + for invoice_body in fatt.FatturaElettronicaBody: + dgd = invoice_body.DatiGenerali.DatiGeneraliDocumento + att.invoices_total += float(dgd.ImportoTotaleDocumento or 0) + invoice_date = format_date( + att.with_context(lang=att.env.user.lang).env, + fields.Date.from_string(dgd.Data), + ) + if invoice_date not in invoices_date: + invoices_date.append(invoice_date) + att.invoices_date = " ".join(invoices_date) @api.depends("in_invoice_ids") def _compute_registered(self): diff --git a/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py b/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py index 6890b4b627c7..2890df6c4d86 100644 --- a/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py +++ b/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py @@ -1003,7 +1003,8 @@ def invoiceCreate(self, fatt, fatturapa_attachment, FatturaBody, partner_id): # compute the invoice invoice.with_context( - check_move_validity=False)._move_autocomplete_invoice_lines_values() + check_move_validity=False + )._move_autocomplete_invoice_lines_values() self.set_vendor_bill_data(FatturaBody, invoice)