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
|
@ -4,7 +4,6 @@
|
|||
# full copyright notices and license terms.
|
||||
|
||||
from trytond.model import ModelView, fields
|
||||
from trytond.pyson import PYSONEncoder
|
||||
from trytond.wizard import Wizard, StateView, StateReport, Button
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval, Bool
|
||||
|
@ -15,17 +14,21 @@ class RunCbReportStart(ModelView):
|
|||
'Cashbook Report'
|
||||
__name__ = 'cashbook.runrepbook.start'
|
||||
|
||||
cashbook = fields.Many2One(string='Cashbook', required=True,
|
||||
cashbook = fields.Many2One(
|
||||
string='Cashbook', required=True,
|
||||
model_name='cashbook.book', depends=['cashbooks'],
|
||||
domain=[('id', 'in', Eval('cashbooks', []))])
|
||||
cashbooks = fields.One2Many(string='Cashbooks', model_name='cashbook.book',
|
||||
cashbooks = fields.One2Many(
|
||||
string='Cashbooks', model_name='cashbook.book',
|
||||
field=None, readonly=True, states={'invisible': True})
|
||||
reconciliation = fields.Many2One(string='Reconciliation', required=True,
|
||||
reconciliation = fields.Many2One(
|
||||
string='Reconciliation', required=True,
|
||||
model_name='cashbook.recon', depends=['reconciliations'],
|
||||
states={
|
||||
'readonly': ~Bool(Eval('reconciliations')),
|
||||
}, domain=[('id', 'in', Eval('reconciliations', []))])
|
||||
reconciliations = fields.Function(fields.One2Many(string='Reconciliations',
|
||||
reconciliations = fields.Function(fields.One2Many(
|
||||
string='Reconciliations',
|
||||
model_name='cashbook.recon', field=None, readonly=True,
|
||||
states={'invisible': True}),
|
||||
'on_change_with_reconciliations')
|
||||
|
@ -38,9 +41,9 @@ class RunCbReportStart(ModelView):
|
|||
self.reconciliations = self.on_change_with_reconciliations()
|
||||
if len(self.reconciliations or []) > 0:
|
||||
self.reconciliation = self.reconciliations[0]
|
||||
else :
|
||||
else:
|
||||
self.reconciliation = None
|
||||
else :
|
||||
else:
|
||||
self.reconciliations = []
|
||||
self.reconciliation = None
|
||||
|
||||
|
@ -64,14 +67,14 @@ class RunCbReport(Wizard):
|
|||
__name__ = 'cashbook.runrepbook'
|
||||
|
||||
start_state = 'selrecon'
|
||||
selrecon = StateView('cashbook.runrepbook.start',
|
||||
selrecon = StateView(
|
||||
'cashbook.runrepbook.start',
|
||||
'cashbook.runrepbook_view_form', [
|
||||
Button(string='Cancel', state='end', icon='tryton-cancel'),
|
||||
Button(string='Report', state='report_', icon='tryton-ok', default=True,
|
||||
states={
|
||||
'readonly': ~Bool(Eval('reconciliation')),
|
||||
}),
|
||||
])
|
||||
Button(
|
||||
string='Report', state='report_', icon='tryton-ok',
|
||||
default=True,
|
||||
states={'readonly': ~Bool(Eval('reconciliation'))})])
|
||||
report_ = StateReport('cashbook.reprecon')
|
||||
|
||||
def default_selrecon(self, fields):
|
||||
|
@ -87,12 +90,11 @@ class RunCbReport(Wizard):
|
|||
result['cashbook'] = context.get('active_id', None)
|
||||
elif context.get('active_model', '') == 'cashbook.line':
|
||||
result['cashbook'] = context.get('cashbook', None)
|
||||
else :
|
||||
else:
|
||||
raise ValueError('invalid model')
|
||||
|
||||
with Transaction().set_context({
|
||||
'_check_access': True,
|
||||
}):
|
||||
'_check_access': True}):
|
||||
books = Book.search([])
|
||||
result['cashbooks'] = [x.id for x in books]
|
||||
|
||||
|
@ -118,7 +120,7 @@ class RunCbReport(Wizard):
|
|||
'id': self.selrecon.reconciliation.id,
|
||||
'ids': [self.selrecon.reconciliation.id],
|
||||
}
|
||||
else :
|
||||
else:
|
||||
r1 = {'model': '', 'id': None, 'ids': []}
|
||||
return action, r1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue