trytond-account_invoice_par.../party.py

32 lines
1.1 KiB
Python

# The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, fields
from trytond.pool import PoolMeta, Pool
from trytond.modules.company.model import CompanyValueMixin
__all__ = ['Party', 'PartyParty']
class Party:
__name__ = 'party.party'
__metaclass__ = PoolMeta
customer_to_invoice = fields.MultiValue(
fields.Many2One('party.party', 'Customer to invoice'))
supplier_to_invoice = fields.MultiValue(
fields.Many2One('party.party', 'Supplier to invoice'))
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field in {'customer_to_invoice', 'supplier_to_invoice'}:
return pool.get('party.party.party')
return super(Party, cls).multivalue_model(field)
class PartyParty(ModelSQL, CompanyValueMixin):
"Party Party"
__name__ = 'party.party.party'
customer_to_invoice = fields.Many2One('party.party', 'Customer to invoice')
supplier_to_invoice = fields.Many2One('party.party', 'Supplier to invoice')