From b9d0402deb8cd4536d13dbc0bf6279e8b9160fe0 Mon Sep 17 00:00:00 2001 From: Camilo Sarmiento Date: Wed, 21 Oct 2020 18:44:19 -0500 Subject: [PATCH] comment migration position employee to contract --- contract.py | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/contract.py b/contract.py index f453f30..448a402 100644 --- a/contract.py +++ b/contract.py @@ -72,30 +72,30 @@ class StaffContract(Workflow, ModelSQL, ModelView): '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) - pool = Pool() - Employee = pool.get('company.employee') - cursor = Transaction().connection.cursor() - sql_table = cls.__table__() - employee = Employee.__table__() - - # Migration: - # - Migration position from employee into contract - sub_query = employee.select( - employee.id, employee.position, - where=(employee.position != Null) - ) - cursor.execute(*sub_query) - - for employee_id, position in cursor.fetchall(): - cursor.execute(*sql_table.update( - columns=[sql_table.position], - values=[position], - where=(sql_table.employee == employee_id) - & (sql_table.position == Null) - )) + # @classmethod + # def __register__(cls, module_name): + # super(StaffContract, cls).__register__(module_name) + # pool = Pool() + # Employee = pool.get('company.employee') + # cursor = Transaction().connection.cursor() + # sql_table = cls.__table__() + # employee = Employee.__table__() + # + # # Migration: + # # - Migration position from employee into contract + # sub_query = employee.select( + # employee.id, employee.position, + # where=(employee.position != Null) + # ) + # cursor.execute(*sub_query) + # + # for employee_id, position in cursor.fetchall(): + # cursor.execute(*sql_table.update( + # columns=[sql_table.position], + # values=[position], + # where=(sql_table.employee == employee_id) + # & (sql_table.position == Null) + # )) @staticmethod def default_company():