[CONVERT] converted wizard.ineterface into osv.osv_memory for base_module_quality
bzr revid: bde@tinyerp.com-20110829091222-jrbktyaoix1uecj4
This commit is contained in:
parent
c8dcb4e685
commit
5980cd0292
|
@ -42,7 +42,7 @@ using it, otherwise it may crash.
|
|||
'website': 'http://www.openerp.com',
|
||||
'depends': ['base'],
|
||||
'init_xml': [],
|
||||
'update_xml': ['base_module_quality_wizard.xml', 'base_module_quality_view.xml', 'security/ir.model.access.csv'],
|
||||
'update_xml': ['wizard/module_quality_check.xml', 'wizard/quality_save_report_view.xml', 'base_module_quality_view.xml', 'security/ir.model.access.csv'],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<field name="state" readonly="1"/>
|
||||
</page>
|
||||
<page string="Detail">
|
||||
<button name="%(quality_detail_save)d" string="Save Report" type="action"/>
|
||||
<button name="%(action_view_quality_save_report)d" string="Save Report" type="action"/>
|
||||
<field name="detail" widget="text_html" nolabel="1" colspan="4" readonly="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard id="quality_detail_save" model="ir.module.module" name="quality_detail_save" string="Report Save" menu="False"/>
|
||||
|
||||
<wizard string="Quality Check"
|
||||
model="ir.module.module"
|
||||
name="create_quality_check_wiz"
|
||||
id="create_quality_check_id"
|
||||
menu="True"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -26,7 +26,20 @@ from tools.translate import _
|
|||
import pooler
|
||||
from osv import osv, fields
|
||||
|
||||
class quality_check(wizard.interface):
|
||||
class quality_check(osv.osv_memory):
|
||||
_name = "quality.check"
|
||||
|
||||
def create_quality_check(self, cr, uid, ids, context=None):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
obj_quality = pool.get('module.quality.check')
|
||||
objs = []
|
||||
module_id = context.get('active_id', False)
|
||||
for id in ids:
|
||||
module_data = pool.get('ir.module.module').browse(cr, uid, module_id)
|
||||
data = obj_quality.check_quality(cr, uid, module_data.name, module_data.state)
|
||||
obj = obj_quality.create(cr, uid, data, context)
|
||||
objs.append(obj)
|
||||
return objs
|
||||
|
||||
def _create_quality_check(self, cr, uid, data, context=None):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
|
@ -39,8 +52,8 @@ class quality_check(wizard.interface):
|
|||
objs.append(obj)
|
||||
return objs
|
||||
|
||||
def _open_quality_check(self, cr, uid, data, context):
|
||||
obj_ids = self._create_quality_check(cr, uid, data, context)
|
||||
def open_quality_check(self, cr, uid, data, context):
|
||||
obj_ids = self.create_quality_check(cr, uid, data, context)
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,obj_ids))+"])]",
|
||||
'name': _('Quality Check'),
|
||||
|
@ -49,14 +62,6 @@ class quality_check(wizard.interface):
|
|||
'res_model': 'module.quality.check',
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
quality_check()
|
||||
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result': {'type':'action', 'action':_open_quality_check, 'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
quality_check("create_quality_check_wiz")
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_base_module_quality" model="ir.ui.view">
|
||||
<field name="name">view_base_module_quality_form</field>
|
||||
<field name="model">quality.check</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Quality Check">
|
||||
<group colspan="4">
|
||||
<label string = "Check Quality" help="You can check the quality of selected module"/>
|
||||
<separator colspan="4"/>
|
||||
<newline/>
|
||||
<button name="open_quality_check" icon="gtk-ok" string="Check" type="object"/>
|
||||
<button icon="gtk-cancel" string="Cancel" special="cancel"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
name="Quality Check"
|
||||
id="act_base_module_quality"
|
||||
res_model="quality.check"
|
||||
src_model="ir.module.module"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -26,36 +26,28 @@ import wizard
|
|||
from osv import osv
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
from osv import osv, fields
|
||||
|
||||
form_rep = '''<?xml version="1.0"?>
|
||||
<form string="Standard entries">
|
||||
<field name="name"/>
|
||||
<newline/>
|
||||
<field name="module_file"/>
|
||||
</form>'''
|
||||
class save_report(osv.osv_memory):
|
||||
|
||||
_name = "save.report"
|
||||
|
||||
fields_rep = {
|
||||
'name': {'string': 'File name', 'type': 'char', 'required': True, 'help': 'Save report as .html format', 'size':64},
|
||||
'module_file': {'string': 'Save report', 'type': 'binary', 'required': True},
|
||||
}
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
res = super(save_report, self).default_get(cr, uid, fields, context=context)
|
||||
active_ids = context.get('active_ids')
|
||||
data = pooler.get_pool(cr.dbname).get('module.quality.detail').browse(cr, uid, active_ids)[0]
|
||||
if not data.detail:
|
||||
raise osv.except_osv(_('Warning'), _('No report to save!'))
|
||||
buf = cStringIO.StringIO(data.detail)
|
||||
out = base64.encodestring(buf.getvalue())
|
||||
buf.close()
|
||||
return {'module_file': out, 'name': data.name + '.html'}
|
||||
|
||||
def get_detail(self, cr, uid, datas, context=None):
|
||||
data = pooler.get_pool(cr.dbname).get('module.quality.detail').browse(cr, uid, datas['id'])
|
||||
if not data.detail:
|
||||
raise wizard.except_wizard(_('Warning'), _('No report to save!'))
|
||||
buf = cStringIO.StringIO(data.detail)
|
||||
out = base64.encodestring(buf.getvalue())
|
||||
buf.close()
|
||||
return {'module_file': out, 'name': data.name + '.html'}
|
||||
_columns = {
|
||||
'name': fields.char('File Name', required=True, size=64, help="Save report as .html format"),
|
||||
'module_file': fields.binary('Save report', required=True),
|
||||
}
|
||||
|
||||
class save_report(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [get_detail],
|
||||
'result': {'type': 'form', 'arch': form_rep, 'fields':fields_rep, 'state': [('end','Cancel')]}
|
||||
},
|
||||
}
|
||||
save_report('quality_detail_save')
|
||||
save_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_quality_save_report" model="ir.ui.view">
|
||||
<field name="name">view_quality_save_report</field>
|
||||
<field name="model">save.report</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Standard Entries">
|
||||
<field name="name"/>
|
||||
<newline/>
|
||||
<field name="module_file"/>
|
||||
<separator colspan="4"/>
|
||||
<label string=" " colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_view_quality_save_report">
|
||||
<field name="name">Standard Entries</field>
|
||||
<field name="res_model">save.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="target">new</field>
|
||||
<field name="view_id" ref="view_quality_save_report"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue