diff --git a/product.py b/product.py index a68b69f7a9..6b4f09a2db 100644 --- a/product.py +++ b/product.py @@ -10,7 +10,6 @@ from trytond.model import ModelView, ModelSQL, MatchMixin, fields, \ from trytond.pyson import Eval, If from trytond.pool import Pool, PoolMeta from trytond.transaction import Transaction -from trytond import backend from trytond.modules.product import price_digits @@ -186,10 +185,9 @@ class ProductSupplier(sequence_ordered(), ModelSQL, ModelView, MatchMixin): @classmethod def __register__(cls, module_name): - TableHandler = backend.get('TableHandler') transaction = Transaction() cursor = transaction.connection.cursor() - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) sql_table = cls.__table__() # Migration from 2.2 new field currency @@ -332,9 +330,8 @@ class ProductSupplierPrice( @classmethod def __register__(cls, module_name): - TableHandler = backend.get('TableHandler') cursor = Transaction().connection.cursor() - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) sql_table = cls.__table__() fill_sequence = not table.column_exist('sequence') diff --git a/purchase.py b/purchase.py index 1fd35ee0a6..824dce7056 100644 --- a/purchase.py +++ b/purchase.py @@ -301,7 +301,7 @@ class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin): len('packing'))], where=model_field.name.like('%packing%') & (model_field.module == module_name))) - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) table.column_rename('packing_state', 'shipment_state') # Migration from 3.8: @@ -318,7 +318,7 @@ class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin): values=['shipment'], where=sql_table.invoice_method == 'packing')) - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) # Migration from 2.2: warehouse is no more required table.not_null_action('warehouse', 'remove') @@ -354,7 +354,7 @@ class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin): where=sql_table.id.in_(sub_query.select(sub_query.id)))) # Add index on create_date - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) table.index_action('create_date', action='add') @classmethod @@ -1110,11 +1110,10 @@ class PurchaseLine(sequence_ordered(), ModelSQL, ModelView): @classmethod def __register__(cls, module_name): - TableHandler = backend.get('TableHandler') cursor = Transaction().connection.cursor() sql_table = cls.__table__() super(PurchaseLine, cls).__register__(module_name) - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) # Migration from 1.0 comment change into note if table.column_exist('comment'): diff --git a/stock.py b/stock.py index dbb507e705..fdff0f13b8 100644 --- a/stock.py +++ b/stock.py @@ -8,7 +8,6 @@ from trytond.model import Workflow, ModelView, fields from trytond.pyson import Eval from trytond.pool import Pool, PoolMeta from trytond.transaction import Transaction -from trytond import backend from trytond.modules.product import price_digits @@ -205,13 +204,12 @@ class Move(metaclass=PoolMeta): @classmethod def __register__(cls, module_name): - TableHandler = backend.get('TableHandler') cursor = Transaction().connection.cursor() sql_table = cls.__table__() super(Move, cls).__register__(module_name) - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) # Migration from 2.6: remove purchase_line if table.column_exist('purchase_line'):