Not set a company of the current records
Since changeset-6a1646642396 is not required the company
This commit is contained in:
parent
4980dfe701
commit
69e5cb7e3a
79
party.py
79
party.py
|
@ -1,10 +1,9 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the full
|
# The COPYRIGHT file at the top level of this repository contains the full
|
||||||
# copyright notices and license terms.
|
# copyright notices and license terms.
|
||||||
from trytond.model import fields
|
from trytond.model import fields
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import PoolMeta
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pyson import If, Eval
|
from trytond.pyson import If, Eval
|
||||||
from trytond import backend
|
|
||||||
|
|
||||||
__all__ = ['Party', 'Address', 'PartyIdentifier', 'ContactMechanism']
|
__all__ = ['Party', 'Address', 'PartyIdentifier', 'ContactMechanism']
|
||||||
|
|
||||||
|
@ -19,25 +18,6 @@ class Party:
|
||||||
],
|
],
|
||||||
select=True)
|
select=True)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __register__(cls, module_name):
|
|
||||||
Company = Pool().get('company.company')
|
|
||||||
TableHandler = backend.get('TableHandler')
|
|
||||||
sql_table = cls.__table__()
|
|
||||||
table = TableHandler(cls, module_name)
|
|
||||||
|
|
||||||
company_column = table.column_exist('company')
|
|
||||||
|
|
||||||
super(Party, cls).__register__(module_name)
|
|
||||||
if not company_column:
|
|
||||||
companies = Company.search([], limit=1)
|
|
||||||
if companies:
|
|
||||||
company, = companies
|
|
||||||
cursor = Transaction().connection.cursor()
|
|
||||||
cursor.execute(*sql_table.update(
|
|
||||||
columns=[sql_table.company],
|
|
||||||
values=[company.id]))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
@ -53,25 +33,6 @@ class Address:
|
||||||
],
|
],
|
||||||
select=True)
|
select=True)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __register__(cls, module_name):
|
|
||||||
Company = Pool().get('company.company')
|
|
||||||
TableHandler = backend.get('TableHandler')
|
|
||||||
sql_table = cls.__table__()
|
|
||||||
table = TableHandler(cls, module_name)
|
|
||||||
|
|
||||||
company_column = table.column_exist('company')
|
|
||||||
|
|
||||||
super(Address, cls).__register__(module_name)
|
|
||||||
if not company_column:
|
|
||||||
companies = Company.search([], limit=1)
|
|
||||||
if companies:
|
|
||||||
company, = companies
|
|
||||||
cursor = Transaction().connection.cursor()
|
|
||||||
cursor.execute(*sql_table.update(
|
|
||||||
columns=[sql_table.company],
|
|
||||||
values=[company.id]))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
@ -87,25 +48,6 @@ class PartyIdentifier:
|
||||||
],
|
],
|
||||||
select=True)
|
select=True)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __register__(cls, module_name):
|
|
||||||
Company = Pool().get('company.company')
|
|
||||||
TableHandler = backend.get('TableHandler')
|
|
||||||
sql_table = cls.__table__()
|
|
||||||
table = TableHandler(cls, module_name)
|
|
||||||
|
|
||||||
company_column = table.column_exist('company')
|
|
||||||
|
|
||||||
super(PartyIdentifier, cls).__register__(module_name)
|
|
||||||
if not company_column:
|
|
||||||
companies = Company.search([], limit=1)
|
|
||||||
if companies:
|
|
||||||
company, = companies
|
|
||||||
cursor = Transaction().connection.cursor()
|
|
||||||
cursor.execute(*sql_table.update(
|
|
||||||
columns=[sql_table.company],
|
|
||||||
values=[company.id]))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
@ -121,25 +63,6 @@ class ContactMechanism:
|
||||||
],
|
],
|
||||||
select=True)
|
select=True)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def __register__(cls, module_name):
|
|
||||||
Company = Pool().get('company.company')
|
|
||||||
TableHandler = backend.get('TableHandler')
|
|
||||||
sql_table = cls.__table__()
|
|
||||||
table = TableHandler(cls, module_name)
|
|
||||||
|
|
||||||
company_column = table.column_exist('company')
|
|
||||||
|
|
||||||
super(ContactMechanism, cls).__register__(module_name)
|
|
||||||
if not company_column:
|
|
||||||
companies = Company.search([], limit=1)
|
|
||||||
if companies:
|
|
||||||
company, = companies
|
|
||||||
cursor = Transaction().connection.cursor()
|
|
||||||
cursor.execute(*sql_table.update(
|
|
||||||
columns=[sql_table.company],
|
|
||||||
values=[company.id]))
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
|
Loading…
Reference in New Issue