/usr/lib/python2.7/dist-packages/trytond/modules/account_dunning/account.py is in tryton-modules-account-dunning 4.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | # This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool, PoolMeta
from trytond.model import fields
__all__ = ['Configuration', 'MoveLine']
class Configuration:
__metaclass__ = PoolMeta
__name__ = 'account.configuration'
default_dunning_procedure = fields.Function(fields.Many2One(
'account.dunning.procedure', 'Default Dunning Procedure'),
'get_dunning', setter='set_dunning')
def get_dunning(self, name):
pool = Pool()
Property = pool.get('ir.property')
ModelField = pool.get('ir.model.field')
dunning_field, = ModelField.search([
('model.model', '=', 'party.party'),
('name', '=', name[8:]),
], limit=1)
properties = Property.search([
('field', '=', dunning_field.id),
('res', '=', None),
], limit=1)
if properties:
prop, = properties
return prop.value.id
@classmethod
def set_dunning(cls, configurations, name, value):
pool = Pool()
Property = pool.get('ir.property')
ModelField = pool.get('ir.model.field')
dunning_field, = ModelField.search([
('model.model', '=', 'party.party'),
('name', '=', name[8:]),
], limit=1)
properties = Property.search([
('field', '=', dunning_field.id),
('res', '=', None),
])
Property.delete(properties)
if value:
Property.create([{
'field': dunning_field.id,
'value': 'account.dunning.procedure,%s' % value,
}])
class MoveLine:
__metaclass__ = PoolMeta
__name__ = 'account.move.line'
dunnings = fields.One2Many('account.dunning', 'line', 'Dunnings')
@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()
default.setdefault('dunnings')
return super(MoveLine, cls).copy(lines, default=default)
|