wizard: buchungseingabe begonnen
This commit is contained in:
parent
d6ea1b31a6
commit
326d87f758
7 changed files with 251 additions and 2 deletions
|
@ -10,6 +10,7 @@ from .line import Line, LineContext
|
|||
from .splitline import SplitLine
|
||||
from .wizard_openline import OpenCashBook, OpenCashBookStart
|
||||
from .wizard_runreport import RunCbReport, RunCbReportStart
|
||||
from .wizard_booking import EnterBookingWizard, EnterBookingStart
|
||||
from .configuration import Configuration, UserConfiguration
|
||||
from .category import Category
|
||||
from .reconciliation import Reconciliation
|
||||
|
@ -28,6 +29,7 @@ def register():
|
|||
Reconciliation,
|
||||
OpenCashBookStart,
|
||||
RunCbReportStart,
|
||||
EnterBookingStart,
|
||||
module='cashbook', type_='model')
|
||||
Pool.register(
|
||||
ReconciliationReport,
|
||||
|
@ -35,4 +37,5 @@ def register():
|
|||
Pool.register(
|
||||
OpenCashBook,
|
||||
RunCbReport,
|
||||
EnterBookingWizard,
|
||||
module='cashbook', type_='wizard')
|
||||
|
|
85
locale/de.po
85
locale/de.po
|
@ -278,6 +278,10 @@ msgctxt "model:ir.ui.menu,name:act_category_view"
|
|||
msgid "Category"
|
||||
msgstr "Kategorie"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_enter_booking"
|
||||
msgid "Enter Booking"
|
||||
msgstr "Buchung eingeben"
|
||||
|
||||
|
||||
#############
|
||||
# ir.action #
|
||||
|
@ -306,6 +310,10 @@ msgctxt "model:ir.action,name:act_wizard_report"
|
|||
msgid "Cashbook Report"
|
||||
msgstr "Kassenbuch Bericht"
|
||||
|
||||
msgctxt "model:ir.action,name:act_enterbooking_wiz"
|
||||
msgid "Enter Booking"
|
||||
msgstr "Buchung eingeben"
|
||||
|
||||
|
||||
###############################
|
||||
# ir.action.act_window.domain #
|
||||
|
@ -1253,3 +1261,80 @@ msgstr "Gesamt"
|
|||
msgctxt "report:cashbook.reprecon:"
|
||||
msgid "Payee"
|
||||
msgstr "Empfänger"
|
||||
|
||||
|
||||
###############################
|
||||
# cashbook.enterbooking.start #
|
||||
###############################
|
||||
msgctxt "model:cashbook.enterbooking.start,name:"
|
||||
msgid "Enter Booking"
|
||||
msgstr "Buchung eingeben"
|
||||
|
||||
msgctxt "field:cashbook.enterbooking.start,cashbook:"
|
||||
msgid "Cashbook"
|
||||
msgstr "Kassenbuch"
|
||||
|
||||
msgctxt "field:cashbook.enterbooking.start,cashbooks:"
|
||||
msgid "Cashbooks"
|
||||
msgstr "Kassenbücher"
|
||||
|
||||
msgctxt "field:cashbook.enterbooking.start,balance:"
|
||||
msgid "Balance"
|
||||
msgstr "Saldo"
|
||||
|
||||
msgctxt "field:cashbook.enterbooking.start,currency_digits:"
|
||||
msgid "Currency Digits"
|
||||
msgstr "Nachkommastellen Währung"
|
||||
|
||||
msgctxt "field:cashbook.enterbooking.start,currency:"
|
||||
msgid "Currency"
|
||||
msgstr "Währung"
|
||||
|
||||
msgctxt "field:cashbook.enterbooking.start,bookingtype:"
|
||||
msgid "Type"
|
||||
msgstr "Typ"
|
||||
|
||||
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||
msgid "Revenue"
|
||||
msgstr "Einnahme"
|
||||
|
||||
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||
msgid "Revenue Splitbooking"
|
||||
msgstr "Einnahme Splitbuchung"
|
||||
|
||||
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||
msgid "Expense"
|
||||
msgstr "Ausgabe"
|
||||
|
||||
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||
msgid "Expense Splitbooking"
|
||||
msgstr "Ausgabe Splitbuchung"
|
||||
|
||||
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||
msgid "Transfer from"
|
||||
msgstr "Umbuchung von"
|
||||
|
||||
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||
msgid "Transfer to"
|
||||
msgstr "Umbuchung nach"
|
||||
|
||||
msgctxt "field:cashbook.enterbooking.start,amount:"
|
||||
msgid "Amount"
|
||||
msgstr "Betrag"
|
||||
|
||||
|
||||
|
||||
#########################
|
||||
# cashbook.enterbooking #
|
||||
#########################
|
||||
msgctxt "model:cashbook.enterbooking,name:"
|
||||
msgid "Enter Booking"
|
||||
msgstr "Buchung eingeben"
|
||||
|
||||
msgctxt "wizard_button:cashbook.enterbooking,start,end:"
|
||||
msgid "Cancel"
|
||||
msgstr "Abbruch"
|
||||
|
||||
msgctxt "wizard_button:cashbook.enterbooking,start,save_:"
|
||||
msgid "Save"
|
||||
msgstr "Speichern"
|
||||
|
|
17
menu.xml
17
menu.xml
|
@ -56,10 +56,23 @@ full copyright notices and license terms. -->
|
|||
<field name="group" ref="group_cashbook_admin"/>
|
||||
</record>
|
||||
|
||||
<!-- menu: /Cashbook/Enter Booking -->
|
||||
<menuitem id="menu_enter_booking" action="act_enterbooking_wiz"
|
||||
icon="tryton-add"
|
||||
parent="menu_cashbook" sequence="20"/>
|
||||
<record model="ir.ui.menu-res.group" id="menu_enter_booking-group_cashbook">
|
||||
<field name="menu" ref="menu_enter_booking"/>
|
||||
<field name="group" ref="group_cashbook"/>
|
||||
</record>
|
||||
<record model="ir.ui.menu-res.group" id="menu_enter_booking-group_cashbook_admin">
|
||||
<field name="menu" ref="menu_enter_booking"/>
|
||||
<field name="group" ref="group_cashbook_admin"/>
|
||||
</record>
|
||||
|
||||
<!-- menu: /Cashbook/Open Cashbook -->
|
||||
<menuitem id="menu_open_lines" action="act_open_lines"
|
||||
icon="tryton-list"
|
||||
parent="menu_cashbook" sequence="20"/>
|
||||
parent="menu_cashbook" sequence="30"/>
|
||||
<record model="ir.ui.menu-res.group" id="menu_open_lines-group_cashbook">
|
||||
<field name="menu" ref="menu_open_lines"/>
|
||||
<field name="group" ref="group_cashbook"/>
|
||||
|
@ -72,7 +85,7 @@ full copyright notices and license terms. -->
|
|||
<!-- menu: /Cashbook/Cashbook -->
|
||||
<menuitem id="menu_booklist" action="act_book_view"
|
||||
icon="tryton-list"
|
||||
parent="menu_cashbook" sequence="30"/>
|
||||
parent="menu_cashbook" sequence="40"/>
|
||||
<record model="ir.ui.menu-res.group" id="menu_booklist-group_cashbook">
|
||||
<field name="menu" ref="menu_booklist"/>
|
||||
<field name="group" ref="group_cashbook"/>
|
||||
|
|
|
@ -19,4 +19,5 @@ xml:
|
|||
splitline.xml
|
||||
wizard_openline.xml
|
||||
wizard_runreport.xml
|
||||
wizard_booking.xml
|
||||
menu.xml
|
||||
|
|
20
view/enterbooking_start_form.xml
Normal file
20
view/enterbooking_start_form.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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. -->
|
||||
<form col="2">
|
||||
<label name="cashbook"/>
|
||||
<field name="cashbook" widget="selection"/>
|
||||
<label name="balance"/>
|
||||
<field name="balance" symbol="currency"/>
|
||||
|
||||
<label name="bookingtype"/>
|
||||
<field name="bookingtype"/>
|
||||
<label name="amount"/>
|
||||
<field name="amount"/>
|
||||
|
||||
<field name="cashbooks"/>
|
||||
<field name="currency_digits"/>
|
||||
<field name="currency"/>
|
||||
</form>
|
||||
|
106
wizard_booking.py
Normal file
106
wizard_booking.py
Normal file
|
@ -0,0 +1,106 @@
|
|||
# -*- 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, fields
|
||||
from trytond.wizard import Wizard, StateView, StateTransition, Button
|
||||
from trytond.i18n import gettext
|
||||
from trytond.pool import Pool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pyson import Eval
|
||||
from decimal import Decimal
|
||||
from .line import sel_bookingtype
|
||||
|
||||
|
||||
class EnterBookingStart(ModelView):
|
||||
'Enter Booking'
|
||||
__name__ = 'cashbook.enterbooking.start'
|
||||
|
||||
cashbook = fields.Many2One(string='Cashbook', model_name='cashbook.book',
|
||||
domain=[('id', 'in', Eval('cashbooks', []))],
|
||||
depends=['cashbooks'], required=True)
|
||||
cashbooks = fields.One2Many(string='Cashbooks', field=None,
|
||||
model_name='cashbook.book', readonly=True,
|
||||
states={'invisible': True})
|
||||
balance = fields.Numeric(string='Balance', readonly=True,
|
||||
digits=(16, Eval('currency_digits', 2)),
|
||||
depends=['currency_digits'])
|
||||
currency = fields.Function(fields.Many2One(string='Currency',
|
||||
model_name='currency.currency', states={'invisible': True}),
|
||||
'on_change_with_currency')
|
||||
currency_digits = fields.Function(fields.Integer(string='Currency Digits',
|
||||
readonly=True, states={'invisible': True}),
|
||||
'on_change_with_currency_digits')
|
||||
bookingtype = fields.Selection(string='Type', required=True,
|
||||
selection=sel_bookingtype)
|
||||
amount = fields.Numeric(string='Amount',
|
||||
depends=['currency_digits', 'bookingtype'],
|
||||
digits=(16, Eval('currency_digits', 2)),
|
||||
domain=[('amount', '>=', Decimal('0.0'))],
|
||||
states={
|
||||
'readonly': Eval('bookingtype', '').in_(['spin', 'spout']),
|
||||
'required': Eval('bookingtype', '').in_(['in', 'out', 'mvin', 'mvout']),
|
||||
})
|
||||
|
||||
@fields.depends('cashbook', 'balance')
|
||||
def on_change_cashbook(self):
|
||||
""" get balance of selected cashbook
|
||||
"""
|
||||
if self.cashbook:
|
||||
self.balance = self.cashbook.balance
|
||||
else :
|
||||
self.balance = None
|
||||
|
||||
@fields.depends('cashbook', '_parent_cashbook.currency')
|
||||
def on_change_with_currency(self, name=None):
|
||||
""" digits
|
||||
"""
|
||||
if self.cashbook:
|
||||
return self.cashbook.currency.id
|
||||
|
||||
@fields.depends('cashbook', '_parent_cashbook.currency')
|
||||
def on_change_with_currency_digits(self, name=None):
|
||||
""" digits
|
||||
"""
|
||||
if self.cashbook:
|
||||
return self.cashbook.currency.digits
|
||||
else :
|
||||
return 2
|
||||
|
||||
# end EnterBookingStart
|
||||
|
||||
|
||||
class EnterBookingWizard(Wizard):
|
||||
'Enter Booking'
|
||||
__name__ = 'cashbook.enterbooking'
|
||||
|
||||
start_state = 'start'
|
||||
start = StateView('cashbook.enterbooking.start',
|
||||
'cashbook.enterbooking_start_form', [
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Save', 'save_', 'tryton-add', default=True),
|
||||
])
|
||||
save_ = StateTransition()
|
||||
|
||||
def default_start(self, fields):
|
||||
""" setup form
|
||||
"""
|
||||
pool = Pool()
|
||||
Cashbook = pool.get('cashbook.book')
|
||||
|
||||
result = {
|
||||
'cashbooks': [x.id for x in Cashbook.search([
|
||||
('state', '=', 'open'),
|
||||
('owner.id', '=', Transaction().user),
|
||||
])],
|
||||
'bookingtype': 'out',
|
||||
}
|
||||
return result
|
||||
|
||||
def transition_save(self):
|
||||
""" store booking
|
||||
"""
|
||||
return 'end'
|
||||
|
||||
# end EnterBookingWizard
|
21
wizard_booking.xml
Normal file
21
wizard_booking.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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. -->
|
||||
<tryton>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="enterbooking_start_form">
|
||||
<field name="model">cashbook.enterbooking.start</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">enterbooking_start_form</field>
|
||||
</record>
|
||||
|
||||
<!-- enter booking -->
|
||||
<record model="ir.action.wizard" id="act_enterbooking_wiz">
|
||||
<field name="name">Enter Booking</field>
|
||||
<field name="wiz_name">cashbook.enterbooking</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
Loading…
Reference in a new issue