Skip to content

Commit

Permalink
[FIX] OCA#2391 l10n_it_fatturapa_out: wrong company in XML
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMule71 committed Aug 13, 2021
1 parent 86676bd commit 2f058a4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion l10n_it_fatturapa_out/wizard/efattura.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,18 @@ def to_xml(self, env):
content = etree.tostring(root, xml_declaration=True, encoding="utf-8")
return content

def _get_company_from_invoices(self, invoices):
company_id = invoices.mapped("company_id")
if len(company_id) > 1:
raise UserError(
_("Invoices %s must belong to the same company.")
% invoices.mapped("number")
)
return company_id

def __init__(self, wizard, partner_id, invoices, progressivo_invio):
self.wizard = wizard
self.company_id = wizard.env.company
self.company_id = self._get_company_from_invoices(invoices) or wizard.env.company
self.partner_id = partner_id
self.invoices = invoices
self.progressivo_invio = progressivo_invio

0 comments on commit 2f058a4

Please sign in to comment.