book: öffnet inhalt per aktionsknopf

This commit is contained in:
Frederik Jaeckel 2022-10-06 13:28:42 +02:00
parent 3073ce6f8d
commit 8910f26c99
6 changed files with 105 additions and 1 deletions

View file

@ -8,7 +8,7 @@ from .book import Book
from .types import Type from .types import Type
from .line import Line, LineContext from .line import Line, LineContext
from .splitline import SplitLine from .splitline import SplitLine
from .wizard_openline import OpenCashBook, OpenCashBookStart from .wizard_openline import OpenCashBook, OpenCashBookStart, OpenCashBookTree
from .wizard_runreport import RunCbReport, RunCbReportStart from .wizard_runreport import RunCbReport, RunCbReportStart
from .wizard_booking import EnterBookingWizard, EnterBookingStart from .wizard_booking import EnterBookingWizard, EnterBookingStart
from .configuration import Configuration, UserConfiguration from .configuration import Configuration, UserConfiguration
@ -36,6 +36,7 @@ def register():
module='cashbook', type_='report') module='cashbook', type_='report')
Pool.register( Pool.register(
OpenCashBook, OpenCashBook,
OpenCashBookTree,
RunCbReport, RunCbReport,
EnterBookingWizard, EnterBookingWizard,
module='cashbook', type_='wizard') module='cashbook', type_='wizard')

View file

@ -150,6 +150,10 @@ msgctxt "model:ir.message,text:msg_book_btype_with_lines"
msgid "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines." msgid "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines."
msgstr "Der Typ kann am Kassenbuch '%(cbname)s' nicht gelöscht werden, da es noch %(numlines)s Zeilen enthält." msgstr "Der Typ kann am Kassenbuch '%(cbname)s' nicht gelöscht werden, da es noch %(numlines)s Zeilen enthält."
msgctxt "model:ir.message,text:msg_book_no_type_noopen"
msgid "The cash book '%(bookname)s' has no type and therefore cannot be opened."
msgstr "Das Kassenbuch '%(bookname)s' hat keinen Typ und kann daher nicht geöffnet werden."
############# #############
# res.group # # res.group #
@ -306,6 +310,10 @@ msgctxt "model:ir.action,name:act_open_lines"
msgid "Open Cashbook" msgid "Open Cashbook"
msgstr "Kassenbuch öffnen" msgstr "Kassenbuch öffnen"
msgctxt "model:ir.action,name:act_open_tree_lines"
msgid "Open Cashbook"
msgstr "Kassenbuch öffnen"
msgctxt "model:ir.action,name:report_cashbook" msgctxt "model:ir.action,name:report_cashbook"
msgid "Cashbook" msgid "Cashbook"
msgstr "Kassenbuch" msgstr "Kassenbuch"
@ -1082,6 +1090,10 @@ msgctxt "model:cashbook.open_lines,name:"
msgid "Open Cashbook" msgid "Open Cashbook"
msgstr "Kassenbuch öffnen" msgstr "Kassenbuch öffnen"
msgctxt "model:cashbook.open_lines_tree,name:"
msgid "Open Cashbook"
msgstr "Kassenbuch öffnen"
msgctxt "wizard_button:cashbook.open_lines,askuser,end:" msgctxt "wizard_button:cashbook.open_lines,askuser,end:"
msgid "Cancel" msgid "Cancel"
msgstr "Abbruch" msgstr "Abbruch"

View file

