diff --git a/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py b/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py index 202c82479b85..84163b63e6d7 100644 --- a/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py +++ b/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py @@ -1035,6 +1035,14 @@ def invoiceCreate(self, fatt, fatturapa_attachment, FatturaBody, partner_id): FatturaBody.DatiGenerali.DatiGeneraliDocumento.Data, "%Y-%m-%d" ).date() + delivery_partner_id = partner.address_get(["delivery"])["delivery"] + fiscal_position_id = ( + self.env["account.fiscal.position"].get_fiscal_position( + partner_id, delivery_id=delivery_partner_id + ) + or False + ) + invoice_data = { "e_invoice_received_date": e_invoice_received_date, "date": e_invoice_received_date @@ -1047,7 +1055,7 @@ def invoiceCreate(self, fatt, fatturapa_attachment, FatturaBody, partner_id): "currency_id": currency[0].id, "journal_id": purchase_journal.id, # 'origin': xmlData.datiOrdineAcquisto, - "fiscal_position_id": (partner.property_account_position_id.id or False), + "fiscal_position_id": fiscal_position_id, "invoice_payment_term_id": partner.property_supplier_payment_term_id.id, "company_id": company.id, "fatturapa_attachment_in_id": fatturapa_attachment.id,