From ef32bd79f94a6b9ee27cd876faaebe8e668c83ef Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Tue, 11 Oct 2022 10:21:11 +0200 Subject: [PATCH] =?UTF-8?q?line/book:=20kassenbuch=20=C3=B6ffnen/anzeige?= =?UTF-8?q?=20optimiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- line.py | 34 --------------- line.xml | 4 +- view/cashbook_line_context_form.xml | 12 ++--- wizard_openline.py | 68 ++++++++++++++--------------- 4 files changed, 40 insertions(+), 78 deletions(-) diff --git a/line.py b/line.py index 099bde5..d45ce5b 100644 --- a/line.py +++ b/line.py @@ -984,12 +984,6 @@ class LineContext(ModelView): 'Line Context' __name__ = 'cashbook.line.context' - cashbook = fields.Many2One(string='Cashbook', required=True, - model_name='cashbook.book', - domain=[('btype', '!=', None)], - states={ - 'readonly': Eval('num_cashbook', 0) < 2, - }, depends=['num_cashbook']) date_from = fields.Date(string='Start Date', depends=['date_to'], help='Limits the date range for the displayed entries.', domain=[ @@ -1008,16 +1002,6 @@ class LineContext(ModelView): help='Show account lines in Checked-state.') done = fields.Boolean(string='Done', help='Show account lines in Done-state.') - num_cashbook = fields.Function(fields.Integer(string='Number of Cashbook', - readonly=True, states={'invisible': True}), - 'on_change_with_num_cashbook') - - @classmethod - def default_cashbook(cls): - """ get default from context - """ - context = Transaction().context - return context.get('cashbook', None) @classmethod def default_date_from(cls): @@ -1040,17 +1024,6 @@ class LineContext(ModelView): context = Transaction().context return context.get('checked', False) - @classmethod - def default_num_cashbook(cls): - """ get default from context - """ - CashBook = Pool().get('cashbook.book') - - with Transaction().set_context({ - '_check_access': True, - }): - return CashBook.search_count([('btype', '!=', None)]) - @classmethod def default_done(cls): """ get default from context @@ -1058,11 +1031,4 @@ class LineContext(ModelView): context = Transaction().context return context.get('done', False) - def on_change_with_num_cashbook(self, name=None): - """ get number of accessible cashbooks, - depends on user-permissions - """ - LineContext = Pool().get('cashbook.line.context') - return LineContext.default_num_cashbook() - # end LineContext diff --git a/line.xml b/line.xml index 284f259..b2a7ea3 100644 --- a/line.xml +++ b/line.xml @@ -32,7 +32,6 @@ full copyright notices and license terms. --> cashbook.line.context + diff --git a/view/cashbook_line_context_form.xml b/view/cashbook_line_context_form.xml index 01f1edb..9f7cbe1 100644 --- a/view/cashbook_line_context_form.xml +++ b/view/cashbook_line_context_form.xml @@ -2,20 +2,14 @@ -
-