diff --git a/company.py b/company.py index f43b59dd72..0a786bebc4 100644 --- a/company.py +++ b/company.py @@ -17,7 +17,7 @@ __metaclass__ = PoolMeta class Company(ModelSQL, ModelView): 'Company' __name__ = 'company.company' - _inherits = {'party.party': 'party'} + _rec_name = 'party' party = fields.Many2One('party.party', 'Party', required=True, ondelete='CASCADE') parent = fields.Many2One('company.company', 'Parent') @@ -36,19 +36,8 @@ class Company(ModelSQL, ModelView): super(Company, cls).validate(companies) cls.check_recursion(companies) - @classmethod - def copy(cls, companies, default=None): - Party = Pool().get('party.party') - - if default is None: - default = {} - default = default.copy() - new_companies = [] - for company in companies: - default['party'], = Party.copy([company.party]) - new_company, = super(Company, cls).copy([company], default=default) - new_companies.append(new_company) - return new_companies + def get_rec_name(self, name): + return self.party.rec_name @classmethod def write(cls, companies, vals): @@ -60,10 +49,13 @@ class Company(ModelSQL, ModelView): class Employee(ModelSQL, ModelView): 'Employee' __name__ = 'company.employee' - _inherits = {'party.party': 'party'} + _rec_name = 'party' party = fields.Many2One('party.party', 'Party', required=True) company = fields.Many2One('company.company', 'Company', required=True) + def get_rec_name(self, name): + return self.party.rec_name + class UserEmployee(ModelSQL): 'User - Employee' @@ -133,7 +125,7 @@ class User: def get_status_bar(self, name): status = super(User, self).get_status_bar(name) if self.company: - status += ' - %s [%s]' % (self.company.name, + status += ' - %s [%s]' % (self.company.rec_name, self.company.currency.name) return status diff --git a/company.xml b/company.xml index a7cc7f9374..3c10eefb8a 100644 --- a/company.xml +++ b/company.xml @@ -6,7 +6,7 @@ this repository contains the full copyright notices and license terms. --> company.company form - + company_form @@ -166,18 +166,11 @@ this repository contains the full copyright notices and license terms. --> company.employee form - + 10 employee_form - - company.employee - form - 20 - employee_form2 - - company.employee tree @@ -195,7 +188,7 @@ this repository contains the full copyright notices and license terms. --> - + - - -
- - - - + + - + +
diff --git a/view/company_list.xml b/view/company_list.xml index 5e20a47f28..0bb5c5966c 100644 --- a/view/company_list.xml +++ b/view/company_list.xml @@ -2,5 +2,5 @@ - + diff --git a/view/company_tree.xml b/view/company_tree.xml index 0a224583ad..a1246a4f63 100644 --- a/view/company_tree.xml +++ b/view/company_tree.xml @@ -2,9 +2,8 @@ - + - diff --git a/view/employee_form.xml b/view/employee_form.xml index 6c35910f99..485422cca2 100644 --- a/view/employee_form.xml +++ b/view/employee_form.xml @@ -1,12 +1,9 @@ - - -
- - - - + +