Follow PEP-0249 for Transaction and backends
issue4949 review19781002
This commit is contained in:
1 parent
08c76b35e5
commit
f9cb8c8999
3 files changed
+6
-10
No files matched your search
+1
-3
@@ -6,7 +6,6 @@ from sql.conditionals import Case
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.pyson import Eval, If
|
||||
from trytond.transaction import Transaction
|
||||
from trytond import backend
|
||||
from trytond.pool import Pool
|
||||
|
||||
@@ -53,8 +52,7 @@ class Address(ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
cursor = Transaction().cursor
|
||||
table = TableHandler(cursor, cls, module_name)
|
||||
table = TableHandler(cls, module_name)
|
||||
|
||||
super(Address, cls).__register__(module_name)
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ from sql.conditionals import Case
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
from trytond import backend
|
||||
|
||||
__all__ = ['ContactMechanism']
|
||||
@@ -94,8 +93,7 @@ class ContactMechanism(ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
cursor = Transaction().cursor
|
||||
table = TableHandler(cursor, cls, module_name)
|
||||
table = TableHandler(cls, module_name)
|
||||
|
||||
super(ContactMechanism, cls).__register__(module_name)
|
||||
|
||||
|
||||
@@ -71,12 +71,12 @@ class Party(ModelSQL, ModelView):
|
||||
pool = Pool()
|
||||
Property = pool.get('ir.property')
|
||||
TableHandler = backend.get('TableHandler')
|
||||
cursor = Transaction().cursor
|
||||
cursor = Transaction().connection.cursor()
|
||||
table = cls.__table__()
|
||||
|
||||
super(Party, cls).__register__(module_name)
|
||||
|
||||
table_h = TableHandler(cursor, cls, module_name)
|
||||
table_h = TableHandler(cls, module_name)
|
||||
if table_h.column_exist('lang'):
|
||||
cursor.execute(*table.select(table.id, table.lang,
|
||||
order_by=table.lang))
|
||||
@@ -253,12 +253,12 @@ class PartyIdentifier(ModelSQL, ModelView):
|
||||
pool = Pool()
|
||||
Party = pool.get('party.party')
|
||||
TableHandler = backend.get('TableHandler')
|
||||
cursor = Transaction().cursor
|
||||
cursor = Transaction().connection.cursor()
|
||||
party = Party.__table__()
|
||||
|
||||
super(PartyIdentifier, cls).__register__(module_name)
|
||||
|
||||
party_h = TableHandler(cursor, Party, module_name)
|
||||
party_h = TableHandler(Party, module_name)
|
||||
if (party_h.column_exist('vat_number')
|
||||
and party_h.column_exist('vat_country')):
|
||||
identifiers = []
|
||||
|
||||
Reference in new issue
Block a user