Files
tryton/modules/account_dunning/account.py
T

39 lines
1.3 KiB
Python
Raw Normal View History

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 PoolMeta
2013-09-18 22:52:41 +02:00
2017-04-01 00:26:23 +02:00
default_dunning_procedure = fields.Many2One(
2018-03-09 11:50:18 +01:00
'account.dunning.procedure', "Default Dunning Procedure",
help="The default dunning procedure for new customers.")
2013-09-18 22:52:41 +02:00
2018-06-26 19:11:41 +02:00
class Configuration(metaclass=PoolMeta):
2013-09-18 22:52:41 +02:00
__name__ = 'account.configuration'
2017-04-01 00:26:23 +02:00
default_dunning_procedure = fields.MultiValue(default_dunning_procedure)
2013-09-18 22:52:41 +02:00
2017-04-01 00:26:23 +02:00
class ConfigurationDefaultDunningProcedure(ModelSQL, ValueMixin):
"Account Configuration Default Dunning Procedure"
__name__ = 'account.configuration.default_dunning_procedure'
default_dunning_procedure = default_dunning_procedure
2013-09-18 22:52:41 +02:00
2018-06-26 19:11:41 +02:00
class MoveLine(metaclass=PoolMeta):
2013-09-18 22:52:41 +02:00
__name__ = 'account.move.line'
dunnings = fields.One2Many('account.dunning', 'line', 'Dunnings')
2015-03-16 13:07:21 +01:00
@property
def dunning_procedure(self):
if self.party:
return self.party.dunning_procedure
@classmethod
def copy(cls, lines, default=None):
if default is None:
default = {}
else:
default = default.copy()
2018-09-01 01:02:03 +02:00
default.setdefault('dunnings', None)
return super(MoveLine, cls).copy(lines, default=default)