diff --git a/line.py b/line.py index dc1fc0d..53f7fea 100644 --- a/line.py +++ b/line.py @@ -183,6 +183,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView): table = cls.__table_handler__(module_name) table.drop_constraint('amount_val') + table.drop_constraint('state_val') cls.migrate_amount_2nd_currency() @classmethod @@ -192,15 +193,14 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView): cls._order.insert(0, ('state', 'ASC')) t = cls.__table__() cls._sql_constraints.extend([ - ('state_val', - Check(t, t.state.in_(['edit', 'check', 'done'])), + ('state_val2', + Check(t, t.state.in_(['edit', 'check', 'done', 'recon'])), 'cashbook.msg_line_wrong_state_value'), ]) cls._transitions |= set(( ('edit', 'check'), ('check', 'recon'), ('recon', 'done'), - ('recon', 'check'), ('check', 'edit'), )) cls._buttons.update({ @@ -210,7 +210,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView): 'depends': ['state', 'reference'], }, 'wfcheck': { - 'invisible': ~Eval('state', '').in_(['edit', 'recon']), + 'invisible': Eval('state') != 'edit', 'depends': ['state'], }, 'wfrecon': { @@ -490,7 +490,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView): query = tab_line.select( Case( (tab_line.state == 'edit', 1), - (tab_line.state.in_(['check', 'done']), 0), + (tab_line.state.in_(['check', 'recon', 'done']), 0), else_ = 2), where=tab_line.id==table.id ) @@ -927,9 +927,9 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView): if cashbook: values.update(cls.add_2nd_currency(values, Cashbook(cashbook).currency)) - # deny add to reconciliation if state is not 'check' or 'done' + # deny add to reconciliation if state is not 'check', 'recon' or 'done' if values.get('reconciliation', None): - if not values.get('state', '-') in ['check', 'done']: + if not values.get('state', '-') in ['check', 'done', 'recon']: date_txt = '-' if values.get('date', None): date_txt = Report.format_date(values.get('date', None)) @@ -962,10 +962,10 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView): recname = line.rec_name, )) - # deny add to reconciliation if state is not 'check' or 'done' + # deny add to reconciliation if state is not 'check', 'recon' or 'done' if values.get('reconciliation', None): for line in lines: - if not line.state in ['check', 'done']: + if not line.state in ['check', 'done', 'recon']: raise UserError(gettext( 'cashbook.msg_line_deny_recon_by_state', recname = line.rec_name diff --git a/line.xml b/line.xml index b2a7ea3..b26fb1a 100644 --- a/line.xml +++ b/line.xml @@ -18,6 +18,12 @@ full copyright notices and license terms. --> line_list + + cashbook.line + tree + + line_recon_list + cashbook.line form @@ -26,7 +32,7 @@ full copyright notices and license terms. --> - + Cashbook Line cashbook.line cashbook.line.context @@ -37,7 +43,7 @@ full copyright notices and license terms. --> ['OR', ('state', '=', 'edit'), If(Bool(Eval('done')), ('state', '=', 'done'), ('state', '=', 'edit')), - If(Bool(Eval('checked')), ('state', '=', 'check'), ('state', '=', 'edit')), + If(Bool(Eval('checked')), ('state', 'in', ['check', 'recon']), ('state', '=', 'edit')), ], ]" pyson="1"/> @@ -45,15 +51,15 @@ full copyright notices and license terms. --> eval="[('cashbook', '=', Eval('cashbook', -1))]" pyson="1"/> - + - + - + - + @@ -62,20 +68,20 @@ full copyright notices and license terms. --> - + Last Month - + All - + @@ -229,6 +235,28 @@ full copyright notices and license terms. --> + + + wfrecon + Reconciled + + + + + + + + + + + + + + + wfdone diff --git a/locale/de.po b/locale/de.po index 1809f45..c772093 100644 --- a/locale/de.po +++ b/locale/de.po @@ -302,7 +302,7 @@ msgctxt "model:ir.action,name:act_type_view" msgid "Cashbook Type" msgstr "Kassenbuchtyp" -msgctxt "model:ir.action,name:act_line_view" +msgctxt "model:ir.action,name:act_line_view2" msgid "Cashbook Line" msgstr "Kassenbuchzeile" @@ -370,6 +370,10 @@ msgctxt "model:ir.model.button,string:line_wfcheck_button" msgid "Check" msgstr "Prüfen" +msgctxt "model:ir.model.button,string:line_wfrecon_button" +msgid "Reconciled" +msgstr "Abgeglichen" + msgctxt "model:ir.model.button,string:line_wfdone_button" msgid "Done" msgstr "Fertig" diff --git a/locale/en.po b/locale/en.po index b97e385..ccde331 100644 --- a/locale/en.po +++ b/locale/en.po @@ -282,7 +282,7 @@ msgctxt "model:ir.action,name:act_type_view" msgid "Cashbook Type" msgstr "Cashbook Type" -msgctxt "model:ir.action,name:act_line_view" +msgctxt "model:ir.action,name:act_line_view2" msgid "Cashbook Line" msgstr "Cashbook Line" @@ -342,6 +342,10 @@ msgctxt "model:ir.model.button,string:line_wfcheck_button" msgid "Check" msgstr "Check" +msgctxt "model:ir.model.button,string:line_wfrecon_button" +msgid "Reconciled" +msgstr "Reconciled" + msgctxt "model:ir.model.button,string:line_wfdone_button" msgid "Done" msgstr "Done" @@ -634,6 +638,10 @@ msgctxt "selection:cashbook.split,state:" msgid "Checked" msgstr "Checked" +msgctxt "selection:cashbook.split,state:" +msgid "Reconciled" +msgstr "Reconciled" + msgctxt "selection:cashbook.split,state:" msgid "Done" msgstr "Done" @@ -762,6 +770,10 @@ msgctxt "selection:cashbook.line,state:" msgid "Checked" msgstr "Checked" +msgctxt "selection:cashbook.line,state:" +msgid "Reconciled" +msgstr "Reconciled" + msgctxt "selection:cashbook.line,state:" msgid "Done" msgstr "Done" diff --git a/reconciliation.py b/reconciliation.py index 2269d67..143813c 100644 --- a/reconciliation.py +++ b/reconciliation.py @@ -69,7 +69,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView): depends=DEPENDS+['date_from', 'date_to', 'cashbook'], add_remove=[ ('cashbook', '=', Eval('cashbook')), - ('state', 'in', ['check', 'done']), + ('state', 'in', ['check', 'recon', 'done']), ('date', '>=', Eval('date_from')), ('date', '<=', Eval('date_to')), ], @@ -156,7 +156,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView): ('date', '>', reconciliation.date_from), ('date', '<', reconciliation.date_to), ('cashbook.id', '=', reconciliation.cashbook.id), - ('state', '!=', 'check'), + ('state', 'not in', ['check', 'recon']), ]) > 0: raise UserError(gettext( 'cashbook.mds_recon_deny_line_not_check', @@ -235,7 +235,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView): ('date', '<=', reconciliation.date_to), ('cashbook.id', '=', reconciliation.cashbook.id), ('reconciliation', '=', None), - ('state', '=', 'check'), + ('state', 'in', ['check', 'recon']), ]) if len(lines) > 0: values['lines'] = [('add', [x.id for x in lines])] @@ -259,8 +259,16 @@ class Reconciliation(Workflow, ModelSQL, ModelView): Line = Pool().get('cashbook.line') to_wfdone_line = [] + to_wfrecon_line = [] for reconciliation in reconciliations: - to_wfdone_line.extend(list(reconciliation.lines)) + to_wfrecon_line.extend([ + x for x in reconciliation.lines \ + if x.state == 'check' + ]) + to_wfdone_line.extend([ + x for x in reconciliation.lines \ + if x.state == 'recon' + ]) # deny if there are lines not linked to reconciliation if Line.search_count([ @@ -281,6 +289,9 @@ class Reconciliation(Workflow, ModelSQL, ModelView): date_to = Report.format_date(reconciliation.date_to), )) + if len(to_wfrecon_line) > 0: + Line.wfrecon(to_wfrecon_line) + to_wfdone_line.extend(to_wfrecon_line) if len(to_wfdone_line) > 0: Line.wfdone(to_wfdone_line) diff --git a/view/line_list.xml b/view/line_list.xml index a1c7c60..9bef16b 100644 --- a/view/line_list.xml +++ b/view/line_list.xml @@ -15,5 +15,4 @@ full copyright notices and license terms. -->