book/line: berechtigungen für owner, beobachter, bearbeiter + tests

This commit is contained in:
Frederik Jaeckel 2022-08-08 17:31:16 +02:00
parent 654e9d2ee7
commit b9bb433c39
9 changed files with 584 additions and 3 deletions

View file

@ -7,6 +7,7 @@ from trytond.model import ModelView, ModelSQL, fields
from trytond.pyson import PYSONEncoder
from trytond.wizard import Wizard, StateView, StateAction, Button
from trytond.i18n import gettext
from trytond.pool import Pool
class OpenCashBookStart(ModelView):
@ -42,6 +43,20 @@ class OpenCashBook(Wizard):
])
open_ = StateAction('cashbook.act_line_view')
def default_start(self, fields):
""" setup form
"""
Book = Pool().get('cashbook.book')
result = {}
books = Book.search([])
print('\n## books:', books)
if len(books) == 1:
result['cashbook'] = books[0].id
return result
def do_open_(self, action):
action['pyson_context'] = PYSONEncoder().encode({
'cashbook': self.start.cashbook.id,