status 'abgeglichen' ok + test
This commit is contained in:
parent
63a3f8f020
commit
1ab987d532
9 changed files with 99 additions and 28 deletions
18
line.py
18
line.py
|
@ -183,6 +183,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
table = cls.__table_handler__(module_name)
|
table = cls.__table_handler__(module_name)
|
||||||
table.drop_constraint('amount_val')
|
table.drop_constraint('amount_val')
|
||||||
|
table.drop_constraint('state_val')
|
||||||
cls.migrate_amount_2nd_currency()
|
cls.migrate_amount_2nd_currency()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -192,15 +193,14 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
cls._order.insert(0, ('state', 'ASC'))
|
cls._order.insert(0, ('state', 'ASC'))
|
||||||
t = cls.__table__()
|
t = cls.__table__()
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('state_val',
|
('state_val2',
|
||||||
Check(t, t.state.in_(['edit', 'check', 'done'])),
|
Check(t, t.state.in_(['edit', 'check', 'done', 'recon'])),
|
||||||
'cashbook.msg_line_wrong_state_value'),
|
'cashbook.msg_line_wrong_state_value'),
|
||||||
])
|
])
|
||||||
cls._transitions |= set((
|
cls._transitions |= set((
|
||||||
('edit', 'check'),
|
('edit', 'check'),
|
||||||
('check', 'recon'),
|
('check', 'recon'),
|
||||||
('recon', 'done'),
|
('recon', 'done'),
|
||||||
('recon', 'check'),
|
|
||||||
('check', 'edit'),
|
('check', 'edit'),
|
||||||
))
|
))
|
||||||
cls._buttons.update({
|
cls._buttons.update({
|
||||||
|
@ -210,7 +210,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
'depends': ['state', 'reference'],
|
'depends': ['state', 'reference'],
|
||||||
},
|
},
|
||||||
'wfcheck': {
|
'wfcheck': {
|
||||||
'invisible': ~Eval('state', '').in_(['edit', 'recon']),
|
'invisible': Eval('state') != 'edit',
|
||||||
'depends': ['state'],
|
'depends': ['state'],
|
||||||
},
|
},
|
||||||
'wfrecon': {
|
'wfrecon': {
|
||||||
|
@ -490,7 +490,7 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
query = tab_line.select(
|
query = tab_line.select(
|
||||||
Case(
|
Case(
|
||||||
(tab_line.state == 'edit', 1),
|
(tab_line.state == 'edit', 1),
|
||||||
(tab_line.state.in_(['check', 'done']), 0),
|
(tab_line.state.in_(['check', 'recon', 'done']), 0),
|
||||||
else_ = 2),
|
else_ = 2),
|
||||||
where=tab_line.id==table.id
|
where=tab_line.id==table.id
|
||||||
)
|
)
|
||||||
|
@ -927,9 +927,9 @@ class Line(SecondCurrencyMixin, Workflow, ModelSQL, ModelView):
|
||||||
if cashbook:
|
if cashbook:
|
||||||
values.update(cls.add_2nd_currency(values, Cashbook(cashbook).currency))
|
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 values.get('reconciliation', None):
|
||||||
if not values.get('state', '-') in ['check', 'done']:
|
if not values.get('state', '-') in ['check', 'done', 'recon']:
|
||||||
date_txt = '-'
|
date_txt = '-'
|
||||||
if values.get('date', None):
|
if values.get('date', None):
|
||||||
date_txt = Report.format_date(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,
|
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):
|
if values.get('reconciliation', None):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if not line.state in ['check', 'done']:
|
if not line.state in ['check', 'done', 'recon']:
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_line_deny_recon_by_state',
|
'cashbook.msg_line_deny_recon_by_state',
|
||||||
recname = line.rec_name
|
recname = line.rec_name
|
||||||
|
|
46
line.xml
46
line.xml
|
@ -18,6 +18,12 @@ full copyright notices and license terms. -->
|
||||||
<field name="priority" eval="10"/>
|
<field name="priority" eval="10"/>
|
||||||
<field name="name">line_list</field>
|
<field name="name">line_list</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.ui.view" id="line_recon_view_list">
|
||||||
|
<field name="model">cashbook.line</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="priority" eval="15"/>
|
||||||
|
<field name="name">line_recon_list</field>
|
||||||
|
</record>
|
||||||
<record model="ir.ui.view" id="line_view_form">
|
<record model="ir.ui.view" id="line_view_form">
|
||||||
<field name="model">cashbook.line</field>
|
<field name="model">cashbook.line</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
|
@ -26,7 +32,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- action view -->
|
<!-- action view -->
|
||||||
<record model="ir.action.act_window" id="act_line_view">
|
<record model="ir.action.act_window" id="act_line_view2">
|
||||||
<field name="name">Cashbook Line</field>
|
<field name="name">Cashbook Line</field>
|
||||||
<field name="res_model">cashbook.line</field>
|
<field name="res_model">cashbook.line</field>
|
||||||
<field name="context_model">cashbook.line.context</field>
|
<field name="context_model">cashbook.line.context</field>
|
||||||
|
@ -37,7 +43,7 @@ full copyright notices and license terms. -->
|
||||||
['OR',
|
['OR',
|
||||||
('state', '=', 'edit'),
|
('state', '=', 'edit'),
|
||||||
If(Bool(Eval('done')), ('state', '=', 'done'), ('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"/>
|
pyson="1"/>
|
||||||
|
@ -45,15 +51,15 @@ full copyright notices and license terms. -->
|
||||||
eval="[('cashbook', '=', Eval('cashbook', -1))]"
|
eval="[('cashbook', '=', Eval('cashbook', -1))]"
|
||||||
pyson="1"/>
|
pyson="1"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.view" id="act_line_view-1">
|
<record model="ir.action.act_window.view" id="act_line_view2-1">
|
||||||
<field name="sequence" eval="10"/>
|
<field name="sequence" eval="10"/>
|
||||||
<field name="view" ref="line_view_list"/>
|
<field name="view" ref="line_view_list"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.view" id="act_line_view-2">
|
<record model="ir.action.act_window.view" id="act_line_view2-2">
|
||||||
<field name="sequence" eval="20"/>
|
<field name="sequence" eval="20"/>
|
||||||
<field name="view" ref="line_view_form"/>
|
<field name="view" ref="line_view_form"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- domain view -->
|
<!-- domain view -->
|
||||||
|
@ -62,20 +68,20 @@ full copyright notices and license terms. -->
|
||||||
<field name="sequence" eval="10"/>
|
<field name="sequence" eval="10"/>
|
||||||
<field name="domain" eval="[('month', '=', 0)]" pyson="1"/>
|
<field name="domain" eval="[('month', '=', 0)]" pyson="1"/>
|
||||||
<field name="count" eval="True"/>
|
<field name="count" eval="True"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.domain" id="act_line_domain_last">
|
<record model="ir.action.act_window.domain" id="act_line_domain_last">
|
||||||
<field name="name">Last Month</field>
|
<field name="name">Last Month</field>
|
||||||
<field name="sequence" eval="20"/>
|
<field name="sequence" eval="20"/>
|
||||||
<field name="domain" eval="[('month', '=', 1)]" pyson="1"/>
|
<field name="domain" eval="[('month', '=', 1)]" pyson="1"/>
|
||||||
<field name="count" eval="True"/>
|
<field name="count" eval="True"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.domain" id="act_line_domain_all">
|
<record model="ir.action.act_window.domain" id="act_line_domain_all">
|
||||||
<field name="name">All</field>
|
<field name="name">All</field>
|
||||||
<field name="sequence" eval="999"/>
|
<field name="sequence" eval="999"/>
|
||||||
<field name="domain"/>
|
<field name="domain"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- permission -->
|
<!-- permission -->
|
||||||
|
@ -229,6 +235,28 @@ full copyright notices and license terms. -->
|
||||||
<field name="group" ref="group_cashbook_doneline"/>
|
<field name="group" ref="group_cashbook_doneline"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- button - recon -->
|
||||||
|
<record model="ir.model.button" id="line_wfrecon_button">
|
||||||
|
<field name="name">wfrecon</field>
|
||||||
|
<field name="string">Reconciled</field>
|
||||||
|
<field name="model" search="[('model', '=', 'cashbook.line')]"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.button-res.group"
|
||||||
|
id="line_wfrecon_button-group_cashbook_admin">
|
||||||
|
<field name="button" ref="line_wfrecon_button"/>
|
||||||
|
<field name="group" ref="group_cashbook_admin"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.button-res.group"
|
||||||
|
id="line_wfrecon_button-group_cashbook_checkline">
|
||||||
|
<field name="button" ref="line_wfrecon_button"/>
|
||||||
|
<field name="group" ref="group_cashbook_checkline"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.button-res.group"
|
||||||
|
id="line_wfrecon_button-group_cashbook_doneline">
|
||||||
|
<field name="button" ref="line_wfrecon_button"/>
|
||||||
|
<field name="group" ref="group_cashbook_doneline"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- button - done -->
|
<!-- button - done -->
|
||||||
<record model="ir.model.button" id="line_wfdone_button">
|
<record model="ir.model.button" id="line_wfdone_button">
|
||||||
<field name="name">wfdone</field>
|
<field name="name">wfdone</field>
|
||||||
|
|
|
@ -302,7 +302,7 @@ msgctxt "model:ir.action,name:act_type_view"
|
||||||
msgid "Cashbook Type"
|
msgid "Cashbook Type"
|
||||||
msgstr "Kassenbuchtyp"
|
msgstr "Kassenbuchtyp"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:act_line_view"
|
msgctxt "model:ir.action,name:act_line_view2"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Kassenbuchzeile"
|
msgstr "Kassenbuchzeile"
|
||||||
|
|
||||||
|
@ -370,6 +370,10 @@ msgctxt "model:ir.model.button,string:line_wfcheck_button"
|
||||||
msgid "Check"
|
msgid "Check"
|
||||||
msgstr "Prüfen"
|
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"
|
msgctxt "model:ir.model.button,string:line_wfdone_button"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Fertig"
|
msgstr "Fertig"
|
||||||
|
|
14
locale/en.po
14
locale/en.po
|
@ -282,7 +282,7 @@ msgctxt "model:ir.action,name:act_type_view"
|
||||||
msgid "Cashbook Type"
|
msgid "Cashbook Type"
|
||||||
msgstr "Cashbook Type"
|
msgstr "Cashbook Type"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:act_line_view"
|
msgctxt "model:ir.action,name:act_line_view2"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Cashbook Line"
|
msgstr "Cashbook Line"
|
||||||
|
|
||||||
|
@ -342,6 +342,10 @@ msgctxt "model:ir.model.button,string:line_wfcheck_button"
|
||||||
msgid "Check"
|
msgid "Check"
|
||||||
msgstr "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"
|
msgctxt "model:ir.model.button,string:line_wfdone_button"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Done"
|
msgstr "Done"
|
||||||
|
@ -634,6 +638,10 @@ msgctxt "selection:cashbook.split,state:"
|
||||||
msgid "Checked"
|
msgid "Checked"
|
||||||
msgstr "Checked"
|
msgstr "Checked"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,state:"
|
||||||
|
msgid "Reconciled"
|
||||||
|
msgstr "Reconciled"
|
||||||
|
|
||||||
msgctxt "selection:cashbook.split,state:"
|
msgctxt "selection:cashbook.split,state:"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Done"
|
msgstr "Done"
|
||||||
|
@ -762,6 +770,10 @@ msgctxt "selection:cashbook.line,state:"
|
||||||
msgid "Checked"
|
msgid "Checked"
|
||||||
msgstr "Checked"
|
msgstr "Checked"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.line,state:"
|
||||||
|
msgid "Reconciled"
|
||||||
|
msgstr "Reconciled"
|
||||||
|
|
||||||
msgctxt "selection:cashbook.line,state:"
|
msgctxt "selection:cashbook.line,state:"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Done"
|
msgstr "Done"
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
depends=DEPENDS+['date_from', 'date_to', 'cashbook'],
|
depends=DEPENDS+['date_from', 'date_to', 'cashbook'],
|
||||||
add_remove=[
|
add_remove=[
|
||||||
('cashbook', '=', Eval('cashbook')),
|
('cashbook', '=', Eval('cashbook')),
|
||||||
('state', 'in', ['check', 'done']),
|
('state', 'in', ['check', 'recon', 'done']),
|
||||||
('date', '>=', Eval('date_from')),
|
('date', '>=', Eval('date_from')),
|
||||||
('date', '<=', Eval('date_to')),
|
('date', '<=', Eval('date_to')),
|
||||||
],
|
],
|
||||||
|
@ -156,7 +156,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
('date', '>', reconciliation.date_from),
|
('date', '>', reconciliation.date_from),
|
||||||
('date', '<', reconciliation.date_to),
|
('date', '<', reconciliation.date_to),
|
||||||
('cashbook.id', '=', reconciliation.cashbook.id),
|
('cashbook.id', '=', reconciliation.cashbook.id),
|
||||||
('state', '!=', 'check'),
|
('state', 'not in', ['check', 'recon']),
|
||||||
]) > 0:
|
]) > 0:
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.mds_recon_deny_line_not_check',
|
'cashbook.mds_recon_deny_line_not_check',
|
||||||
|
@ -235,7 +235,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
('date', '<=', reconciliation.date_to),
|
('date', '<=', reconciliation.date_to),
|
||||||
('cashbook.id', '=', reconciliation.cashbook.id),
|
('cashbook.id', '=', reconciliation.cashbook.id),
|
||||||
('reconciliation', '=', None),
|
('reconciliation', '=', None),
|
||||||
('state', '=', 'check'),
|
('state', 'in', ['check', 'recon']),
|
||||||
])
|
])
|
||||||
if len(lines) > 0:
|
if len(lines) > 0:
|
||||||
values['lines'] = [('add', [x.id for x in lines])]
|
values['lines'] = [('add', [x.id for x in lines])]
|
||||||
|
@ -259,8 +259,16 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
Line = Pool().get('cashbook.line')
|
Line = Pool().get('cashbook.line')
|
||||||
|
|
||||||
to_wfdone_line = []
|
to_wfdone_line = []
|
||||||
|
to_wfrecon_line = []
|
||||||
for reconciliation in reconciliations:
|
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
|
# deny if there are lines not linked to reconciliation
|
||||||
if Line.search_count([
|
if Line.search_count([
|
||||||
|
@ -281,6 +289,9 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
date_to = Report.format_date(reconciliation.date_to),
|
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:
|
if len(to_wfdone_line) > 0:
|
||||||
Line.wfdone(to_wfdone_line)
|
Line.wfdone(to_wfdone_line)
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,4 @@ full copyright notices and license terms. -->
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<button name="wfedit"/>
|
<button name="wfedit"/>
|
||||||
<button name="wfcheck"/>
|
<button name="wfcheck"/>
|
||||||
<button name="wfrecon"/>
|
|
||||||
</tree>
|
</tree>
|
||||||
|
|
16
view/line_recon_list.xml
Normal file
16
view/line_recon_list.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
full copyright notices and license terms. -->
|
||||||
|
<tree>
|
||||||
|
<field name="cashbook" tree_invisible="1"/>
|
||||||
|
<field name="number"/>
|
||||||
|
<field name="date"/>
|
||||||
|
<field name="payee"/>
|
||||||
|
<field name="category_view"/>
|
||||||
|
<field name="descr_short" expand="1"/>
|
||||||
|
<field name="credit" sum="Credit"/>
|
||||||
|
<field name="debit" sum="Debit"/>
|
||||||
|
<field name="state"/>
|
||||||
|
<button name="wfrecon"/>
|
||||||
|
</tree>
|
|
@ -31,5 +31,6 @@ full copyright notices and license terms. -->
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
|
||||||
<field name="lines" colspan="6"/>
|
<field name="lines" colspan="6"
|
||||||
|
view_ids="cashbook.line_recon_view_list,cashbook.line_view_form"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -71,7 +71,7 @@ class OpenCashBook(OLineMixin, Wizard):
|
||||||
Button('Cancel', 'end', 'tryton-cancel'),
|
Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Open', 'open_', 'tryton-ok', default=True),
|
Button('Open', 'open_', 'tryton-ok', default=True),
|
||||||
])
|
])
|
||||||
open_ = StateAction('cashbook.act_line_view')
|
open_ = StateAction('cashbook.act_line_view2')
|
||||||
|
|
||||||
def transition_check(self):
|
def transition_check(self):
|
||||||
""" dont ask and open cashbook if user has 1x only
|
""" dont ask and open cashbook if user has 1x only
|
||||||
|
@ -141,7 +141,7 @@ class OpenCashBookTree(OLineMixin, Wizard):
|
||||||
__name__ = 'cashbook.open_lines_tree'
|
__name__ = 'cashbook.open_lines_tree'
|
||||||
|
|
||||||
start_state = 'open_'
|
start_state = 'open_'
|
||||||
open_ = StateAction('cashbook.act_line_view')
|
open_ = StateAction('cashbook.act_line_view2')
|
||||||
|
|
||||||
def do_open_(self, action):
|
def do_open_(self, action):
|
||||||
""" open view from doubleclick
|
""" open view from doubleclick
|
||||||
|
|
Loading…
Reference in a new issue