Fix company context domain when company is not in context

This commit is contained in:
Cédric Krier
2009-11-02 19:08:15 +01:00
parent adc81e42e6
commit 0ffc5e1c6f
+5 -2
View File
@@ -33,7 +33,9 @@ class Invoice(ModelWorkflow, ModelSQL, ModelView):
_description = __doc__
_order_name = 'number'
company = fields.Many2One('company.company', 'Company', required=True,
states=_STATES, domain=["('id', '=', context.get('company', 0))"])
states=_STATES, domain=[
"('id', 'company' in context and '=' or '!=', " \
"context.get('company', 0))"])
type = fields.Selection(_TYPE, 'Type', select=1, on_change=['type'],
required=True, states={
'readonly': "state != 'draft' or context.get('type', False)" \
@@ -1288,7 +1290,8 @@ class InvoiceLine(ModelSQL, ModelView):
string='Currency Digits', on_change_with=['currency'])
company = fields.Many2One('company.company', 'Company', states={
'required': "not bool(invoice)",
}, domain=["('id', '=', context.get('company', 0))"])
}, domain=["('id', 'compamy' in context and '=' or '!=', " \
"context.get('company', 0))"])
sequence = fields.Integer('Sequence', states={
'invisible': "context.get('standalone', False)",