line: suche optimiert (jetzt: kategorie, payee, beschreibung)

line: kontext-form optimiert,
abstimmung: anzeige-sortierung umgedreht,
kassenbuch: weniger spalten
This commit is contained in:
Frederik Jaeckel 2022-09-06 16:10:25 +02:00
parent 98ed1ceb6e
commit d6ea1b31a6
8 changed files with 55 additions and 26 deletions

10
line.py
View file

@ -351,7 +351,11 @@ class Line(Workflow, ModelSQL, ModelView):
def search_rec_name(cls, name, clause): def search_rec_name(cls, name, clause):
""" search in description +... """ search in description +...
""" """
return [('description',) + tuple(clause[1:])] l1 = cls.search_payee(name, clause) + [
('description',) + tuple(clause[1:]),
('category.rec_name',) + tuple(clause[1:]),
]
return l1
def get_rec_name(self, name): def get_rec_name(self, name):
""" short + name """ short + name
@ -505,7 +509,7 @@ class Line(Workflow, ModelSQL, ModelView):
""" to speed up list-view """ to speed up list-view
""" """
if self.description: if self.description:
return self.description[:25] return self.description[:50]
@fields.depends('party', 'booktransf', 'bookingtype') @fields.depends('party', 'booktransf', 'bookingtype')
def on_change_with_payee(self, name=None): def on_change_with_payee(self, name=None):
@ -899,12 +903,14 @@ class LineContext(ModelView):
'readonly': Eval('num_cashbook', 0) < 2, 'readonly': Eval('num_cashbook', 0) < 2,
}, depends=['num_cashbook']) }, depends=['num_cashbook'])
date_from = fields.Date(string='Start Date', depends=['date_to'], date_from = fields.Date(string='Start Date', depends=['date_to'],
help='Limits the date range for the displayed entries.',
domain=[ domain=[
If(Eval('date_to') & Eval('date_from'), If(Eval('date_to') & Eval('date_from'),
('date_from', '<=', Eval('date_to')), ('date_from', '<=', Eval('date_to')),
()), ()),
]) ])
date_to = fields.Date(string='End Date', depends=['date_from'], date_to = fields.Date(string='End Date', depends=['date_from'],
help='Limits the date range for the displayed entries.',
domain=[ domain=[
If(Eval('date_to') & Eval('date_from'), If(Eval('date_to') & Eval('date_from'),
('date_from', '<=', Eval('date_to')), ('date_from', '<=', Eval('date_to')),

View file

@ -970,10 +970,18 @@ msgctxt "field:cashbook.line.context,date_from:"
msgid "Start Date" msgid "Start Date"
msgstr "Beginndatum" msgstr "Beginndatum"
msgctxt "help:cashbook.line.context,date_from:"
msgid "Limits the date range for the displayed entries."
msgstr "Begrenzt den Datumsbereich für die angezeigten Einträge."
msgctxt "field:cashbook.line.context,date_to:" msgctxt "field:cashbook.line.context,date_to:"
msgid "End Date" msgid "End Date"
msgstr "Endedatum" msgstr "Endedatum"
msgctxt "help:cashbook.line.context,date_to:"
msgid "Limits the date range for the displayed entries."
msgstr "Begrenzt den Datumsbereich für die angezeigten Einträge."
########################## ##########################
# cashbook.configuration # # cashbook.configuration #

View file

@ -146,6 +146,10 @@ msgctxt "model:ir.message,text:msg_line_invalid_category"
msgid "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'." msgid "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
msgstr "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'." msgstr "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
msgctxt "model:ir.message,text:msg_line_must_positive"
msgid "The amount must be positive."
msgstr "The amount must be positive."
msgctxt "model:res.group,name:group_cashbook" msgctxt "model:res.group,name:group_cashbook"
msgid "Cashbook" msgid "Cashbook"
msgstr "Cashbook" msgstr "Cashbook"
@ -370,6 +374,10 @@ msgctxt "view:cashbook.book:"
msgid "Owner and Authorizeds" msgid "Owner and Authorizeds"
msgstr "Owner and Authorizeds" msgstr "Owner and Authorizeds"
msgctxt "view:cashbook.book:"
msgid "General Information"
msgstr "General Information"
msgctxt "view:cashbook.book:" msgctxt "view:cashbook.book:"
msgid "Balance" msgid "Balance"
msgstr "Balance" msgstr "Balance"
@ -898,10 +906,18 @@ msgctxt "field:cashbook.line.context,date_from:"
msgid "Start Date" msgid "Start Date"
msgstr "Start Date" msgstr "Start Date"
msgctxt "help:cashbook.line.context,date_from:"
msgid "Limits the date range for the displayed entries."
msgstr "Limits the date range for the displayed entries."
msgctxt "field:cashbook.line.context,date_to:" msgctxt "field:cashbook.line.context,date_to:"
msgid "End Date" msgid "End Date"
msgstr "End Date" msgstr "End Date"
msgctxt "help:cashbook.line.context,date_to:"
msgid "Limits the date range for the displayed entries."
msgstr "Limits the date range for the displayed entries."
msgctxt "model:cashbook.configuration,name:" msgctxt "model:cashbook.configuration,name:"
msgid "Configuration" msgid "Configuration"
msgstr "Configuration" msgstr "Configuration"

View file

@ -96,7 +96,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
@classmethod @classmethod
def __setup__(cls): def __setup__(cls):
super(Reconciliation, cls).__setup__() super(Reconciliation, cls).__setup__()
cls._order.insert(0, ('date_from', 'ASC')) cls._order.insert(0, ('date_from', 'DESC'))
cls._transitions |= set(( cls._transitions |= set((
('edit', 'check'), ('edit', 'check'),
('check', 'done'), ('check', 'done'),

View file

@ -49,14 +49,14 @@ class ReconTestCase(ModuleTestCase):
'date_to': date(2022, 6, 30), 'date_to': date(2022, 6, 30),
}])], }])],
}]) }])
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]') self.assertEqual(book.reconciliations[0].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
self.assertEqual(book.reconciliations[1].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]') self.assertEqual(book.reconciliations[1].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
self.assertRaisesRegex(UserError, self.assertRaisesRegex(UserError,
'The date range overlaps with another reconciliation.', 'The date range overlaps with another reconciliation.',
Reconciliation.write, Reconciliation.write,
*[ *[
[book.reconciliations[1]], [book.reconciliations[0]],
{ {
'date_from': date(2022, 4, 15), 'date_from': date(2022, 4, 15),
'date_to': date(2022, 5, 2), 'date_to': date(2022, 5, 2),
@ -97,14 +97,14 @@ class ReconTestCase(ModuleTestCase):
'date_to': date(2022, 6, 30), 'date_to': date(2022, 6, 30),
}])], }])],
}]) }])
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]') self.assertEqual(book.reconciliations[0].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
self.assertEqual(book.reconciliations[1].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]') self.assertEqual(book.reconciliations[1].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
self.assertRaisesRegex(UserError, self.assertRaisesRegex(UserError,
'The date range overlaps with another reconciliation.', 'The date range overlaps with another reconciliation.',
Reconciliation.write, Reconciliation.write,
*[ *[
[book.reconciliations[1]], [book.reconciliations[0]],
{ {
'date_from': date(2022, 5, 30), 'date_from': date(2022, 5, 30),
}, },
@ -144,14 +144,14 @@ class ReconTestCase(ModuleTestCase):
'date_to': date(2022, 6, 30), 'date_to': date(2022, 6, 30),
}])], }])],
}]) }])
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]') self.assertEqual(book.reconciliations[0].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
self.assertEqual(book.reconciliations[1].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]') self.assertEqual(book.reconciliations[1].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
self.assertRaisesRegex(UserError, self.assertRaisesRegex(UserError,
'The date range overlaps with another reconciliation.', 'The date range overlaps with another reconciliation.',
Reconciliation.write, Reconciliation.write,
*[ *[
[book.reconciliations[1]], [book.reconciliations[0]],
{ {
'date_from': date(2022, 5, 5), 'date_from': date(2022, 5, 5),
'date_to': date(2022, 5, 15), 'date_to': date(2022, 5, 15),
@ -192,8 +192,8 @@ class ReconTestCase(ModuleTestCase):
'date_to': date(2022, 6, 30), 'date_to': date(2022, 6, 30),
}])], }])],
}]) }])
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]') self.assertEqual(book.reconciliations[0].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
self.assertEqual(book.reconciliations[1].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]') self.assertEqual(book.reconciliations[1].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
self.assertRaisesRegex(UserError, self.assertRaisesRegex(UserError,
'The date range overlaps with another reconciliation.', 'The date range overlaps with another reconciliation.',
@ -536,9 +536,11 @@ class ReconTestCase(ModuleTestCase):
self.assertEqual(len(book.reconciliations[0].lines), 1) self.assertEqual(len(book.reconciliations[0].lines), 1)
self.assertEqual(book.reconciliations[0].lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]') self.assertEqual(book.reconciliations[0].lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]') self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
self.assertEqual(book.lines[0].state, 'check')
self.assertEqual(book.lines[1].rec_name, '06/01/2022|Rev|1.00 usd|Text 2 [Cat1]') self.assertEqual(book.lines[1].rec_name, '06/01/2022|Rev|1.00 usd|Text 2 [Cat1]')
self.assertEqual(book.lines[1].state, 'edit')
# move 2nd line into date-range of checked-reconciliation, wf-check # move 1st line into date-range of checked-reconciliation, wf-check
Lines.write(*[ Lines.write(*[
[book.lines[1]], [book.lines[1]],
{ {
@ -570,7 +572,9 @@ class ReconTestCase(ModuleTestCase):
'date_from': date(2022, 5, 31), 'date_from': date(2022, 5, 31),
'date_to': date(2022, 6, 30), 'date_to': date(2022, 6, 30),
}]) }])
Reconciliation.wfdone([book.reconciliations[0]]) self.assertEqual(book.reconciliations[0].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
self.assertEqual(book.reconciliations[1].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 1.00 usd [1]')
Reconciliation.wfdone([book.reconciliations[1]])
Reconciliation.wfcheck([recon2]) Reconciliation.wfcheck([recon2])
Lines.write(*[ Lines.write(*[

View file

@ -9,9 +9,5 @@ full copyright notices and license terms. -->
<field name="balance" sum="Balance"/> <field name="balance" sum="Balance"/>
<field name="currency"/> <field name="currency"/>
<field name="owner"/> <field name="owner"/>
<field name="reviewer"/>
<field name="observer"/>
<field name="state"/> <field name="state"/>
<button name="wfopen"/>
<button name="wfclosed"/>
</tree> </tree>

View file

@ -2,17 +2,17 @@
<!-- This file is part of the cashbook-module from m-ds for Tryton. <!-- 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 The COPYRIGHT file at the top level of this repository contains the
full copyright notices and license terms. --> full copyright notices and license terms. -->
<form col="10"> <form col="6">
<label name="cashbook"/> <label name="cashbook"/>
<field name="cashbook" widget="selection"/> <field name="cashbook" widget="selection" colspan="3"/>
<label name="checked"/>
<field name="checked"/>
<label name="date_from"/> <label name="date_from"/>
<field name="date_from"/> <field name="date_from"/>
<label name="date_to"/> <label name="date_to"/>
<field name="date_to"/> <field name="date_to"/>
<label name="checked"/>
<field name="checked"/>
<label name="done"/> <label name="done"/>
<field name="done"/> <field name="done"/>

View file

@ -12,7 +12,6 @@ full copyright notices and license terms. -->
<field name="credit" sum="Credit"/> <field name="credit" sum="Credit"/>
<field name="debit" sum="Debit"/> <field name="debit" sum="Debit"/>
<field name="balance"/> <field name="balance"/>
<field name="currency"/>
<field name="state"/> <field name="state"/>
<button name="wfedit"/> <button name="wfedit"/>
<button name="wfcheck"/> <button name="wfcheck"/>