Browse Source

[FIX] Se cambio el campo state por filter ya que el primero causaba errores en la impresion de los reportes

6.0
Miguel Delgado 13 years ago
parent
commit
bc64a38e6f
  1. 15
      account_financial_report/report/account_balance.py
  2. 10
      account_financial_report/report/account_balance_2_cols.py
  3. 18
      account_financial_report/report/account_balance_4_cols.py
  4. 4
      account_financial_report/report/balance_full.rml
  5. 24
      account_financial_report/wizard/account_report_wizard.xml
  6. 6
      account_financial_report/wizard/wizard_account_balance_2_report.py
  7. 6
      account_financial_report/wizard/wizard_account_balance_4_report.py
  8. 10
      account_financial_report/wizard/wizard_account_balance_report.py

15
account_financial_report/report/account_balance.py

@ -107,12 +107,12 @@ class account_balance(report_sxw.rml_parse):
periods_str = None periods_str = None
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid)
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)])
if form['state'] in ['byperiod', 'all']:
if form['filter'] in ['byperiod', 'all']:
period_ids = form['periods'] period_ids = form['periods']
periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)])
dates_str = None dates_str = None
if form['state'] in ['bydate', 'all']:
if form['filter'] in ['bydate', 'all']:
dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' '
return {'periods':periods_str, 'date':dates_str} return {'periods':periods_str, 'date':dates_str}
@ -184,13 +184,12 @@ class account_balance(report_sxw.rml_parse):
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),'|',('special','=',False),('date_stop','<',fiscalyear.date_stop)]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),'|',('special','=',False),('date_stop','<',fiscalyear.date_stop)])
else: else:
# Use all the open fiscal years # Use all the open fiscal years
open_fiscalyear_ids = fiscalyear_obj.search(self.cr, self.uid, [('state','=','draft')])
open_fiscalyear_ids = fiscalyear_obj.search(self.cr, self.uid, [('filter','=','draft')])
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','in',open_fiscalyear_ids),'|',('special','=',False),('date_stop','<',fiscalyear.date_stop)]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','in',open_fiscalyear_ids),'|',('special','=',False),('date_stop','<',fiscalyear.date_stop)])
fy_balance = {} fy_balance = {}
for acc in account_obj.read(self.cr, self.uid, [x[0] for x in account_ids], ['balance'], ctx): for acc in account_obj.read(self.cr, self.uid, [x[0] for x in account_ids], ['balance'], ctx):
fy_balance[acc['id']] = acc['balance'] fy_balance[acc['id']] = acc['balance']
# #
# Calculate the FY Debit/Credit # Calculate the FY Debit/Credit
# (from full fiscal year without opening or closing periods) # (from full fiscal year without opening or closing periods)
@ -204,12 +203,12 @@ class account_balance(report_sxw.rml_parse):
# (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 = self.context.copy() ctx = self.context.copy()
ctx['state'] = form.get('state','all')
ctx['filter'] = form.get('filter','all')
ctx['fiscalyear'] = fiscalyear.id ctx['fiscalyear'] = fiscalyear.id
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id)]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id)])
if form['state'] in ['byperiod', 'all']:
if form['filter'] in ['byperiod', 'all']:
ctx['periods'] = form['periods'] ctx['periods'] = form['periods']
if form['state'] in ['bydate', 'all']:
if form['filter'] in ['bydate', 'all']:
ctx['date_from'] = form['date_from'] ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to'] ctx['date_to'] = form['date_to']
@ -217,6 +216,7 @@ class account_balance(report_sxw.rml_parse):
val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx)
c = 0 c = 0
for aa_id in account_ids: for aa_id in account_ids:
print '%s %s \n'%(val[c].name,val[c].balance)
new_acc = { new_acc = {
'id' :val[c].id, 'id' :val[c].id,
'type' :val[c].type, 'type' :val[c].type,
@ -294,6 +294,7 @@ class account_balance(report_sxw.rml_parse):
if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot): if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot):
tot[res['id']] = True tot[res['id']] = True
tot_eje += res['balance'] tot_eje += res['balance']
print 'tot_eje',tot_eje
if form['tot_check']: if form['tot_check']:
str_label = form['lab_str'] str_label = form['lab_str']
res2 = { res2 = {

10
account_financial_report/report/account_balance_2_cols.py

@ -108,12 +108,12 @@ class account_balance(report_sxw.rml_parse):
periods_str = None periods_str = None
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid)
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)])
if form['state'] in ['byperiod', 'all']:
if form['filter'] in ['byperiod', 'all']:
period_ids = form['periods'] period_ids = form['periods']
periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)])
dates_str = None dates_str = None
if form['state'] in ['bydate', 'all']:
if form['filter'] in ['bydate', 'all']:
dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' '
return {'periods':periods_str, 'date':dates_str} return {'periods':periods_str, 'date':dates_str}
@ -180,13 +180,13 @@ class account_balance(report_sxw.rml_parse):
# #
ctx = self.context.copy() ctx = self.context.copy()
ctx['state'] = form.get('state','all')
ctx['filter'] = form.get('filter','all')
ctx['fiscalyear'] = fiscalyear.id ctx['fiscalyear'] = fiscalyear.id
ctx['periods'] = form.get('periods') ctx['periods'] = form.get('periods')
if form['state'] in ['byperiod', 'all']:
if form['filter'] in ['byperiod', 'all']:
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])])
ctx['periods'] = ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) ctx['periods'] = ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)])
if form['state'] in ['bydate', 'all']:
if form['filter'] in ['bydate', 'all']:
ctx['date_from'] = form['date_from'] ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to'] ctx['date_to'] = form['date_to']

