Fix
This commit is contained in:
parent
9daf4c7cf6
commit
f3ce9bca08
17
employee.py
17
employee.py
|
@ -7,8 +7,7 @@ from trytond.transaction import Transaction
|
|||
__all__ = ['Employee']
|
||||
|
||||
|
||||
class Employee:
|
||||
__metaclass__ = PoolMeta
|
||||
class Employee(metaclass=PoolMeta):
|
||||
__name__ = 'company.employee'
|
||||
active = fields.Boolean('Active')
|
||||
code = fields.Char('Code', size=None, select=True)
|
||||
|
@ -32,9 +31,9 @@ class Employee:
|
|||
def __setup__(cls):
|
||||
super(Employee, cls).__setup__()
|
||||
table = cls.__table__()
|
||||
cls._sql_constraints += [
|
||||
('party_uniq', Unique(table, table.party), 'Employee already exists!'),
|
||||
]
|
||||
cls._sql_constraints += [(
|
||||
'party_uniq', Unique(table, table.party), 'Employee already exists!'
|
||||
)]
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
|
@ -42,14 +41,12 @@ class Employee:
|
|||
cursor = Transaction().connection.cursor()
|
||||
sql_table = cls.__table__()
|
||||
|
||||
# Migration:
|
||||
# - Rename in_process to aspirant into contracting_state
|
||||
|
||||
# Migration: Rename in_process to aspirant into contracting_state
|
||||
cursor.execute(*sql_table.update(
|
||||
columns=[sql_table.contracting_state],
|
||||
values=['aspirant'],
|
||||
where=(sql_table.contracting_state == 'in_process')
|
||||
))
|
||||
))
|
||||
|
||||
@staticmethod
|
||||
def default_active():
|
||||
|
@ -80,4 +77,4 @@ class Employee:
|
|||
@fields.depends('contract')
|
||||
def on_change_with_salary(self):
|
||||
if self.contract:
|
||||
self.salary = self.contract.salary
|
||||
self.salary = self.contract.salary
|
||||
|
|
Loading…
Reference in New Issue