2014-12-02 12:54:35 +01:00
|
|
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
|
|
|
# this repository contains the full copyright notices and license terms.
|
2017-04-01 00:26:23 +02:00
|
|
|
from trytond.model import ModelSQL, ValueMixin, fields
|
2021-12-11 17:58:41 +01:00
|
|
|
from trytond.pool import Pool, PoolMeta
|
2013-09-18 22:52:41 +02:00
|
|
|
|
2017-04-01 00:26:23 +02:00
|
|
|
dunning_procedure = fields.Many2One(
|
|
|
|
|
'account.dunning.procedure', "Dunning Procedure")
|
2013-09-18 22:52:41 +02:00
|
|
|
|
|
|
|
|
|
2018-06-26 19:11:41 +02:00
|
|
|
class Party(metaclass=PoolMeta):
|
2013-09-18 22:52:41 +02:00
|
|
|
__name__ = 'party.party'
|
2017-04-01 00:26:23 +02:00
|
|
|
dunning_procedure = fields.MultiValue(dunning_procedure)
|
|
|
|
|
dunning_procedures = fields.One2Many(
|
|
|
|
|
'party.party.dunning_procedure', 'party', "Dunning Procedures")
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def default_dunning_procedure(cls, **pattern):
|
|
|
|
|
pool = Pool()
|
|
|
|
|
Configuration = pool.get('account.configuration')
|
|
|
|
|
config = Configuration(1)
|
2021-04-03 14:27:10 +02:00
|
|
|
dunning_procedure = config.get_multivalue(
|
|
|
|
|
'default_dunning_procedure', **pattern)
|
2017-04-01 00:26:23 +02:00
|
|
|
return dunning_procedure.id if dunning_procedure else None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PartyDunningProcedure(ModelSQL, ValueMixin):
|
|
|
|
|
"Party Dunning Procedure"
|
|
|
|
|
__name__ = 'party.party.dunning_procedure'
|
|
|
|
|
party = fields.Many2One(
|
2022-10-11 00:44:49 +02:00
|
|
|
'party.party', "Party", ondelete='CASCADE')
|
2017-04-01 00:26:23 +02:00
|
|
|
dunning_procedure = dunning_procedure
|