Add __table_handler__ to ModelSQL
issue7581 review48531002
This commit is contained in:
1 parent
c07661323a
commit
7ef79761d9
2 files changed
+2
-6
No files matched your search
+1
-3
@@ -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')
|
||||
|
||||
+1
-3
@@ -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')
|
||||
|
||||
|
||||
Reference in new issue
Block a user