18
account_financial_report/report/account_balance_4_cols.py

@ -108,12 +108,12 @@ class account_balance(report_sxw.rml_parse):
periods_str = None periods_str = None
fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid)
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)])
if form['state'] in ['byperiod', 'all']:
if form['filter'] in ['byperiod', 'all']:
period_ids = form['periods'] period_ids = form['periods']
periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)])
dates_str = None dates_str = None
if form['state'] in ['bydate', 'all']:
if form['filter'] in ['bydate', 'all']:
dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' ' dates_str = self.formatLang(form['date_from'], date=True) + ' - ' + self.formatLang(form['date_to'], date=True) + ' '
return {'periods':periods_str, 'date':dates_str} return {'periods':periods_str, 'date':dates_str}
@ -186,12 +186,12 @@ class account_balance(report_sxw.rml_parse):
############################################################################# #############################################################################
ctx = self.context.copy() ctx = self.context.copy()
ctx['state'] = form.get('state','all')
ctx['filter'] = form.get('filter','all')
ctx['fiscalyear'] = fiscalyear.id ctx['fiscalyear'] = fiscalyear.id
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)])
if form['state'] in ['byperiod', 'all']:
if form['filter'] in ['byperiod', 'all']:
ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)])
if form['state'] in ['bydate', 'all']:
if form['filter'] in ['bydate', 'all']:
ctx['date_from'] = form['date_from'] ctx['date_from'] = form['date_from']
ctx['date_to'] = form['date_to'] ctx['date_to'] = form['date_to']
@ -227,20 +227,20 @@ class account_balance(report_sxw.rml_parse):
############################################################################# #############################################################################
ctx = self.context.copy() ctx = self.context.copy()
ctx['state'] = form.get('state','all')
ctx['filter'] = form.get('filter','all')
ctx['fiscalyear'] = fiscalyear.id ctx['fiscalyear'] = fiscalyear.id
if form['state'] in ['byperiod', 'all']:
if form['filter'] in ['byperiod', 'all']:
ctx['periods'] = form['periods'] ctx['periods'] = form['periods']
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])])
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)])
if not ctx['periods']: if not ctx['periods']:
missing_period() missing_period()
elif form['state'] in ['bydate']:
elif form['filter'] in ['bydate']:
ctx['date_from'] = fiscalyear.date_start ctx['date_from'] = fiscalyear.date_start
ctx['date_to'] = form['date_from'] ctx['date_to'] = form['date_from']
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',ctx['date_to'])])
elif form['state'] == 'none':
elif form['filter'] == 'none':
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',True)])
date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])])
ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_start','<=',date_start),('special','=',True)])

4
account_financial_report/report/balance_full.rml

