[FIX] l10n_it_edi: only send e-invoice in IT companies

Have 2 companies, one in FR (with l10n_fr), one in IT (with l10n_it_edi)
From the French company create an invoice for a french customer.
Confirm.

The message ' E-Invoice check failed. You can modify the
invoice, and resend it.' related to italian e-invoicing will appear

opw-2481035

closes odoo/odoo#69050

X-original-commit: d5075308131f82020702c6650a1869ffd93fb85e
Signed-off-by: Josse Colpaert <jco@openerp.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2021-04-09 14:34:15 +00:00
parent 40e03c8f12
commit 82e4c19947
+1 -1
View File
@@ -260,7 +260,7 @@ class AccountMove(models.Model):
# OVERRIDE
posted = super()._post(soft=soft)
for move in posted.filtered(lambda m: m.l10n_it_send_state == 'to_send' and m.move_type == 'out_invoice'):
for move in posted.filtered(lambda m: m.l10n_it_send_state == 'to_send' and m.move_type == 'out_invoice' and m.company_id.country_id.code == 'IT'):
move.send_pec_mail()
return posted