diff --git a/__init__.py b/__init__.py
index 1f21151..f7f16f3 100644
--- a/__init__.py
+++ b/__init__.py
@@ -8,15 +8,12 @@ from . import cron
from . import employee
from . import carrier
from . import party
-from . import user
def register():
Pool.register(
cron.Cron,
employee.Employee,
- user.User,
- user.UserCompany,
party.PartyCompany,
party.Party,
party.Address,
diff --git a/account.xml b/account.xml
deleted file mode 100644
index 6b39035..0000000
--- a/account.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/activity.py b/activity.py
index 9a0cf44..16c7cb8 100644
--- a/activity.py
+++ b/activity.py
@@ -3,8 +3,6 @@
from trytond.pool import PoolMeta
from . import party
-__all__ = ['Activity']
-
class Activity(party.PartyCompanyMixin, metaclass=PoolMeta):
__name__ = "activity.activity"
diff --git a/activity.xml b/activity.xml
index 3f6af1a..005b535 100644
--- a/activity.xml
+++ b/activity.xml
@@ -9,10 +9,8 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/bank.py b/bank.py
index 987c59a..85381ed 100644
--- a/bank.py
+++ b/bank.py
@@ -4,8 +4,6 @@ from trytond.model import fields
from trytond.pool import PoolMeta
from . import party
-__all__ = ['Bank', 'BankAccount']
-
class Bank(party.PartyCompanyMixin, metaclass=PoolMeta):
__name__ = "bank"
diff --git a/bank.xml b/bank.xml
index db31fa1..3ce381d 100644
--- a/bank.xml
+++ b/bank.xml
@@ -9,10 +9,8 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
@@ -21,10 +19,8 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/carrier.py b/carrier.py
index e1f87d1..357d5d7 100644
--- a/carrier.py
+++ b/carrier.py
@@ -3,8 +3,6 @@
from trytond.pool import PoolMeta
from . import party
-__all__ = ['Carrier']
-
class Carrier(party.PartyCompanyMixin, metaclass=PoolMeta):
__name__ = 'carrier'
diff --git a/carrier.xml b/carrier.xml
index 9f1bc40..77a5ea7 100644
--- a/carrier.xml
+++ b/carrier.xml
@@ -9,10 +9,8 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/commission.xml b/commission.xml
index c0b5a7a..77dd2a5 100644
--- a/commission.xml
+++ b/commission.xml
@@ -9,10 +9,8 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
@@ -22,10 +20,8 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/cron.py b/cron.py
index d207225..7380213 100644
--- a/cron.py
+++ b/cron.py
@@ -4,8 +4,6 @@ from trytond.model import ModelView, dualmethod
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
-__all__ = ['Cron']
-
class Cron(metaclass=PoolMeta):
__name__ = "ir.cron"
diff --git a/employee.py b/employee.py
index f7c3daf..36663e4 100644
--- a/employee.py
+++ b/employee.py
@@ -4,7 +4,6 @@ from trytond.pool import PoolMeta
from trytond.pyson import Eval, If
from trytond.transaction import Transaction
-__all__ = ['Employee']
class Employee(metaclass=PoolMeta):
__name__ = 'company.employee'
diff --git a/employee.xml b/employee.xml
index de44164..5b09218 100644
--- a/employee.xml
+++ b/employee.xml
@@ -4,9 +4,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/party.py b/party.py
index ef643b1..39b3443 100644
--- a/party.py
+++ b/party.py
@@ -10,9 +10,6 @@ from trytond import backend
from trytond.i18n import gettext
from trytond.exceptions import UserError
-__all__ = ['PartyCompany', 'Party', 'Address', 'PartyIdentifier',
- 'ContactMechanism']
-
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
diff --git a/party.xml b/party.xml
index 1b216f3..68ceb54 100644
--- a/party.xml
+++ b/party.xml
@@ -16,9 +16,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
@@ -29,9 +27,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
@@ -42,9 +38,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
@@ -55,9 +49,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/shop.xml b/shop.xml
index 0fdb582..fb659a6 100644
--- a/shop.xml
+++ b/shop.xml
@@ -4,10 +4,8 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
-
+
-
\ No newline at end of file
+
diff --git a/stock.xml b/stock.xml
index 575ce8e..f74ada5 100644
--- a/stock.xml
+++ b/stock.xml
@@ -5,9 +5,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/tryton.cfg b/tryton.cfg
index ab0a2a4..1930783 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -14,7 +14,6 @@ extras_depend:
sale_shop
stock
xml:
- account.xml
activity.xml
bank.xml
carrier.xml
@@ -23,5 +22,4 @@ xml:
party.xml
shop.xml
stock.xml
- user.xml
messages.xml
diff --git a/user.py b/user.py
deleted file mode 100644
index c8b396a..0000000
--- a/user.py
+++ /dev/null
@@ -1,136 +0,0 @@
-# The COPYRIGHT file at the top level of this repository contains the full
-# copyright notices and license terms.
-import copy
-from trytond.pool import Pool, PoolMeta
-from trytond.model import ModelSQL, fields
-from trytond.pyson import Eval
-from trytond.transaction import Transaction
-from trytond import backend
-from sql import Table, Null, Column
-from sql.functions import CurrentTimestamp
-
-__all__ = ['User', 'UserCompany']
-
-
-class User(metaclass=PoolMeta):
- __name__ = 'res.user'
- main_companies = fields.Many2Many('res.user-company.company', 'user',
- 'company', 'Main Companies')
-
- @classmethod
- def __setup__(cls):
- super(User, cls).__setup__()
- if not 'companies' in cls._context_fields:
- cls._context_fields.insert(0, 'companies')
-
- # replace company field domain and depends
- domain = cls.company.domain
- new_domain = [d for d in domain if not 'main_company' in str(d)]
- new_domain.append(
- ('parent', 'child_of', Eval('main_companies'), 'parent'))
- cls.company.domain = new_domain
- depends = cls.company.depends
- depends.append('main_companies')
- if 'main_company' in depends:
- depends.remove('main_company')
- cls.company.depends = depends
-
- @classmethod
- def write(cls, *args):
- actions = iter(args)
- new_args = []
- for records, values in zip(actions, actions):
- new_args.append(records)
- if 'main_company' in values:
- values = values.copy()
- values['main_companies'] = [('add', [values['main_company']])]
- new_args.append(values)
- super().write(*new_args)
-
- @classmethod
- def get_companies(cls, users, name):
- Company = Pool().get('company.company')
-
- companies = super(User, cls).get_companies(users, name)
-
- companies = {}
- company_childs = {}
- for user in users:
- companies[user.id] = []
- for company in user.main_companies:
- if company in company_childs:
- company_ids = company_childs[company]
- else:
- company_ids = list(map(int, Company.search([
- ('parent', 'child_of', [company.id]),
- ])))
- company_childs[company] = company_ids
- if company_ids:
- companies[user.id].extend(company_ids)
- return companies
-
- @classmethod
- def get_preferences_fields_view(cls):
- Company = Pool().get('company.company')
-
- res = super(User, cls).get_preferences_fields_view()
- res = copy.deepcopy(res)
-
- if 'company' in res['fields']:
- user = cls(Transaction().user)
- selection = [(None, '')]
- company_ids = [c.id for c in user.main_companies]
- if company_ids:
- companies = Company.search([
- ('parent', 'child_of', company_ids,
- 'parent'),
- ])
- for company in companies:
- selection.append((company.id, company.rec_name))
- res['fields']['company']['selection'] = selection
- return res
-
-
-class UserCompany(ModelSQL):
- 'User - Company'
- __name__ = 'res.user-company.company'
- _table = 'res_user_company_rel'
- user = fields.Many2One('res.user', 'User', ondelete='CASCADE',
- required=True, select=True)
- company = fields.Many2One('company.company', 'Company',
- ondelete='CASCADE', required=True, select=True)
-
- @classmethod
- def __register__(cls, module_name):
- User = Pool().get('res.user')
- user_company_table_name = 'res_user_company_rel'
- cursor = Transaction().connection.cursor()
-
- user_company_table_exist = False
- if backend.TableHandler.table_exist(user_company_table_name):
- user_company_table_exist = True
-
- super(UserCompany, cls).__register__(module_name)
-
- if not user_company_table_exist:
- # update main_company to null
- user = User.__table__()
- query = user.update(
- columns=[user.main_company],
- values=[None],
- where=user.main_company != Null)
- cursor.execute(*query)
-
- # insert company user
- fields = ['create_uid', 'create_date', 'user', 'company']
- query = user.select(user.id, user.company,
- where=(user.company != Null))
- cursor.execute(*query)
- values = [(0, CurrentTimestamp(), user_id, company_id) for user_id,
- company_id in cursor.fetchall()]
- if values:
- user_company = Table(user_company_table_name)
- query = user_company.insert(
- columns=[Column(user_company, f) for f in fields],
- values=values)
- cursor.execute(*query)
diff --git a/user.xml b/user.xml
deleted file mode 100644
index 34275a3..0000000
--- a/user.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
- res.user
-
- user_form
-
-
-
- user_cron_party_company
- Cron User Company
-
-
-
-
-
-
-
-
diff --git a/view/user_form.xml b/view/user_form.xml
deleted file mode 100644
index 365fd16..0000000
--- a/view/user_form.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-