[ADD,MOD] account : account_compare_account_balance_report wizard converted to osv memory wizard
bzr revid: vir@tinyerp.com-20100423122744-7a25ap724xppfsxx
This commit is contained in:
@@ -76,6 +76,7 @@ module named account_voucherss
|
||||
'wizard/account_balance_report_view.xml',
|
||||
'wizard/account_move_line_select_view.xml',
|
||||
'wizard/account_aged_trial_balance_view.xml',
|
||||
'wizard/account_compare_account_balance_report_view.xml',
|
||||
'wizard/account_third_party_ledger.xml',
|
||||
'project/wizard/project_account_analytic_line_view.xml',
|
||||
'account_view.xml',
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard
|
||||
string="Account balance-Compare Years"
|
||||
model="account.account"
|
||||
name="account.balance.account.balance.report"
|
||||
keyword="client_print_multi"
|
||||
id="wizard_account_balance_compare_report"/>
|
||||
<!-- <wizard-->
|
||||
<!-- string="Account balance-Compare Years"-->
|
||||
<!-- model="account.account"-->
|
||||
<!-- name="account.balance.account.balance.report"-->
|
||||
<!-- keyword="client_print_multi"-->
|
||||
<!-- id="wizard_account_balance_compare_report"/>-->
|
||||
|
||||
<!-- <wizard id="wizard_invoice_refund" model="account.invoice" name="account.invoice.refund" string="Credit Note" groups="base.group_user"/> -->
|
||||
|
||||
|
||||
@@ -368,15 +368,15 @@ class account_balance_landscape(rml_parse.rml_parse):
|
||||
self.total_for_perc=self.linesForTotal(form,ids={},doneAccount={},level=1)
|
||||
self.done_total=0
|
||||
|
||||
for t1 in range(0,len(form['fiscalyear'][0][2])):
|
||||
for t1 in range(0,len(form['fiscalyear'])):
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
self.result_total["sum_credit" + str(t1)]=locale.format("%.2f", self.result_total["sum_credit" + str(t1)], grouping=True)
|
||||
self.result_total["sum_debit" + str(t1)]=locale.format("%.2f", self.result_total["sum_debit" + str(t1)], grouping=True)
|
||||
# self.flag=1
|
||||
# self.result_total = {}
|
||||
|
||||
for temp in range(0,len(form['fiscalyear'][0][2])):
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
|
||||
for temp in range(0,len(form['fiscalyear'])):
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
|
||||
years["year"+str(temp)]=fy[0][1][12:16]
|
||||
|
||||
return [years]
|
||||
@@ -396,11 +396,11 @@ class account_balance_landscape(rml_parse.rml_parse):
|
||||
ctx = self.context.copy()
|
||||
result_total_parent=[]
|
||||
|
||||
for id in form['fiscalyear'][0][2]:
|
||||
for id in form['fiscalyear']:
|
||||
tmp=[]
|
||||
|
||||
ctx['fiscalyear'] = id
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['periods'] = form['periods']
|
||||
ctx['period_manner'] = form['period_manner']
|
||||
ctx['state'] = form['context'].get('state','all')
|
||||
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
|
||||
@@ -456,10 +456,10 @@ class account_balance_landscape(rml_parse.rml_parse):
|
||||
result = []
|
||||
ctx = self.context.copy()
|
||||
tmp1=[]
|
||||
for id in form['fiscalyear'][0][2]:
|
||||
for id in form['fiscalyear']:
|
||||
|
||||
ctx['fiscalyear'] = id
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['periods'] = form['periods']
|
||||
ctx['period_manner']=form['period_manner']
|
||||
ctx['state'] = form['context'].get('state','all')
|
||||
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids,ctx.copy())
|
||||
@@ -575,7 +575,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
||||
|
||||
if entry[0].child_id:
|
||||
|
||||
for q in range(0,len(form['fiscalyear'][0][2])):
|
||||
for q in range(0,len(form['fiscalyear'])):
|
||||
self.baldiv["baldiv"+str(level)+str(q)]=entry[q].balance
|
||||
|
||||
ids2 = [(x.code,x.id) for x in entry[0].child_id]
|
||||
@@ -583,7 +583,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
||||
dir=[]
|
||||
dir += self.lines(form, [x[1] for x in ids2], done, level+1)
|
||||
if dir==[]:
|
||||
for w in range(0,len(form['fiscalyear'][0][2])):
|
||||
for w in range(0,len(form['fiscalyear'])):
|
||||
if entry[w].credit <> 0.0 or entry[w].debit <> 0.0 or entry[w].balance<>0.00:
|
||||
dont_pop=1
|
||||
break
|
||||
@@ -601,9 +601,9 @@ class account_balance_landscape(rml_parse.rml_parse):
|
||||
def get_years(self,form):
|
||||
result =[]
|
||||
res={}
|
||||
for temp in range(0,len(form['fiscalyear'][0][2])):
|
||||
for temp in range(0,len(form['fiscalyear'])):
|
||||
res={}
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
|
||||
res['year']=fy[0][1]
|
||||
res['last_str']=temp
|
||||
|
||||
|
||||
@@ -368,15 +368,15 @@ class account_balance(report_sxw.rml_parse):
|
||||
self.total_for_perc=self.linesForTotal(form,ids={},doneAccount={},level=1)
|
||||
self.done_total=0
|
||||
|
||||
for t1 in range(0,len(form['fiscalyear'][0][2])):
|
||||
for t1 in range(0,len(form['fiscalyear'])):
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
self.result_total["sum_credit" + str(t1)]=locale.format("%.2f", self.result_total["sum_credit" + str(t1)], grouping=True)
|
||||
self.result_total["sum_debit" + str(t1)]=locale.format("%.2f", self.result_total["sum_debit" + str(t1)], grouping=True)
|
||||
# self.flag=1
|
||||
# self.result_total = {}
|
||||
|
||||
for temp in range(0,len(form['fiscalyear'][0][2])):
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
|
||||
for temp in range(0,len(form['fiscalyear'])):
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
|
||||
years["year"+str(temp)]=fy[0][1][12:16]
|
||||
|
||||
return [years]
|
||||
@@ -395,11 +395,11 @@ class account_balance(report_sxw.rml_parse):
|
||||
ctx = self.context.copy()
|
||||
result_total_parent=[]
|
||||
|
||||
for id in form['fiscalyear'][0][2]:
|
||||
for id in form['fiscalyear']:
|
||||
tmp=[]
|
||||
|
||||
ctx['fiscalyear'] = id
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['periods'] = form['periods']
|
||||
ctx['period_manner'] = form['period_manner']
|
||||
ctx['state'] = form['context'].get('state','all')
|
||||
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
|
||||
@@ -453,10 +453,10 @@ class account_balance(report_sxw.rml_parse):
|
||||
result = []
|
||||
ctx = self.context.copy()
|
||||
tmp1=[]
|
||||
for id in form['fiscalyear'][0][2]:
|
||||
for id in form['fiscalyear']:
|
||||
|
||||
ctx['fiscalyear'] = id
|
||||
ctx['periods'] = form['periods'][0][2]
|
||||
ctx['periods'] = form['periods']
|
||||
ctx['period_manner']=form['period_manner']
|
||||
ctx['state'] = form['context'].get('state','all')
|
||||
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids,ctx.copy())
|
||||
@@ -571,7 +571,7 @@ class account_balance(report_sxw.rml_parse):
|
||||
|
||||
if entry[0].child_id:
|
||||
|
||||
for q in range(0,len(form['fiscalyear'][0][2])):
|
||||
for q in range(0,len(form['fiscalyear'])):
|
||||
self.baldiv["baldiv"+str(level)+str(q)]=entry[q].balance
|
||||
|
||||
ids2 = [(x.code,x.id) for x in entry[0].child_id]
|
||||
@@ -579,7 +579,7 @@ class account_balance(report_sxw.rml_parse):
|
||||
dir=[]
|
||||
dir += self.lines(form, [x[1] for x in ids2], done, level+1)
|
||||
if dir==[]:
|
||||
for w in range(0,len(form['fiscalyear'][0][2])):
|
||||
for w in range(0,len(form['fiscalyear'])):
|
||||
if entry[w].credit <> 0.0 or entry[w].debit <> 0.0 or entry[w].balance<>0.00:
|
||||
dont_pop=1
|
||||
break
|
||||
@@ -597,9 +597,9 @@ class account_balance(report_sxw.rml_parse):
|
||||
def get_years(self,form):
|
||||
result =[]
|
||||
res={}
|
||||
for temp in range(0,len(form['fiscalyear'][0][2])):
|
||||
for temp in range(0,len(form['fiscalyear'])):
|
||||
res={}
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
|
||||
res['year']=fy[0][1]
|
||||
res['last_str']=temp
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import account_fiscalyear_close_state
|
||||
import account_vat
|
||||
import account_open_closed_fiscalyear
|
||||
|
||||
import wizard_compare_account_balance_report
|
||||
import account_compare_account_balance_report
|
||||
import account_invoice_state
|
||||
import account_chart
|
||||
import account_move_line_select
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class account_compare_account_balance_report(osv.osv_memory):
|
||||
"""
|
||||
This wizard will provide the account balance comparision report by fiscal years.
|
||||
"""
|
||||
_name = 'account.compare.account.balance.report'
|
||||
_description = 'Account Balance Report'
|
||||
_columns = {
|
||||
'fiscalyear': fields.many2many('account.fiscalyear', 'account_fiscalyear_rel','account_id','fiscalyear_id','Fiscal year', help='Keep empty for all open fiscal year'),
|
||||
'select_account': fields.many2one('account.account','Select Reference Account(for % comparision)',help='Keep empty for comparision to its parent'),
|
||||
'account_choice': fields.selection([('all','All accounts'),
|
||||
('bal_zero','With balance is not equal to 0'),
|
||||
('moves','With movements')],'Show Accounts'),
|
||||
'show_columns': fields.boolean('Show Debit/Credit Information'),
|
||||
'landscape': fields.boolean('Show Report in Landscape Form'),
|
||||
'format_perc': fields.boolean('Show Comparision in %'),
|
||||
'compare_pattern': fields.selection([('bal_cash','Cash'),
|
||||
('bal_perc','Percentage'),
|
||||
('none','Don'+ "'" +'t Compare')],'Compare Selected Years In Terms Of'),
|
||||
'period_manner': fields.selection([('actual','Financial Period'),('created','Creation Date')],'Entries Selection Based on'),
|
||||
'periods': fields.many2many('account.period', 'period_account_balance_rel',
|
||||
'report_id', 'period_id', 'Periods',
|
||||
help='Keep empty for all open fiscal year'),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'compare_pattern': 'none',
|
||||
'account_choice': 'moves',
|
||||
'period_manner': 'actual',
|
||||
}
|
||||
|
||||
def check(self, cr, uid, ids, context=None):
|
||||
data={}
|
||||
if context is None:
|
||||
context = {}
|
||||
data = {
|
||||
'ids':context['active_ids'],
|
||||
'form': self.read(cr, uid, ids, ['fiscalyear', 'select_account', 'account_choice', 'periods', 'show_columns', 'landscape', 'format_perc','compare_pattern','period_manner'])[0],
|
||||
}
|
||||
|
||||
data['form']['context'] = context
|
||||
if (len(data['form']['fiscalyear'])==0) or (len(data['form']['fiscalyear'])>1 and (data['form']['compare_pattern']!='none') and (data['form']['format_perc']==1) and (data['form']['show_columns']==1) and (data['form']['landscape']!=1)):
|
||||
raise osv.except_osv(_('Warning !'), _('You have to select at least 1 Fiscal Year. \nYou may have selected the compare options with more than 1 year with credit/debit columns and % option.This can lead contents to be printed out of the paper.Please try again.'))
|
||||
|
||||
|
||||
if ((len(data['form']['fiscalyear'])==3) and (data['form']['format_perc']!=1) and (data['form']['show_columns']!=1)):
|
||||
if data['form']['landscape']==1:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.balance.account.balance',
|
||||
'datas': data,
|
||||
}
|
||||
if data['form']['format_perc']==1:
|
||||
if len(data['form']['fiscalyear'])<=2:
|
||||
if data['form']['landscape']==1:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.balance.account.balance',
|
||||
'datas': data,
|
||||
}
|
||||
else:
|
||||
if len(data['form']['fiscalyear'])==3:
|
||||
if data['form']['landscape']==1:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
|
||||
else:
|
||||
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
|
||||
else:
|
||||
if len(data['form']['fiscalyear'])>2:
|
||||
if data['form']['landscape']==1:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
|
||||
else:
|
||||
if data['form']['landscape']==1:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.account.balance.landscape',
|
||||
'datas': data,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.balance.account.balance',
|
||||
'datas': data,
|
||||
}
|
||||
account_compare_account_balance_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_compare_account_balance_report_view" model="ir.ui.view">
|
||||
<field name="name">account.compare.account.balance.report.form</field>
|
||||
<field name="model">account.compare.account.balance.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Customize Report">
|
||||
<notebook tabpos="up">
|
||||
<page string="Report Options">
|
||||
<separator string="Select Fiscal Year(s)(Maximum Three Years)" colspan="4"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
|
||||
<field name="fiscalyear" colspan="5" nolabel="1"/>
|
||||
<field name="landscape" colspan="4"/>
|
||||
<field name="show_columns" colspan="4"/>
|
||||
<field name="format_perc" colspan="4"/>
|
||||
<field name="select_account" colspan="4"/>
|
||||
<field name="account_choice" colspan="4"/>
|
||||
<field name="compare_pattern" colspan="4"/>
|
||||
|
||||
</page>
|
||||
|
||||
<page string="Select Period">
|
||||
<field name="period_manner" colspan="4"/>
|
||||
<separator string="Select Period(s)" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
<newline/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check" string="Print" type="object" icon="gtk-print" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Account balance-Compare Years"
|
||||
res_model="account.compare.account.balance.report"
|
||||
src_model="account.account"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_account_compare_account_balance_report"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,175 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import ir
|
||||
import pooler
|
||||
import time
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
import mx.DateTime
|
||||
from mx.DateTime import RelativeDateTime
|
||||
|
||||
from tools import config
|
||||
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Customize Report">
|
||||
<notebook tabpos="up">
|
||||
<page string="Report Options">
|
||||
<separator string="Select Fiscal Year(s)(Maximum Three Years)" colspan="4"/>
|
||||
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
|
||||
<field name="fiscalyear" colspan="5" nolabel="1"/>
|
||||
<field name="landscape" colspan="4"/>
|
||||
<field name="show_columns" colspan="4"/>
|
||||
<field name="format_perc" colspan="4"/>
|
||||
<field name="select_account" colspan="4"/>
|
||||
<field name="account_choice" colspan="4"/>
|
||||
<field name="compare_pattern" colspan="4"/>
|
||||
|
||||
</page>
|
||||
|
||||
<page string="Select Period">
|
||||
<field name="period_manner" colspan="4"/>
|
||||
<separator string="Select Period(s)" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>'''
|
||||
|
||||
dates_fields = {
|
||||
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2many', 'relation': 'account.fiscalyear'},
|
||||
'select_account': {'string': 'Select Reference Account(for % comparision)', 'type': 'many2one', 'relation': 'account.account','help': 'Keep empty for comparision to its parent'},
|
||||
'account_choice': {'string': 'Show Accounts', 'type': 'selection','selection':[('all','All accounts'),('bal_zero','With balance is not equal to 0'),('moves','With movements')]},
|
||||
'show_columns': {'string': 'Show Debit/Credit Information', 'type': 'boolean'},
|
||||
'landscape': {'string': 'Show Report in Landscape Form', 'type': 'boolean'},
|
||||
'format_perc': {'string': 'Show Comparision in %', 'type': 'boolean'},
|
||||
'compare_pattern':{'string':"Compare Selected Years In Terms Of",'type':'selection','selection':[('bal_cash','Cash'),('bal_perc','Percentage'),('none','Don'+ "'" +'t Compare')]},
|
||||
'period_manner':{'string':"Entries Selection Based on",'type':'selection','selection':[('actual','Financial Period'),('created','Creation Date')]},
|
||||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'}
|
||||
}
|
||||
|
||||
back_form='''<?xml version="1.0"?>
|
||||
<form string="Notification">
|
||||
<separator string="You might have done following mistakes. Please correct them and try again." colspan="4"/>
|
||||
<separator string="1. You have selected more than 3 years in any case." colspan="4"/>
|
||||
<separator string="2. You have not selected 'Percentage' option, but you have selected more than 2 years." colspan="4"/>
|
||||
<label string="You can select maximum 3 years. Please check again." colspan="4"/>
|
||||
<separator string="3. You have selected 'Percentage' option with more than 2 years, but you have not selected landscape format." colspan="4"/>
|
||||
<label string="You have to select 'Landscape' option. Please Check it." colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
back_fields={
|
||||
}
|
||||
|
||||
zero_form='''<?xml version="1.0"?>
|
||||
<form string="Notification">
|
||||
<separator string="You have to select at least 1 Fiscal Year. Try again." colspan="4"/>
|
||||
<label string="You may have selected the compare options with more than 1 year with credit/debit columns and % option.This can lead contents to be printed out of the paper.Please try again."/>
|
||||
</form>'''
|
||||
|
||||
zero_fields={
|
||||
}
|
||||
|
||||
def _check(self, cr, uid, data, context):
|
||||
if (len(data['form']['fiscalyear'][0][2])==0) or (len(data['form']['fiscalyear'][0][2])>1 and (data['form']['compare_pattern']!='none') and (data['form']['format_perc']==1) and (data['form']['show_columns']==1) and (data['form']['landscape']!=1)):
|
||||
return 'zero_years'
|
||||
|
||||
if ((len(data['form']['fiscalyear'][0][2])==3) and (data['form']['format_perc']!=1) and (data['form']['show_columns']!=1)):
|
||||
if data['form']['landscape']==1:
|
||||
return 'report_landscape'
|
||||
else:
|
||||
return 'report'
|
||||
|
||||
|
||||
if data['form']['format_perc']==1:
|
||||
if len(data['form']['fiscalyear'][0][2])<=2:
|
||||
if data['form']['landscape']==1:
|
||||
return 'report_landscape'
|
||||
else:
|
||||
return 'report'
|
||||
else:
|
||||
if len(data['form']['fiscalyear'][0][2])==3:
|
||||
if data['form']['landscape']==1:
|
||||
return 'report_landscape'
|
||||
else:
|
||||
return 'backtoinit'
|
||||
else:
|
||||
return 'backtoinit'
|
||||
|
||||
else:
|
||||
if len(data['form']['fiscalyear'][0][2])>2:
|
||||
if data['form']['landscape']==1:
|
||||
return 'report_landscape'
|
||||
else:
|
||||
return 'backtoinit'
|
||||
else:
|
||||
if data['form']['landscape']==1:
|
||||
return 'report_landscape'
|
||||
else:
|
||||
return 'report'
|
||||
|
||||
|
||||
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
def _get_defaults(self, cr, uid, data, context={}):
|
||||
data['form']['context'] = context
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
data['form']['fiscalyear']=[fiscalyear_obj.find(cr, uid)]
|
||||
# p_ids=pooler.get_pool(cr.dbname).get('account.period').search(cr,uid,[('fiscalyear_id','=',fiscalyear_obj.find(cr, uid))])
|
||||
# data['form']['periods']=p_ids
|
||||
data['form']['compare_pattern']='none'
|
||||
data['form']['account_choice']='moves'
|
||||
data['form']['period_manner']='actual'
|
||||
return data['form']
|
||||
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel', 'gtk-cancel'),('checkyear','Print', 'gtk-ok')]}
|
||||
},
|
||||
'backtoinit': {
|
||||
'actions': [],
|
||||
'result': {'type':'form','arch':back_form,'fields':back_fields,'state':[('end','Ok')]}
|
||||
},
|
||||
'zero_years': {
|
||||
'actions': [],
|
||||
'result': {'type':'form','arch':zero_form,'fields':zero_fields,'state':[('end','Ok')]}
|
||||
},
|
||||
'checkyear': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check}
|
||||
},
|
||||
'report_landscape': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'account.account.balance.landscape', 'state':'end'}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'account.balance.account.balance', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('account.balance.account.balance.report')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user