-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.py
29 lines (26 loc) · 989 Bytes
/
account.py
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
#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.model import ModelView, ModelSQL, fields
from trytond.pyson import Eval
__all__ = ['FiscalYear']
class FiscalYear(ModelSQL, ModelView):
__name__ = 'account.fiscalyear'
receipt_sequence = fields.Many2One('ir.sequence',
'Receipt Sequence', required=True,
domain=[
('code', '=', 'account.invoice'),
['OR',
('company', '=', Eval('company')),
('company', '=', None),
],
],
context={
'code': 'account.invoice',
'company': Eval('company'),
},
depends=['company'])
def get_sequence(self, field_name):
sequence = getattr(self, field_name + '_sequence')
if sequence:
return sequence
return getattr(self.fiscalyear, field_name + '_sequence')