Fix indents
This commit is contained in:
parent
bb6ca59cd1
commit
95ba4ef9d3
44
contract.py
44
contract.py
|
@ -1,16 +1,14 @@
|
|||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
#from datetime import datetime
|
||||
from trytond.model import ModelView, Workflow, ModelSQL, fields
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pool import Pool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond import backend
|
||||
from sql import Table, Null
|
||||
from sql import Null
|
||||
|
||||
__all__ = ['StaffContract']
|
||||
|
||||
STATES = {'readonly': (Eval('state') != 'draft'),}
|
||||
STATES = {'readonly': (Eval('state') != 'draft')}
|
||||
|
||||
|
||||
class StaffContract(Workflow, ModelSQL, ModelView):
|
||||
|
@ -39,10 +37,10 @@ class StaffContract(Workflow, ModelSQL, ModelView):
|
|||
], 'Kind', select=True, states=STATES)
|
||||
kind_string = kind.translated('kind')
|
||||
state = fields.Selection([
|
||||
('draft', 'Draft'),
|
||||
('active', 'Active'),
|
||||
('finished', 'Finished'),
|
||||
], 'State', readonly=True, select=True)
|
||||
('draft', 'Draft'),
|
||||
('active', 'Active'),
|
||||
('finished', 'Finished'),
|
||||
], 'State', readonly=True, select=True)
|
||||
payment_term = fields.Char('Payment Term', states=STATES)
|
||||
comment = fields.Text("Comment", states=STATES)
|
||||
position = fields.Many2One('staff.position', 'Position',
|
||||
|
@ -53,21 +51,21 @@ class StaffContract(Workflow, ModelSQL, ModelView):
|
|||
super(StaffContract, cls).__setup__()
|
||||
cls._order.insert(0, ('number', 'DESC'))
|
||||
cls._transitions |= set((
|
||||
('draft', 'active'),
|
||||
('active', 'draft'),
|
||||
('active', 'finished'),
|
||||
))
|
||||
('draft', 'active'),
|
||||
('active', 'draft'),
|
||||
('active', 'finished'),
|
||||
))
|
||||
cls._buttons.update({
|
||||
'draft': {
|
||||
'invisible': Eval('state') != 'active',
|
||||
},
|
||||
'active': {
|
||||
'invisible': Eval('state') != 'draft',
|
||||
},
|
||||
'finished': {
|
||||
'invisible': Eval('state') != 'active',
|
||||
},
|
||||
})
|
||||
'draft': {
|
||||
'invisible': Eval('state') != 'active',
|
||||
},
|
||||
'active': {
|
||||
'invisible': Eval('state') != 'draft',
|
||||
},
|
||||
'finished': {
|
||||
'invisible': Eval('state') != 'active',
|
||||
},
|
||||
})
|
||||
cls._error_messages.update({
|
||||
'employee_with_contract_current': ('The employee %s already has a contract in draft or active!'),
|
||||
'missing_contract_sequence': ('The contract sequence is missing on configuration!'),
|
||||
|
@ -120,7 +118,7 @@ class StaffContract(Workflow, ModelSQL, ModelView):
|
|||
return [bool_op,
|
||||
('number',) + tuple(clause[1:]),
|
||||
('employee',) + tuple(clause[1:]),
|
||||
]
|
||||
]
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
|
|
Loading…
Reference in New Issue