bok, line, type, line-open-wizard, context
This commit is contained in:
parent
a9f3eb12b4
commit
ba442b726e
23 changed files with 974 additions and 8 deletions
62
wizard_openline.py
Normal file
62
wizard_openline.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# 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.
|
||||
|
||||
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
|
||||
|
||||
|
||||
class OpenCashBookStart(ModelView):
|
||||
'Open Cashbook'
|
||||
__name__ = 'cashbook.open_accountlines.start'
|
||||
|
||||
account = fields.Many2One(string='Account', model_name='cashbook.book',
|
||||
required=True)
|
||||
checked = fields.Boolean(string='Checked', help="Show account lines in Checked-state.")
|
||||
done = fields.Boolean(string='Done', help="Show account lines in Done-state")
|
||||
date_from = fields.Date(string='Start Date')
|
||||
date_to = fields.Date(string='End Date')
|
||||
|
||||
@classmethod
|
||||
def default_checked(cls):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def default_done(cls):
|
||||
return False
|
||||
|
||||
# end OpenCashBookStart
|
||||
|
||||
|
||||
class OpenCashBook(Wizard):
|
||||
'Open Cashbook'
|
||||
__name__ = 'cashbook.open_accountlines'
|
||||
|
||||
start = StateView('cashbook.open_accountlines.start',
|
||||
'cashbook.open_accountlines_view_form', [
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Open', 'open_', 'tryton-ok', default=True),
|
||||
])
|
||||
open_ = StateAction('cashbook.act_line_view')
|
||||
|
||||
def do_open_(self, action):
|
||||
action['pyson_context'] = PYSONEncoder().encode({
|
||||
'account': self.start.account.id,
|
||||
'date_from': self.start.date_from,
|
||||
'date_to': self.start.date_to,
|
||||
'checked': self.start.checked,
|
||||
'done': self.start.done,
|
||||
})
|
||||
action['name'] = '%(name)s: %(account)s' % {
|
||||
'name': gettext('cashbook.msg_name_cashbook'),
|
||||
'account': self.start.account.rec_name,
|
||||
}
|
||||
return action, {}
|
||||
|
||||
def transition_open_(self):
|
||||
return 'end'
|
||||
|
||||
# end OpenCashBook
|
Loading…
Add table
Add a link
Reference in a new issue