@ -146,6 +146,10 @@ msgctxt "model:ir.message,text:msg_book_btype_with_lines"
msgid "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines." msgid "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines."
msgstr "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines." msgstr "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines."
msgctxt "model:ir.message,text:msg_book_no_type_noopen"
msgid "The cash book '%(bookname)s' has no type and therefore cannot be opened."
msgstr "The cash book '%(bookname)s' has no type and therefore cannot be opened."
msgctxt "model:res.group,name:group_cashbook" msgctxt "model:res.group,name:group_cashbook"
msgid "Cashbook" msgid "Cashbook"
msgstr "Cashbook" msgstr "Cashbook"
@ -286,6 +290,10 @@ msgctxt "model:ir.action,name:act_open_lines"
msgid "Open Cashbook" msgid "Open Cashbook"
msgstr "Open Cashbook" msgstr "Open Cashbook"
msgctxt "model:ir.action,name:act_open_tree_lines"
msgid "Open Cashbook"
msgstr "Open Cashbook"
msgctxt "model:ir.action,name:report_cashbook" msgctxt "model:ir.action,name:report_cashbook"
msgid "Cashbook" msgid "Cashbook"
msgstr "Cashbook" msgstr "Cashbook"
@ -478,6 +486,18 @@ msgctxt "field:cashbook.book,balance:"
msgid "Balance" msgid "Balance"
msgstr "Balance" msgstr "Balance"
msgctxt "help:cashbook.book,balance:"
msgid "Balance of bookings to date"
msgstr "Balance of bookings to date"
msgctxt "field:cashbook.book,balance_all:"
msgid "Total balance"
msgstr "Total balance"
msgctxt "help:cashbook.book,balance_all:"
msgid "Balance of all bookings"
msgstr "Balance of all bookings"
msgctxt "field:cashbook.book,reconciliations:" msgctxt "field:cashbook.book,reconciliations:"
msgid "Reconciliations" msgid "Reconciliations"
msgstr "Reconciliations" msgstr "Reconciliations"
@ -1010,6 +1030,10 @@ msgctxt "model:cashbook.open_lines,name:"
msgid "Open Cashbook" msgid "Open Cashbook"
msgstr "Open Cashbook" msgstr "Open Cashbook"
msgctxt "model:cashbook.open_lines_tree,name:"
msgid "Open Cashbook"
msgstr "Open Cashbook"
msgctxt "wizard_button:cashbook.open_lines,askuser,end:" msgctxt "wizard_button:cashbook.open_lines,askuser,end:"
msgid "Cancel" msgid "Cancel"
msgstr "Cancel" msgstr "Cancel"

View file

@ -113,6 +113,9 @@ full copyright notices and license terms. -->
<record model="ir.message" id="msg_book_btype_with_lines"> <record model="ir.message" id="msg_book_btype_with_lines">
<field name="text">The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines.</field> <field name="text">The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines.</field>
</record> </record>
<record model="ir.message" id="msg_book_no_type_noopen">
<field name="text">The cash book '%(bookname)s' has no type and therefore cannot be opened.</field>
</record>
</data> </data>
</tryton> </tryton>

View file

@ -8,6 +8,7 @@ from trytond.pyson import PYSONEncoder
from trytond.wizard import Wizard, StateView, StateTransition, StateAction, Button from trytond.wizard import Wizard, StateView, StateTransition, StateAction, Button
from trytond.i18n import gettext from trytond.i18n import gettext
from trytond.pool import Pool from trytond.pool import Pool
from trytond.exceptions import UserError
from trytond.transaction import Transaction from trytond.transaction import Transaction
@ -123,3 +124,53 @@ class OpenCashBook(Wizard):
return 'end' return 'end'
# end OpenCashBook # end OpenCashBook
class OpenCashBookTree(Wizard):
'Open Cashbook2'
__name__ = 'cashbook.open_lines_tree'
start_state = 'open_'
open_ = StateAction('cashbook.act_line_view')
def do_open_(self, action):
""" open view from doubleclick
"""
pool = Pool()
Book = pool.get('cashbook.book')
Configuration = pool.get('cashbook.configuration')
cfg1 = Configuration.get_singleton()
if cfg1 is None:
cfg1 = Configuration()
cfg1.save()
book = self.record
if book is None:
with Transaction().set_context({
'_check_access': True,
}):
books = Book.search([('btype', '!=', None)])
if len(books) > 0:
book = books[0]
else :
if book.btype is None:
raise UserError(gettext(
'cashbook.msg_book_no_type_noopen',
bookname = book.rec_name,
))
action['pyson_context'] = PYSONEncoder().encode({
'cashbook': getattr(book, 'id', None),
'date_from': cfg1.date_from,
'date_to': cfg1.date_to,
'checked': cfg1.checked,
'done': cfg1.done,
})
action['name'] = '%(name)s: %(cashbook)s' % {
'name': gettext('cashbook.msg_name_cashbook'),
'cashbook': getattr(book, 'rec_name', '-/-'),
}
return action, {}
# end OpenCashBookTree

View file

@ -17,5 +17,18 @@ full copyright notices and license terms. -->
<field name="wiz_name">cashbook.open_lines</field> <field name="wiz_name">cashbook.open_lines</field>
</record> </record>
<!-- open line view by double click at cashbook -->
<record model="ir.action.wizard" id="act_open_tree_lines">
<field name="name">Open Cashbook</field>
<field name="wiz_name">cashbook.open_lines_tree</field>
<field name="model">cashbook.book</field>
</record>
<record model="ir.action.keyword" id="act_open_tree_lines_keyword2">
<field name="keyword">form_action</field>
<field name="model">cashbook.book,-1</field>
<field name="action" ref="act_open_tree_lines"/>
</record>
</data> </data>
</tryton> </tryton>