From 72a43aeeea7fd79b3f7dbfbaa99de4ededac049b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 28 Mar 2008 17:39:54 +0100 Subject: [PATCH] Add posted option on open account chart --- account.py | 9 ++++++++- account.xml | 15 +++++++++++++++ move.py | 7 +++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/account.py b/account.py index 1c334b3cb9..29cff1ae2c 100644 --- a/account.py +++ b/account.py @@ -286,6 +286,10 @@ class OpenChartAccountInit(WizardOSV): _name = 'account.account.open_chart_account.init' fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year', help='Keep empty for all open fiscal year') + posted = fields.Boolean('Posted Move', help='Only posted move') + + def default_posted(self, cursor, user, context=None): + return False OpenChartAccountInit() @@ -324,7 +328,10 @@ class OpenChartAccount(Wizard): model_data = model_data_obj.browse(cursor, user, model_data_ids[0], context=context) res = act_window_obj.read(cursor, user, model_data.db_id, context=context) - res['context'] = str({'fiscalyear': data['form']['fiscalyear']}) + res['context'] = str({ + 'fiscalyear': data['form']['fiscalyear'], + 'posted': data['form']['posted'], + }) return res OpenChartAccount() diff --git a/account.xml b/account.xml index 8f25e87574..db21d950e6 100644 --- a/account.xml +++ b/account.xml @@ -320,6 +320,21 @@ + + account.account.open_chart_account.init + form + + + + account.account.open_general_ledger.init form diff --git a/move.py b/move.py index 9d9e48b5e0..e1b26b1730 100644 --- a/move.py +++ b/move.py @@ -1183,10 +1183,13 @@ class OpenAccount(Wizard): model_data = model_data_obj.browse(cursor, user, model_data_ids[0], context=context) res = act_window_obj.read(cursor, user, model_data.db_id, context=context) - res['domain'] = str([ + res['domain'] = [ ('period', 'in', period_ids), ('account', '=', data['id']), - ]) + ] + if context.get('posted'): + res['domain'].append(('move.state', '=', 'posted')) + res['domain'] = str(res['domain']) res['context'] = str({'fiscalyear': context.get('fiscalyear')}) return res