@ -108,7 +108,7 @@
<para style="TITLES">Cuenta</para> <para style="TITLES">Cuenta</para>
</td> </td>
<td> <td>
<para style="TITLE_LEFT_ALIGN"></para>
<para style="TITLE_LEFT_ALIGN">Balance</para>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -127,7 +127,7 @@
<td> <td>
<para style="TITLE_LEFT_ALIGN"> <para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font> <font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(a['balance']) or '']]</font>
<font>[[(a['total']==True) and formatLang(a['balance']) or '']]</font>
</para> </para>
</td> </td>
</tr> </tr>

24
account_financial_report/wizard/account_report_wizard.xml

@ -22,16 +22,16 @@
<separator string="Period" colspan="4"/> <separator string="Period" colspan="4"/>
<field name="fiscalyear"/> <field name="fiscalyear"/>
<newline/> <newline/>
<field name="state" required="True"/>
<field name="filter" required="True"/>
<newline/> <newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','none')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/> <separator string="Date Filter" colspan="4"/>
<field name="date_from"/> <field name="date_from"/>
<field name="date_to"/> <field name="date_to"/>
</group> </group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/> <separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/>
</group> </group>
@ -87,15 +87,15 @@
<separator string="Period" colspan="4"/> <separator string="Period" colspan="4"/>
<field name="fiscalyear"/> <field name="fiscalyear"/>
<newline/> <newline/>
<field name="state" required="True"/>
<field name="filter" required="True"/>
<newline/> <newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','none')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/> <separator string="Date Filter" colspan="4"/>
<field name="date_from"/> <field name="date_from"/>
<field name="date_to"/> <field name="date_to"/>
</group> </group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/> <separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/>
</group> </group>
@ -149,15 +149,15 @@
<separator string="Period" colspan="4"/> <separator string="Period" colspan="4"/>
<field name="fiscalyear"/> <field name="fiscalyear"/>
<newline/> <newline/>
<field name="state" required="True"/>
<field name="filter" required="True"/>
<newline/> <newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','none')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/> <separator string="Date Filter" colspan="4"/>
<field name="date_from"/> <field name="date_from"/>
<field name="date_to"/> <field name="date_to"/>
</group> </group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<group attrs="{'invisible':[('filter','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/> <separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/> <field name="periods" colspan="4" nolabel="1" domain="[('fiscalyear_id','=',fiscalyear)]"/>
</group> </group>

6
account_financial_report/wizard/wizard_account_balance_2_report.py

