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