diff --git a/CHANGELOG b/CHANGELOG index 981a0b4d5a..91703c568a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Use context model for chart of analytic accounts + Version 6.4.0 - 2022-05-02 * Bug fixes (see mercurial logs for details) * Add support for Python 3.10 diff --git a/__init__.py b/__init__.py index 6463aa4933..3fb1f195a8 100644 --- a/__init__.py +++ b/__init__.py @@ -13,7 +13,7 @@ def register(): Pool.register( account.Account, account.AccountDistribution, - account.OpenChartAccountStart, + account.AccountContext, account.AnalyticAccountEntry, line.Line, line.Move, @@ -21,6 +21,5 @@ def register(): rule.Rule, module='analytic_account', type_='model') Pool.register( - account.OpenChartAccount, line.OpenAccount, module='analytic_account', type_='wizard') diff --git a/account.py b/account.py index c4fd4eeb70..2f392def39 100644 --- a/account.py +++ b/account.py @@ -16,7 +16,6 @@ from trytond.pool import Pool from trytond.pyson import Eval, If, PYSONDecoder, PYSONEncoder from trytond.tools import lstrip_wildcard from trytond.transaction import Transaction -from trytond.wizard import Button, StateAction, StateView, Wizard from .exceptions import AccountValidationError @@ -297,34 +296,13 @@ class Account( return result -class OpenChartAccountStart(ModelView): +class AccountContext(ModelView): 'Open Chart of Accounts' - __name__ = 'analytic_account.open_chart.start' + __name__ = 'analytic_account.account.context' start_date = fields.Date('Start Date') end_date = fields.Date('End Date') -class OpenChartAccount(Wizard): - 'Open Chart of Accounts' - __name__ = 'analytic_account.open_chart' - start = StateView('analytic_account.open_chart.start', - 'analytic_account.open_chart_start_view_form', [ - Button('Cancel', 'end', 'tryton-cancel'), - Button('Open', 'open_', 'tryton-ok', default=True), - ]) - open_ = StateAction('analytic_account.act_account_tree2') - - def do_open_(self, action): - action['pyson_context'] = PYSONEncoder().encode({ - 'start_date': self.start.start_date, - 'end_date': self.start.end_date, - }) - return action, {} - - def transition_open_(self): - return 'end' - - class AccountDistribution(ModelView, ModelSQL): "Analytic Account Distribution" __name__ = 'analytic_account.account.distribution' diff --git a/account.xml b/account.xml index a8521b03ca..3b35dd024c 100644 --- a/account.xml +++ b/account.xml @@ -77,38 +77,35 @@ this repository contains the full copyright notices and license terms. --> sequence="10" id="menu_account_list"/> - + analytic_account.account tree childs - account_tree2 + account_tree_chart - - Analytic Accounts + + Chart of Analytic Accounts analytic_account.account + analytic_account.account.context - + - - + + - + - - - - Open Chart of Analytic Accounts - analytic_account.open_chart + + + id="menu_account_tree_chart"/> User in companies @@ -169,10 +166,10 @@ this repository contains the full copyright notices and license terms. --> - - analytic_account.open_chart.start + + analytic_account.account.context form - open_chart_start_form + account_context_form diff --git a/view/open_chart_start_form.xml b/view/account_context_form.xml similarity index 100% rename from view/open_chart_start_form.xml rename to view/account_context_form.xml diff --git a/view/account_tree2.xml b/view/account_tree_chart.xml similarity index 100% rename from view/account_tree2.xml rename to view/account_tree_chart.xml