@ -35,7 +35,7 @@ class wizard_account_balance_gene_2(osv.osv_memory):
_columns = { _columns = {
'company_id': fields.many2one('res.company','Company',required=True), 'company_id': fields.many2one('res.company','Company',required=True),
'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True),
'state': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True),
'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'),
'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'), 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'),
@ -50,7 +50,7 @@ class wizard_account_balance_gene_2(osv.osv_memory):
_defaults = { _defaults = {
'date_from': lambda *a: time.strftime('%Y-%m-%d'), 'date_from': lambda *a: time.strftime('%Y-%m-%d'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'), 'date_to': lambda *a: time.strftime('%Y-%m-%d'),
'state': lambda *a:'byperiod',
'filter': lambda *a:'byperiod',
'display_account_level': lambda *a: 0, 'display_account_level': lambda *a: 0,
'inf_type': lambda *a:'bcom', 'inf_type': lambda *a:'bcom',
'company_id': lambda *a: 1, 'company_id': lambda *a: 1,
@ -77,7 +77,7 @@ class wizard_account_balance_gene_2(osv.osv_memory):
def _check_state(self, cr, uid, data, context=None): def _check_state(self, cr, uid, data, context=None):
if context is None: if context is None:
context = {} context = {}
if data['form']['state'] == 'bydate':
if data['form']['filter'] == 'bydate':
self._check_date(cr, uid, data, context) self._check_date(cr, uid, data, context)
return data['form'] return data['form']

6
account_financial_report/wizard/wizard_account_balance_4_report.py

@ -8,7 +8,7 @@ class wizard_report(osv.osv_memory):
_columns = { _columns = {
'company_id': fields.many2one('res.company','Company',required=True), 'company_id': fields.many2one('res.company','Company',required=True),
'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True),
'state': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True),
'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'),
'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'), 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'),
@ -23,7 +23,7 @@ class wizard_report(osv.osv_memory):
_defaults = { _defaults = {
'date_from': lambda *a: time.strftime('%Y-%m-%d'), 'date_from': lambda *a: time.strftime('%Y-%m-%d'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'), 'date_to': lambda *a: time.strftime('%Y-%m-%d'),
'state': lambda *a:'byperiod',
'filter': lambda *a:'byperiod',
'display_account_level': lambda *a: 0, 'display_account_level': lambda *a: 0,
'inf_type': lambda *a:'bcom', 'inf_type': lambda *a:'bcom',
'company_id': lambda *a: 1, 'company_id': lambda *a: 1,
@ -50,7 +50,7 @@ class wizard_report(osv.osv_memory):
def _check_state(self, cr, uid, data, context=None): def _check_state(self, cr, uid, data, context=None):
if context is None: if context is None:
context = {} context = {}
if data['form']['state'] == 'bydate':
if data['form']['filter'] == 'bydate':
self._check_date(cr, uid, data, context) self._check_date(cr, uid, data, context)
return data['form'] return data['form']

10
account_financial_report/wizard/wizard_account_balance_report.py

@ -30,13 +30,14 @@
from osv import osv,fields from osv import osv,fields
import pooler import pooler
import time import time
class wizard_account_balance_gene(osv.osv_memory): class wizard_account_balance_gene(osv.osv_memory):
_name = "wizard.report.account.balance.gene" _name = "wizard.report.account.balance.gene"
_columns = { _columns = {
'company_id': fields.many2one('res.company','Company',required=True), 'company_id': fields.many2one('res.company','Company',required=True),
'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True), 'account_list': fields.many2many ('account.account','rel_wizard_account','account_list','account_id','Root accounts',required=True),
'state': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'filter': fields.selection([('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],'Date/Period Filter'),
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True), 'fiscalyear': fields.many2one('account.fiscalyear','Fiscal year',help='Keep empty to use all open fiscal years to compute the balance',required=True),
'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'), 'periods': fields.many2many('account.period','rel_wizard_period','wizard_id','period_id','Periods',help='All periods in the fiscal year if empty'),
'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'), 'display_account': fields.selection([('bal_all','All'),('bal_solde', 'With balance'),('bal_mouvement','With movements')],'Display accounts'),
@ -51,7 +52,7 @@ class wizard_account_balance_gene(osv.osv_memory):
_defaults = { _defaults = {
'date_from': lambda *a: time.strftime('%Y-%m-%d'), 'date_from': lambda *a: time.strftime('%Y-%m-%d'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'), 'date_to': lambda *a: time.strftime('%Y-%m-%d'),
'state': lambda *a:'byperiod',
'filter': lambda *a:'byperiod',
'display_account_level': lambda *a: 0, 'display_account_level': lambda *a: 0,
'inf_type': lambda *a:'bcom', 'inf_type': lambda *a:'bcom',
'company_id': lambda *a: 1, 'company_id': lambda *a: 1,
@ -78,7 +79,7 @@ class wizard_account_balance_gene(osv.osv_memory):
def _check_state(self, cr, uid, data, context=None): def _check_state(self, cr, uid, data, context=None):
if context is None: if context is None:
context = {} context = {}
if data['form']['state'] == 'bydate':
if data['form']['filter'] == 'bydate':
self._check_date(cr, uid, data, context) self._check_date(cr, uid, data, context)
return data['form'] return data['form']
@ -106,6 +107,9 @@ class wizard_account_balance_gene(osv.osv_memory):
data['ids'] = context.get('active_ids', []) data['ids'] = context.get('active_ids', [])
data['model'] = context.get('active_model', 'ir.ui.menu') data['model'] = context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(cr, uid, ids[0]) data['form'] = self.read(cr, uid, ids[0])
print 'data',data
return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene', 'datas': data} return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance.gene', 'datas': data}
wizard_account_balance_gene() wizard_account_balance_gene()

Loading…
Cancel
Save