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