From 7fecc72fd3e0826d724e38c8d1ad7ef6725f6d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 2 Nov 2009 19:15:06 +0100 Subject: [PATCH] Fix company context domain when company is not in context --- purchase.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/purchase.py b/purchase.py index f671498994..83f875eedf 100644 --- a/purchase.py +++ b/purchase.py @@ -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")