From 7ef79761d9bce8bc4fa3abb62ff624ee58efd108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 24 Jul 2018 22:01:08 +0200 Subject: [PATCH] Add __table_handler__ to ModelSQL issue7581 review48531002 --- company.py | 4 +--- timesheet.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/company.py b/company.py index 10d5a011eb..ca2d22f298 100644 --- a/company.py +++ b/company.py @@ -5,7 +5,6 @@ from trytond.model import ModelView, ModelSQL, fields, Unique from trytond.cache import Cache from trytond.transaction import Transaction from trytond.pool import Pool, PoolMeta -from trytond import backend from trytond.config import config __all__ = ['Employee', 'EmployeeCostPrice', 'price_digits'] @@ -79,9 +78,8 @@ class EmployeeCostPrice(ModelSQL, ModelView): @classmethod def __register__(cls, module_name): - TableHandler = backend.get('TableHandler') super(EmployeeCostPrice, cls).__register__(module_name) - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) # Migration from 2.8 drop date_cost_price_uniq table.drop_constraint('date_cost_price_uniq') diff --git a/timesheet.py b/timesheet.py index a66b103606..f85c5fc853 100644 --- a/timesheet.py +++ b/timesheet.py @@ -5,7 +5,6 @@ from sql import Null from trytond.transaction import Transaction from trytond.pool import Pool, PoolMeta from trytond.model import fields -from trytond import backend from .company import price_digits @@ -22,11 +21,10 @@ class TimesheetLine(metaclass=PoolMeta): def __register__(cls, module_name): pool = Pool() Employee = pool.get('company.employee') - TableHandler = backend.get('TableHandler') cursor = Transaction().connection.cursor() table = cls.__table__() - table_h = TableHandler(cls, module_name) + table_h = cls.__table_handler__(module_name) migrate_cost_price = not table_h.column_exist('cost_price')