From 1c756c3276d3671986aa2e16d31254c8d2049ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 2 Nov 2009 19:19:39 +0100 Subject: [PATCH] Fix company context domain when company is not in context (transplanted from bd5b84915e07ee15f66015464d9952f81d5fa5d9) --- sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sale.py b/sale.py index f9ed5b2381..6d0075474d 100644 --- a/sale.py +++ b/sale.py @@ -17,7 +17,8 @@ class Sale(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', readonly=True, select=1) description = fields.Char('Description', states={ 'readonly': "state != 'draft'",