changeset f01a31d5af43 in modules/account_invoice:default
details: 
https://hg.tryton.org/modules/account_invoice?cmd=changeset;node=f01a31d5af43
description:
        Use direct access to backend classes

        issue8836
        review258421002
diffstat:

 invoice.py      |  6 +++---
 party.py        |  3 +--
 payment_term.py |  7 +++----
 3 files changed, 7 insertions(+), 9 deletions(-)

diffs (70 lines):

diff -r cf452468de5f -r f01a31d5af43 invoice.py
--- a/invoice.py        Wed Dec 04 11:09:35 2019 +0100
+++ b/invoice.py        Fri Dec 06 17:33:46 2019 +0100
@@ -735,7 +735,7 @@
         invoice_query = Rule.query_get('account.invoice')
         Operator = fields.SQL_OPERATORS[operator]
         # SQLite uses float for sum
-        if backend.name() == 'sqlite':
+        if backend.name == 'sqlite':
             value = float(value)
 
         union = (line.join(invoice, condition=(invoice.id == line.invoice)
@@ -771,7 +771,7 @@
         invoice_query = Rule.query_get('account.invoice')
         Operator = fields.SQL_OPERATORS[operator]
         # SQLite uses float for sum
-        if backend.name() == 'sqlite':
+        if backend.name == 'sqlite':
             value = float(value)
 
         query = line.join(invoice,
@@ -800,7 +800,7 @@
         invoice_query = Rule.query_get('account.invoice')
         Operator = fields.SQL_OPERATORS[operator]
         # SQLite uses float for sum
-        if backend.name() == 'sqlite':
+        if backend.name == 'sqlite':
             value = float(value)
 
         query = tax.select(tax.invoice,
diff -r cf452468de5f -r f01a31d5af43 party.py
--- a/party.py  Wed Dec 04 11:09:35 2019 +0100
+++ b/party.py  Fri Dec 06 17:33:46 2019 +0100
@@ -58,8 +58,7 @@
 
     @classmethod
     def __register__(cls, module_name):
-        TableHandler = backend.get('TableHandler')
-        exist = TableHandler.table_exist(cls._table)
+        exist = backend.TableHandler.table_exist(cls._table)
 
         super(PartyPaymentTerm, cls).__register__(module_name)
 
diff -r cf452468de5f -r f01a31d5af43 payment_term.py
--- a/payment_term.py   Wed Dec 04 11:09:35 2019 +0100
+++ b/payment_term.py   Fri Dec 06 17:33:46 2019 +0100
@@ -251,7 +251,6 @@
 
     @classmethod
     def __register__(cls, module_name):
-        TableHandler = backend.get('TableHandler')
         transaction = Transaction()
         cursor = transaction.connection.cursor()
         pool = Pool()
@@ -267,12 +266,12 @@
         old_model_name = 'account.invoice.payment_term.line.relativedelta'
         old_table = config.get(
             'table', old_model_name, default=old_model_name.replace('.', '_'))
-        if TableHandler.table_exist(old_table):
-            TableHandler.table_rename(old_table, cls._table)
+        if backend.TableHandler.table_exist(old_table):
+            backend.TableHandler.table_rename(old_table, cls._table)
 
         # Migration from 5.0: use ir.calendar
         migrate_calendar = False
-        if TableHandler.table_exist(cls._table):
+        if backend.TableHandler.table_exist(cls._table):
             cursor.execute(*sql_table.select(
                     sql_table.month, sql_table.weekday,
                     where=(sql_table.month != Null)

Reply via email to