diff --git a/configuration.py b/configuration.py index 624db41943..f0c56045de 100644 --- a/configuration.py +++ b/configuration.py @@ -47,7 +47,7 @@ class ConfigurationSequence(metaclass=PoolMeta): TableHandler = backend.get('TableHandler') exist = TableHandler.table_exist(cls._table) if exist: - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) exist &= table.column_exist('sale_opportunity_sequence') super(ConfigurationSequence, cls).__register__(module_name) diff --git a/opportunity.py b/opportunity.py index 06161c7f8c..4805a5fca2 100644 --- a/opportunity.py +++ b/opportunity.py @@ -10,7 +10,6 @@ from sql.functions import Extract from trytond.model import ModelView, ModelSQL, Workflow, fields, \ sequence_ordered -from trytond import backend from trytond.pyson import Eval, In, If, Get, Bool from trytond.transaction import Transaction from trytond.pool import Pool @@ -111,11 +110,10 @@ class SaleOpportunity(Workflow, ModelSQL, ModelView): pool = Pool() Sale = pool.get('sale.sale') cursor = Transaction().connection.cursor() - TableHandler = backend.get('TableHandler') sql_table = cls.__table__() sale = Sale.__table__() - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) number_exists = table.column_exist('number') # Migration from 3.8: rename reference into number @@ -124,7 +122,7 @@ class SaleOpportunity(Workflow, ModelSQL, ModelView): number_exists = True super(SaleOpportunity, cls).__register__(module_name) - table = TableHandler(cls, module_name) + table = cls.__table_handler__(module_name) # Migration from 2.8: make party not required and add number as # required @@ -469,11 +467,10 @@ class SaleOpportunityLine(sequence_ordered(), ModelSQL, ModelView): @classmethod def __register__(cls, module_name): - TableHandler = backend.get('TableHandler') - table = TableHandler(cls, module_name) - super(SaleOpportunityLine, cls).__register__(module_name) + table = cls.__table_handler__(module_name) + # Migration from 2.4: drop required on sequence table.not_null_action('sequence', action='remove')