formatting, line: test for delete of party
This commit is contained in:
parent
78f160bf0b
commit
619a17bcd6
16 changed files with 701 additions and 516 deletions
|
@ -7,7 +7,7 @@ from trytond.model import ModelView, fields
|
|||
from trytond.wizard import Wizard, StateView, StateTransition, Button
|
||||
from trytond.pool import Pool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pyson import Eval, Bool, If, And
|
||||
from trytond.pyson import Eval, Bool, If
|
||||
from decimal import Decimal
|
||||
from .line import sel_bookingtype
|
||||
|
||||
|
@ -18,29 +18,36 @@ class EnterBookingStart(ModelView):
|
|||
'Enter Booking'
|
||||
__name__ = 'cashbook.enterbooking.start'
|
||||
|
||||
cashbook = fields.Many2One(string='Cashbook', model_name='cashbook.book',
|
||||
cashbook = fields.Many2One(
|
||||
string='Cashbook', model_name='cashbook.book',
|
||||
domain=[('id', 'in', Eval('cashbooks', [])), ('btype', '!=', None)],
|
||||
depends=['cashbooks'], required=True)
|
||||
cashbooks = fields.One2Many(string='Cashbooks', field=None,
|
||||
cashbooks = fields.One2Many(
|
||||
string='Cashbooks', field=None,
|
||||
model_name='cashbook.book', readonly=True,
|
||||
states={'invisible': True})
|
||||
owner_cashbook = fields.Function(fields.Many2One(string='Owner', readonly=True,
|
||||
owner_cashbook = fields.Function(fields.Many2One(
|
||||
string='Owner', readonly=True,
|
||||
states={'invisible': True}, model_name='res.user'),
|
||||
'on_change_with_owner_cashbook')
|
||||
currency = fields.Function(fields.Many2One(string='Currency',
|
||||
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',
|
||||
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_booktypewiz)
|
||||
amount = fields.Numeric(string='Amount',
|
||||
bookingtype = fields.Selection(
|
||||
string='Type', required=True, selection=sel_booktypewiz)
|
||||
amount = fields.Numeric(
|
||||
string='Amount',
|
||||
depends=['currency_digits', 'bookingtype'],
|
||||
digits=(16, Eval('currency_digits', 2)), required=True,
|
||||
domain=[('amount', '>=', Decimal('0.0'))])
|
||||
description = fields.Text(string='Description')
|
||||
category = fields.Many2One(string='Category',
|
||||
category = fields.Many2One(
|
||||
string='Category',
|
||||
model_name='cashbook.category', depends=['bookingtype'],
|
||||
states={
|
||||
'readonly': Bool(Eval('bookingtype')) == False,
|
||||
|
@ -55,7 +62,8 @@ class EnterBookingStart(ModelView):
|
|||
)])
|
||||
|
||||
# party or cashbook as counterpart
|
||||
booktransf = fields.Many2One(string='Source/Dest',
|
||||
booktransf = fields.Many2One(
|
||||
string='Source/Dest',
|
||||
model_name='cashbook.book',
|
||||
domain=[
|
||||
('owner.id', '=', Eval('owner_cashbook', -1)),
|
||||
|
@ -65,7 +73,8 @@ class EnterBookingStart(ModelView):
|
|||
'invisible': ~Eval('bookingtype', '').in_(['mvin', 'mvout']),
|
||||
'required': Eval('bookingtype', '').in_(['mvin', 'mvout']),
|
||||
}, depends=['bookingtype', 'owner_cashbook', 'cashbook'])
|
||||
party = fields.Many2One(string='Party', model_name='party.party',
|
||||
party = fields.Many2One(
|
||||
string='Party', model_name='party.party',
|
||||
states={
|
||||
'invisible': ~Eval('bookingtype', '').in_(['in', 'out']),
|
||||
}, depends=['bookingtype'])
|
||||
|
@ -81,7 +90,7 @@ class EnterBookingStart(ModelView):
|
|||
|
||||
if self.bookingtype:
|
||||
if self.category:
|
||||
if not self.bookingtype in types.get(self.category.cattype, ''):
|
||||
if self.bookingtype not in types.get(self.category.cattype, ''):
|
||||
self.category = None
|
||||
|
||||
@fields.depends('cashbook', '_parent_cashbook.owner')
|
||||
|
@ -104,7 +113,7 @@ class EnterBookingStart(ModelView):
|
|||
"""
|
||||
if self.cashbook:
|
||||
return self.cashbook.currency.digits
|
||||
else :
|
||||
else:
|
||||
return 2
|
||||
|
||||
# end EnterBookingStart
|
||||
|
@ -115,7 +124,8 @@ class EnterBookingWizard(Wizard):
|
|||
__name__ = 'cashbook.enterbooking'
|
||||
|
||||
start_state = 'start'
|
||||
start = StateView('cashbook.enterbooking.start',
|
||||
start = StateView(
|
||||
'cashbook.enterbooking.start',
|
||||
'cashbook.enterbooking_start_form', [
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Save', 'save_', 'tryton-save', default=True),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue