Fix company context domain when company is not in context

This commit is contained in:
Cédric Krier committed 2009-11-02 19:15:06 +01:00
1 parent 37b3af3f4e
commit 7fecc72fd3
1 file changed
+4 -2
+4 -2
View File
@@ -22,7 +22,8 @@ class Purchase(ModelWorkflow, ModelSQL, ModelView):
company = fields.Many2One('company.company', 'Company', required=True,
states={
'readonly': "state != 'draft' or bool(lines)",
}, domain=["('id', '=', context.get('company', 0))"])
}, domain=["('id', 'company' in context and '=' or '!=', " \
"context.get('company', 0))"])
reference = fields.Char('Reference', size=None, readonly=True, select=1)
supplier_reference = fields.Char('Supplier Reference', select=1)
description = fields.Char('Description', size=None, states=_STATES)
@@ -1525,7 +1526,8 @@ class ProductSupplier(ModelSQL, ModelView):
'product_supplier', 'Prices')
company = fields.Many2One('company.company', 'Company', required=True,
ondelete='CASCADE', select=1,
domain=["('id', '=', context.get('company', 0))"])
domain=["('id', 'company' in context and '=' or '!=', " \
"context.get('company', 0))"])
delivery_time = fields.Integer('Delivery Time',
help="In number of days")