minor fix

This commit is contained in:
Camilo Sarmiento 2020-05-27 19:38:39 -05:00
parent cae17951e2
commit bb6ca59cd1
1 changed files with 9 additions and 14 deletions

View File

@ -69,30 +69,25 @@ class StaffContract(Workflow, ModelSQL, ModelView):
},
})
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!'),
'finish_contract_out_date': ('You can not to finish a contract '
'with end date on future!'),
}
)
'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!'),
'finish_contract_out_date': ('You can not to finish a contract with end date on future!'),
})
@classmethod
def __register__(cls, module_name):
super(StaffContract, cls).__register__(module_name)
TableHandler = backend.get('TableHandler')
pool = Pool()
Identifier = pool.get('company.employee')
Employee = pool.get('company.employee')
cursor = Transaction().connection.cursor()
sql_table = cls.__table__()
identifier = Identifier.__table__()
employee = Employee.__table__()
# Migration:
# - Migration position from employee into contract
sub_query = identifier.select(
identifier.id, identifier.position,
where=(identifier.position != Null)
sub_query = employee.select(
employee.id, employee.position,
where=(employee.position != Null)
)
cursor.execute(*sub_query)