-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstatement_of_account.diff
65 lines (63 loc) · 2.76 KB
/
statement_of_account.diff
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
diff --git a/tryton/modules/account/account.py b/tryton/modules/account/account.py
index b1168b8f6a..2960d84541 100644
--- a/tryton/modules/account/account.py
+++ b/tryton/modules/account/account.py
@@ -2141,7 +2141,7 @@ class GeneralLedgerAccountContext(ModelView):
'General Ledger Account Context'
__name__ = 'account.general_ledger.account.context'
fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year',
- required=True,
+ required=False,
domain=[
('company', '=', Eval('company')),
],
@@ -2152,7 +2152,8 @@ class GeneralLedgerAccountContext(ModelView):
('start_date', '<=', (Eval('end_period'), 'start_date')),
],
states={
- 'invisible': Eval('from_date', False) | Eval('to_date', False),
+ 'invisible': (Eval('from_date', False) | Eval('to_date', False)
+ | ~Eval('fiscalyear', False))
})
end_period = fields.Many2One('account.period', 'End Period',
domain=[
@@ -2160,7 +2161,8 @@ class GeneralLedgerAccountContext(ModelView):
('start_date', '>=', (Eval('start_period'), 'start_date'))
],
states={
- 'invisible': Eval('from_date', False) | Eval('to_date', False),
+ 'invisible': (Eval('from_date', False) | Eval('to_date', False)
+ | ~Eval('fiscalyear', False))
})
from_date = fields.Date("From Date",
domain=[
@@ -2205,13 +2207,6 @@ class GeneralLedgerAccountContext(ModelView):
elif period_id is not None and period_id >= 0:
period = Period(period_id)
return period.fiscalyear.id
- else:
- try:
- fiscalyear = FiscalYear.find(
- context.get('company'), test_state=False)
- except FiscalYearNotFoundError:
- return None
- return fiscalyear.id
@classmethod
def default_start_period(cls):
@@ -2248,7 +2243,7 @@ class GeneralLedgerAccountContext(ModelView):
if not self.company:
self.fiscalyear = None
self.on_change_fiscalyear()
- elif not self.fiscalyear or self.fiscalyear.company != self.company:
+ elif self.fiscalyear and self.fiscalyear.company != self.company:
try:
self.fiscalyear = FiscalYear.find(
self.company, test_state=False)
@@ -2405,7 +2400,7 @@ class GeneralLedgerLine(DescriptionOriginMixin, ModelSQL, ModelView):
def __setup__(cls):
super(GeneralLedgerLine, cls).__setup__()
cls.__access__.add('account')
- cls._order.insert(0, ('date', 'ASC'))
+ cls._order = [('date', 'DESC'), ('id', 'DESC')]
cls.description_used.setter = None
@classmethod