[IMP] survey :- convert simple wizard survey.print.statistics in osv_memory wizard
bzr revid: ysa@tinyerp.co.in-20100322065837-y0jfmp04v227db48
This commit is contained in:
parent
50005078fc
commit
dec4f76f84
|
@ -32,7 +32,13 @@
|
|||
""",
|
||||
'author': 'Tiny',
|
||||
'depends': ['base'],
|
||||
'update_xml': ['survey_report.xml','survey_data.xml','survey_que_wizard.xml','survey_wizard.xml','survey_view.xml','security/ir.model.access.csv'],
|
||||
'update_xml': ['survey_report.xml',
|
||||
'survey_data.xml',
|
||||
'survey_que_wizard.xml',
|
||||
'survey_wizard.xml',
|
||||
'survey_view.xml',
|
||||
'security/ir.model.access.csv'
|
||||
,'wizard/survey_print_statistics.xml'],
|
||||
'demo_xml': ['survey_demo.xml'],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -102,7 +102,7 @@ class survey_analysis(report_rml):
|
|||
</para>"""
|
||||
surv_obj = pooler.get_pool(cr.dbname).get('survey')
|
||||
if datas.has_key('form') and datas['form']['survey_ids']:
|
||||
ids = datas['form']['survey_ids'][0][2]
|
||||
ids = datas['form']['survey_ids']
|
||||
|
||||
for survey in surv_obj.browse(cr, uid, ids):
|
||||
rml += """<blockTable colWidths="280.0,100.0,120.0" style="Table_heading">
|
||||
|
|
|
@ -9,14 +9,18 @@
|
|||
menu="False"
|
||||
string="Survey Form"/>
|
||||
|
||||
<report auto="True" id="survey_analysis" model="survey"
|
||||
name="survey.analysis"
|
||||
rml=""
|
||||
string="Print Survey Statistics"/>
|
||||
<report auto="True"
|
||||
id="survey_analysis"
|
||||
model="survey"
|
||||
name="survey.analysis"
|
||||
rml=""
|
||||
string="Print Survey Statistics"/>
|
||||
|
||||
<report auto="True" id="survey_browse_response" model="survey"
|
||||
name="survey.browse.response"
|
||||
rml=""
|
||||
string="Print Answers"/>
|
||||
<report auto="True"
|
||||
id="survey_browse_response"
|
||||
model="survey"
|
||||
name="survey.browse.response"
|
||||
rml=""
|
||||
string="Print Answers"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1161,7 +1161,5 @@
|
|||
<menuitem action="wizard_browse_answer" id="menu_wizard_browse_answer"
|
||||
parent="menu_reporting" type="wizard" icon="STOCK_PRINT" groups="group_survey_manager"/>
|
||||
|
||||
<menuitem action="wizard_print_survey_statistics" id="menu_wizard_print_survey_statistics"
|
||||
parent="menu_reporting" type="wizard" icon="STOCK_PRINT" groups="group_survey_manager"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -23,6 +23,6 @@
|
|||
import wizard_survey
|
||||
import wizard_print_survey
|
||||
import wizard_browse_answer
|
||||
import wizard_print_survey_statistics
|
||||
import survey_print_statistics
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -20,33 +20,27 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import time
|
||||
import pooler
|
||||
from random import choice
|
||||
import string
|
||||
import tools
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
_survey_form = '''<?xml version="1.0"?>
|
||||
<form string="Print Survey Statistics">
|
||||
<field name="survey_ids" colspan="4" nolabel="1"/>
|
||||
</form>'''
|
||||
|
||||
_survey_fields = {
|
||||
'survey_ids': {'string': 'Survey', 'type': 'many2many', 'relation': 'survey','required':'1'},
|
||||
class survey_print_statistics(osv.osv_memory):
|
||||
_name = 'survey.print.statistics'
|
||||
_columns = {
|
||||
'survey_ids': fields.many2many('survey','survey_print_statistics','survey_id','print_id', "Survey", required="1"),
|
||||
}
|
||||
|
||||
class print_survey_statistics_wizard(wizard.interface):
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'form', 'arch' :_survey_form, 'fields' :_survey_fields,\
|
||||
'state' : [('end', 'Cancel', 'gtk-cancel'), ('print', 'Print', 'gtk-print')]}
|
||||
},
|
||||
'print': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'survey.analysis', 'state':'end'}
|
||||
}
|
||||
}
|
||||
print_survey_statistics_wizard('wizard.print.survey.statistics')
|
||||
def action_next(self, cr, uid, ids, context=None):
|
||||
datas = {'ids' : context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['survey_ids'], context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
datas['model'] = 'survey.print.statistics'
|
||||
return {
|
||||
'type':'ir.actions.report.xml',
|
||||
'report_name':'survey.analysis',
|
||||
'datas':datas,
|
||||
}
|
||||
|
||||
survey_print_statistics()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Survey Print Statistics Form View -->
|
||||
|
||||
<record id="view_survey_print_statistics" model="ir.ui.view">
|
||||
<field name="name">Survey Print Statistics</field>
|
||||
<field name="model">survey.print.statistics</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Survey Print Statistics">
|
||||
<field name="survey_ids" nolabel="1" colspan="4" />
|
||||
<separator colspan="4" />
|
||||
<label align="0.0" colspan="2" string="" />
|
||||
<button colspan="1" icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button colspan="1" icon="gtk-print" name="action_next" string="Print" type="object"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Survey Print Statistics action -->
|
||||
|
||||
<record id="action_view_survey_print_statistics"
|
||||
model="ir.actions.act_window">
|
||||
<field name="name">Survey Print Statistics</field>
|
||||
<field name="res_model">survey.print.statistics</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Print Survey Statistics" action="action_view_survey_print_statistics" id="menu_print_survey_statistics"
|
||||
parent="menu_reporting" icon="STOCK_PRINT" groups="group_survey_manager"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue