Prevent to enter invoice line if company is not set

The company of invoice line is set by the domain from invoice lines. So if the
field is empty, the invoice line is not valid because company is required.

issue6762
review38681002
This commit is contained in:
Cédric Krier committed 2017-09-20 19:07:24 +02:00
1 parent d97ccaa6fc
commit 98b528ff42
1 file changed
+4 -1
+4 -1
View File
@@ -154,7 +154,10 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
domain=[
('company', '=', Eval('company', -1)),
],
states=_STATES, depends=['state', 'currency_date', 'company'])
states={
'readonly': (Eval('state') != 'draft') | ~Eval('company'),
},
depends=['state', 'company'])
taxes = fields.One2Many('account.invoice.tax', 'invoice', 'Tax Lines',
states=_STATES, depends=_DEPENDS)
comment = fields.Text('Comment', states=_STATES, depends=_DEPENDS)