diff --git a/__init__.py b/__init__.py index 6115d74..f7075c0 100644 --- a/__init__.py +++ b/__init__.py @@ -8,7 +8,7 @@ from .book import Book from .types import Type from .line import Line, LineContext 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_booking import EnterBookingWizard, EnterBookingStart from .configuration import Configuration, UserConfiguration @@ -36,6 +36,7 @@ def register(): module='cashbook', type_='report') Pool.register( OpenCashBook, + OpenCashBookTree, RunCbReport, EnterBookingWizard, module='cashbook', type_='wizard') diff --git a/locale/de.po b/locale/de.po index ae53653..4d5c973 100644 --- a/locale/de.po +++ b/locale/de.po @@ -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." 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 # @@ -306,6 +310,10 @@ msgctxt "model:ir.action,name:act_open_lines" msgid "Open Cashbook" 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" msgid "Cashbook" msgstr "Kassenbuch" @@ -1082,6 +1090,10 @@ msgctxt "model:cashbook.open_lines,name:" msgid "Open Cashbook" msgstr "Kassenbuch öffnen" +msgctxt "model:cashbook.open_lines_tree,name:" +msgid "Open Cashbook" +msgstr "Kassenbuch öffnen" + msgctxt "wizard_button:cashbook.open_lines,askuser,end:" msgid "Cancel" msgstr "Abbruch" diff --git a/locale/en.po b/locale/en.po index aa8ea3d..b97e385 100644 --- a/locale/en.po +++ b/locale/en.po @@ -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." 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" msgid "Cashbook" msgstr "Cashbook" @@ -286,6 +290,10 @@ msgctxt "model:ir.action,name:act_open_lines" msgid "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" msgid "Cashbook" msgstr "Cashbook" @@ -478,6 +486,18 @@ msgctxt "field:cashbook.book,balance:" msgid "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:" msgid "Reconciliations" msgstr "Reconciliations" @@ -1010,6 +1030,10 @@ msgctxt "model:cashbook.open_lines,name:" msgid "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:" msgid "Cancel" msgstr "Cancel" diff --git a/message.xml b/message.xml index 14bc840..423b0c7 100644 --- a/message.xml +++ b/message.xml @@ -113,6 +113,9 @@ full copyright notices and license terms. --> The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines. + + The cash book '%(bookname)s' has no type and therefore cannot be opened. + diff --git a/wizard_openline.py b/wizard_openline.py index 2c76ea0..4aac5be 100644 --- a/wizard_openline.py +++ b/wizard_openline.py @@ -8,6 +8,7 @@ from trytond.pyson import PYSONEncoder from trytond.wizard import Wizard, StateView, StateTransition, StateAction, Button from trytond.i18n import gettext from trytond.pool import Pool +from trytond.exceptions import UserError from trytond.transaction import Transaction @@ -123,3 +124,53 @@ class OpenCashBook(Wizard): return 'end' # 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 diff --git a/wizard_openline.xml b/wizard_openline.xml index 02678f6..05edf31 100644 --- a/wizard_openline.xml +++ b/wizard_openline.xml @@ -17,5 +17,18 @@ full copyright notices and license terms. --> cashbook.open_lines + + + Open Cashbook + cashbook.open_lines_tree + cashbook.book + + + + form_action + cashbook.book,-1 + + +