diff --git a/account.py b/account.py
index e7b61fda85..dc120f3a89 100644
--- a/account.py
+++ b/account.py
@@ -761,7 +761,7 @@ class Account(ModelSQL, ModelView):
res[account_id] += deferral.debit - deferral.credit
else:
with Transaction().set_context(fiscalyear=fiscalyear.id,
- date=None, periods=None):
+ date=None):
res2 = self.get_balance(ids, name)
for account_id in ids:
res[account_id] += res2[account_id]
@@ -861,7 +861,7 @@ class Account(ModelSQL, ModelView):
res[name][account_id] += deferral[name]
else:
with Transaction().set_context(fiscalyear=fiscalyear.id,
- date=None, dates=None):
+ date=None):
res2 = self.get_credit_debit(ids, names)
for account_id in ids:
for name in names:
@@ -1467,7 +1467,7 @@ class TrialBalance(Report):
start_accounts = account_obj.browse(account_ids)
with Transaction().set_context(
- fiscalyear=None,
+ fiscalyear=data['fiscalyear'],
periods=end_period_ids,
posted=data['posted']):
in_accounts = account_obj.browse(account_ids)
diff --git a/fiscalyear.py b/fiscalyear.py
index 1a7cd71994..fc506b91a7 100644
--- a/fiscalyear.py
+++ b/fiscalyear.py
@@ -170,13 +170,14 @@ class FiscalYear(ModelSQL, ModelView):
'type': 'standard',
})
period_start_date = period_end_date + relativedelta(days=1)
+ return True
@ModelView.button
def create_period_3(self, ids):
'''
Create periods for the fiscal years with 3 months interval
'''
- self.create_period(ids, interval=3)
+ return self.create_period(ids, interval=3)
def find(self, company_id, date=None, exception=True):
'''
diff --git a/fiscalyear.xml b/fiscalyear.xml
index e5bf1018ec..86ae17c570 100644
--- a/fiscalyear.xml
+++ b/fiscalyear.xml
@@ -28,9 +28,11 @@ this repository contains the full copyright notices and license terms. -->
+ string="Create Monthly Periods"
+ type="object"/>
+ string="Create 3 Months Periods"
+ type="object"/>
@@ -40,10 +42,10 @@ this repository contains the full copyright notices and license terms. -->
-
-
diff --git a/move.py b/move.py
index 8a68c8e476..c09d716029 100644
--- a/move.py
+++ b/move.py
@@ -1008,11 +1008,17 @@ class Line(ModelSQL, ModelView):
'\')' \
')', fiscalyear_ids)
+ if not Transaction().context.get('fiscalyear'):
+ fiscalyear_ids = fiscalyear_obj.search([
+ ('state', '=', 'open'),
+ ])
+ fiscalyear_clause = (','.join(map(str, fiscalyear_ids))) or '0'
+ else:
+ fiscalyear_ids = [int(Transaction().context.get('fiscalyear'))]
+ fiscalyear_clause = '%s' % int(
+ Transaction().context.get('fiscalyear'))
+
if Transaction().context.get('periods'):
- if Transaction().context.get('fiscalyear'):
- fiscalyear_ids = [int(Transaction().context['fiscalyear'])]
- else:
- fiscalyear_ids = []
ids = ','.join(
str(int(x)) for x in Transaction().context['periods'])
if Transaction().context.get('posted'):
@@ -1022,25 +1028,15 @@ class Line(ModelSQL, ModelView):
'SELECT id FROM account_move '
'WHERE period IN (' + ids + ') '
'AND state = \'posted\' '
- ')', fiscalyear_ids)
+ ')', [])
else:
return (obj + '.active '
'AND ' + obj + '.state != \'draft\' '
'AND ' + obj + '.move IN ('
'SELECT id FROM account_move '
'WHERE period IN (' + ids + ')'
- ')', fiscalyear_ids)
+ ')', [])
else:
- if not Transaction().context.get('fiscalyear'):
- fiscalyear_ids = fiscalyear_obj.search([
- ('state', '=', 'open'),
- ])
- fiscalyear_clause = (','.join(map(str, fiscalyear_ids))) or '0'
- else:
- fiscalyear_ids = [int(Transaction().context.get('fiscalyear'))]
- fiscalyear_clause = '%s' % int(
- Transaction().context.get('fiscalyear'))
-
if Transaction().context.get('posted'):
return (obj + '.active '
'AND ' + obj + '.state != \'draft\' '
diff --git a/move.xml b/move.xml
index 7d3a6e7d28..5a8485940b 100644
--- a/move.xml
+++ b/move.xml
@@ -26,8 +26,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
+