Use direct access to backend classes
issue8836 review258421002
This commit is contained in:
+1
-2
@@ -169,8 +169,7 @@ class JournalSequence(ModelSQL, CompanyValueMixin):
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
exist = TableHandler.table_exist(cls._table)
|
||||
exist = backend.TableHandler.table_exist(cls._table)
|
||||
|
||||
super(JournalSequence, cls).__register__(module_name)
|
||||
|
||||
|
||||
@@ -467,7 +467,6 @@ class Reconciliation(ModelSQL, ModelView):
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
cursor = Transaction().connection.cursor()
|
||||
table = cls.__table_handler__(module_name)
|
||||
sql_table = cls.__table__()
|
||||
@@ -483,7 +482,7 @@ class Reconciliation(ModelSQL, ModelView):
|
||||
|
||||
# Migration from 3.8: new date field
|
||||
if (not date_exist
|
||||
and TableHandler.table_exist(Line._table)
|
||||
and backend.TableHandler.table_exist(Line._table)
|
||||
and Line.__table_handler__().column_exist('move')):
|
||||
cursor.execute(*sql_table.update(
|
||||
[sql_table.date],
|
||||
|
||||
@@ -313,8 +313,7 @@ class PartyAccount(ModelSQL, CompanyValueMixin):
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
exist = TableHandler.table_exist(cls._table)
|
||||
exist = backend.TableHandler.table_exist(cls._table)
|
||||
|
||||
super(PartyAccount, cls).__register__(module_name)
|
||||
|
||||
|
||||
@@ -800,7 +800,7 @@ class Tax(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin):
|
||||
|
||||
columns = []
|
||||
amount = tax_line.amount
|
||||
if backend.name() == 'sqlite':
|
||||
if backend.name == 'sqlite':
|
||||
amount = TaxLine.amount.sql_cast(tax_line.amount)
|
||||
for name, clause in [
|
||||
('invoice_base_amount',
|
||||
@@ -814,7 +814,7 @@ class Tax(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin):
|
||||
]:
|
||||
if name not in names:
|
||||
continue
|
||||
if backend.name() == 'postgresql': # FIXME
|
||||
if backend.name == 'postgresql': # FIXME
|
||||
columns.append(Sum(amount, filter_=clause).as_(name))
|
||||
else:
|
||||
columns.append(Sum(Case([clause, amount])).as_(name))
|
||||
@@ -1182,13 +1182,12 @@ class TaxLine(ModelSQL, ModelView):
|
||||
def __register__(cls, module_name):
|
||||
pool = Pool()
|
||||
Tax = pool.get('account.tax')
|
||||
TableHandler = backend.get('TableHandler')
|
||||
transaction = Transaction()
|
||||
table = cls.__table__()
|
||||
tax = Tax.__table__()
|
||||
|
||||
migrate_type = False
|
||||
if TableHandler.table_exist(cls._table):
|
||||
if backend.TableHandler.table_exist(cls._table):
|
||||
table_h = cls.__table_handler__(module_name)
|
||||
migrate_type = not table_h.column_exist('type')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user