Browse Source

[IMP] Se convierte en funcion el codigo conseguir los periodos

6.0
Humberto Arocha 12 years ago
parent
commit
c0d3e4687d
  1. 29
      account_financial_report/report/parser.py

29
account_financial_report/report/parser.py

@ -159,6 +159,10 @@ class account_balance(report_sxw.rml_parse):
(account info plus debit/credit/balance in the selected period
and the full year)
"""
account_obj = self.pool.get('account.account')
period_obj = self.pool.get('account.period')
fiscalyear_obj = self.pool.get('account.fiscalyear')
self.from_currency_id = self.get_company_currency(form['company_id'] and type(form['company_id']) in (list,tuple) and form['company_id'][0] or form['company_id'])
if not form['currency_id']:
self.to_currency_id = self.from_currency_id
@ -180,9 +184,6 @@ class account_balance(report_sxw.rml_parse):
res = {}
result_acc = []
account_obj = self.pool.get('account.account')
period_obj = self.pool.get('account.period')
fiscalyear_obj = self.pool.get('account.fiscalyear')
if form.get('fiscalyear'):
if type(form.get('fiscalyear')) in (list,tuple):
@ -228,8 +229,8 @@ class account_balance(report_sxw.rml_parse):
# Calculate the period Debit/Credit #
# (from the selected period or all the non special periods in the fy) #
#############################################################################
ctx_end = self.context.copy()
def _ctx_end(ctx):
ctx_end = ctx
ctx_end['filter'] = form.get('filter','all')
ctx_end['fiscalyear'] = fiscalyear.id
#~ ctx_end['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)])
@ -249,6 +250,8 @@ class account_balance(report_sxw.rml_parse):
ctx_end['date_from'] = form['date_from']
ctx_end['date_to'] = form['date_to']
return ctx_end.copy()
def missing_period():
ctx_init['fiscalyear'] = fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop') and \
fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop')[-1] or []
@ -260,6 +263,7 @@ class account_balance(report_sxw.rml_parse):
# to the end of the year) #
#############################################################################
def _ctx_init(ctx):
ctx_init = self.context.copy()
ctx_init['filter'] = form.get('filter','all')
ctx_init['fiscalyear'] = fiscalyear.id
@ -279,6 +283,8 @@ class account_balance(report_sxw.rml_parse):
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx_init['periods'])])
ctx_init['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)])
return ctx_init.copy()
def z(n):
return abs(n) < 0.005 and 0.0 or n
@ -287,6 +293,9 @@ class account_balance(report_sxw.rml_parse):
#
tot = {}
ctx_init = _ctx_init(self.context.copy())
ctx_end = _ctx_end(self.context.copy())
for aa_id in account_ids:
id = aa_id[0]
@ -307,8 +316,10 @@ class account_balance(report_sxw.rml_parse):
}
if form['columns'] != 'thirteen':
aa_brw_init = account_obj.browse(self.cr, self.uid, id, ctx_init)
aa_brw_end = account_obj.browse(self.cr, self.uid, id, ctx_end)
i,d,c = map(z,[aa_brw_init.balance,aa_brw_end.debit,aa_brw_end.credit])
b = z(i+d-c)
res.update({
@ -318,6 +329,14 @@ class account_balance(report_sxw.rml_parse):
'balance': self.exchange(b),
})
if form['columns'] == 'thirteen':
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)],order='date_start asc')
print 'TODOS LOS PERIODS ',period_ids
pass
for i in range(12):
pass
#
# Check whether we must include this line in the report or not
#

Loading…
Cancel
Save