From f5918a04b6e73bbe0b44df88bc160a3185bc8a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 6 Nov 2009 08:13:03 +0100 Subject: [PATCH] Fix domain and depends on journal because company is not always in context (transplanted from 5852812e3433f86f52c43a8bf0daa1abd721add7) --- journal.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/journal.py b/journal.py index b4281c0d84..c7d6daa610 100644 --- a/journal.py +++ b/journal.py @@ -90,20 +90,22 @@ class Journal(ModelSQL, ModelView): context={'code': 'account.journal'}) credit_account = fields.Property(type='many2one', relation='account.account', string='Default Credit Account', - domain="[('kind', '!=', 'view'), ('company', '=', company)]", + domain="[('kind', '!=', 'view'), " \ + "('company', '=', context.get('company'))]", states={ 'required': "centralised or " \ "(type == 'cash' and context.get('company'))", 'invisible': "not context.get('company')", - }, depends=['company', 'type', 'centralised']) + }, depends=['type', 'centralised']) debit_account = fields.Property(type='many2one', relation='account.account', string='Default Debit Account', - domain="[('kind', '!=', 'view'), ('company', '=', company)]", + domain="[('kind', '!=', 'view'), " \ + "('company', '=', context.get('company'))]", states={ 'required': "centralised or " \ "(type == 'cash' and context.get('company'))", 'invisible': "not context.get('company')", - }, depends=['company', 'type', 'centralised']) + }, depends=['type', 'centralised']) def __init__(self): super(Journal, self).__init__()