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({ cls._error_messages.update({
'employee_with_contract_current': ('The employee %s already has a contract ' 'employee_with_contract_current': ('The employee %s already has a contract in draft or active!'),
'in draft or active!'), 'missing_contract_sequence': ('The contract sequence is missing on configuration!'),
'missing_contract_sequence': ('The contract sequence is ' 'finish_contract_out_date': ('You can not to finish a contract with end date on future!'),
'missing on configuration!'), })
'finish_contract_out_date': ('You can not to finish a contract '
'with end date on future!'),
}
)
@classmethod @classmethod
def __register__(cls, module_name): def __register__(cls, module_name):
super(StaffContract, cls).__register__(module_name) super(StaffContract, cls).__register__(module_name)
TableHandler = backend.get('TableHandler')
pool = Pool() pool = Pool()
Identifier = pool.get('company.employee') Employee = pool.get('company.employee')
cursor = Transaction().connection.cursor() cursor = Transaction().connection.cursor()
sql_table = cls.__table__() sql_table = cls.__table__()
identifier = Identifier.__table__() employee = Employee.__table__()
# Migration: # Migration:
# - Migration position from employee into contract # - Migration position from employee into contract
sub_query = identifier.select( sub_query = employee.select(
identifier.id, identifier.position, employee.id, employee.position,
where=(identifier.position != Null) where=(employee.position != Null)
) )
cursor.execute(*sub_query) cursor.execute(*sub_query)