Backed out changeset eae596a7d8d5

This commit is contained in:
Cédric Krier committed 2012-09-10 16:07:40 +02:00
1 parent 506a883276
commit f786ac465b
5 files changed
+26 -26

No files matched your search

+3 -3
View File
@@ -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)
+2 -1
View File
@@ -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):
'''
+6 -4
View File
@@ -28,9 +28,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="periods" colspan="4"/>
<group col="2" colspan="4" id="buttons">
<button name="create_period"
string="Create Monthly Periods"/>
string="Create Monthly Periods"
type="object"/>
<button name="create_period_3"
string="Create 3 Months Periods"/>
string="Create 3 Months Periods"
type="object"/>
</group>
</page>
<page string="Sequences" id="sequences">
@@ -40,10 +42,10 @@ this repository contains the full copyright notices and license terms. -->
</notebook>
<label string="" colspan="2" id="empty"/>
<group col="1" colspan="2" id="buttons">
<button name="close" string="Close Fiscal Year"
<button name="close" string="Close Fiscal Year" type="object"
icon="tryton-readonly"
confirm="Are you sure to close fiscal year?"/>
<button name="reopen" string="Re-Open Fiscal Year"
<button name="reopen" string="Re-Open Fiscal Year" type="object"
icon="tryton-clear"/>
</group>
</form>
+12 -16
View File
@@ -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\' '
+3 -2
View File
@@ -26,8 +26,9 @@ this repository contains the full copyright notices and license terms. -->
<label name="state"/>
<field name="state"/>
<group col="2" colspan="2" id="buttons">
<button string="Post" name="post" icon="tryton-ok"/>
<button string="Draft" name="draft"
<button string="Post" name="post" type="object"
icon="tryton-ok"/>
<button string="Draft" name="draft" type="object"
icon="tryton-clear"/>
</group>
</form>