From 92cf0ec1d9b82a16343040765ac6748eb1be6168 Mon Sep 17 00:00:00 2001 From: Pablo Date: Sat, 27 Apr 2019 17:57:02 +0200 Subject: [PATCH] [FIX] Allow open invoice by context --- hotel/models/inherited_account_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hotel/models/inherited_account_invoice.py b/hotel/models/inherited_account_invoice.py index fee86d10f..118029462 100644 --- a/hotel/models/inherited_account_invoice.py +++ b/hotel/models/inherited_account_invoice.py @@ -45,8 +45,8 @@ class AccountInvoice(models.Model): def action_invoice_open(self): to_open_invoices_without_vat = self.filtered(lambda inv: inv.state != 'open' and inv.partner_id.vat == False) to_open_invoices_without_country = self.filtered(lambda inv: inv.state != 'open' and not inv.partner_id.country_id) - if to_open_invoices_without_vat or to_open_invoices_without_country and \ - self.env.context.get('allow_open_invoice', False): + if (to_open_invoices_without_vat or to_open_invoices_without_country) and \ + self.env.context.get('validate_vat_number', True): vat_error = _("We need the VAT and Country of the following companies") for invoice in to_open_invoices_without_vat: vat_error += ", " + invoice.partner_id.name