From 1bbf0a1019473f0c868deae4a8773b6f7df51ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 27 Mar 2008 16:54:54 +0100 Subject: [PATCH] Change default debit/credit on journal into property Account are link to company but not the journals, so property will make the glue. --- journal.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/journal.py b/journal.py index 8e63a06921..4f0dfb199d 100644 --- a/journal.py +++ b/journal.py @@ -79,10 +79,18 @@ class Journal(OSV): update_posted = fields.Boolean('Allow cancelling moves') sequence = fields.Many2One('ir.sequence', 'Sequence', required=True, domain="[('code', '=', 'account.journal')]") - #XXX chance to properties to be multi-company - # must be required if centralised - credit_account = fields.Many2One('account.account', 'Default credit account') - debit_account = fields.Many2One('account.account', 'Default debit account') + credit_account = fields.Property('account.account', type='many2one', + relation='account.account', string='Default Credit Account', + domain="[('type', '!=', 'view'), ('company', '=', company)]", + states={ + 'required': "centralised", + }) + debit_account = fields.Property('account.account', type='many2one', + relation='account.account', string='Default Debit Account', + domain="[('type', '!=', 'view'), ('company', '=', company)]", + states={ + 'required': "centralised", + }) def default_active(self, cursor, user, context=None): return True