mirror of
https://github.com/NaN-tic/trytond-party_company.git
synced 2023-12-14 03:32:57 +01:00
Replace PartyCompanyMixin in commission manager
This commit is contained in:
parent
6bc4aae359
commit
741c822835
|
@ -1,14 +1,27 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from . import party
|
||||
|
||||
__all__ = ['Manager', 'Agent']
|
||||
|
||||
|
||||
class Manager(object, party.PartyCompanyMixin):
|
||||
class Manager:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'commission.manager'
|
||||
companies = fields.Function(fields.Many2One('company.company', 'Company'),
|
||||
'get_company', searcher='search_company_field')
|
||||
companies = fields.Function(fields.One2Many('company.company', None,
|
||||
'Companies'), 'get_companies', searcher='search_companies')
|
||||
|
||||
def get_companies(self, name):
|
||||
if self.agent:
|
||||
return [c.id for c in self.agent.party.companies]
|
||||
|
||||
@classmethod
|
||||
def search_companies(cls, name, clause):
|
||||
return [('agent.party.companies',) + tuple(clause[1:])]
|
||||
|
||||
|
||||
class Agent(object, party.PartyCompanyMixin):
|
||||
|
|
Loading…
Reference in a new issue