diff --git a/addons/l10n_it_edi/models/account_invoice.py b/addons/l10n_it_edi/models/account_invoice.py index 123081e5503..1ba9b6ec213 100644 --- a/addons/l10n_it_edi/models/account_invoice.py +++ b/addons/l10n_it_edi/models/account_invoice.py @@ -49,6 +49,12 @@ class AccountInvoice(models.Model): @api.multi def invoice_validate(self): + # Clean context from default_type to avoid making attachment + # with wrong values in subsequent operations + cleaned_ctx = dict(self.env.context) + cleaned_ctx.pop('default_type', None) + self = self.with_context(cleaned_ctx) + super(AccountInvoice, self).invoice_validate() for invoice in self: if invoice.company_id.country_id != self.env.ref('base.it'):