[FIX] base_module_record,base_module_doc_rst: change to osv.osv_memory

bzr revid: kjo@tinyerp.com-20120202102713-a0y7medo4izgrd71
This commit is contained in:
Kuldeep Joshi (OpenERP) 2012-02-02 15:57:13 +05:30
commit 580bd71dc7
18 changed files with 754 additions and 624 deletions

View File

@ -1,24 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<wizard
string="Compute assets"
model="account.asset.asset"
name="account.asset.compute"
keyword="tree_but_action"
id="wizard_asset_compute"/>
<wizard
string="Modify asset"
model="account.asset.asset"
name="account.asset.modify"
id="wizard_asset_modify"
menu="False"/>
<wizard
string="Close asset"
model="account.asset.asset"
name="account.asset.close"
id="wizard_asset_close"
menu="False"/>
</data>
</openerp>

View File

@ -35,7 +35,7 @@ This module generates the Technical Guides of selected modules in Restructured T
'website': 'http://www.openerp.com',
'depends': ['base'],
'init_xml': [],
'update_xml': ['base_module_doc_rst_view.xml', 'base_module_doc_rst_wizard.xml', 'module_report.xml'],
'update_xml': ['wizard/generate_relation_graph_view.xml', 'wizard/tech_guide_rst_view.xml', 'base_module_doc_rst_view.xml', 'module_report.xml'],
'demo_xml': [],
'installable': True,
'certificate': '001288481437217734509',

View File

@ -1,20 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<wizard
id="wiz_tech_guide_rst"
model="ir.module.module"
name="tech.guide.rst"
string="Create RST Technical Guide"
keyword="client_action_multi"
multi="True" />
<wizard
id="wiz_gen_graph"
model="ir.module.module"
name="create.relation.graph"
string="Generate Relationship Graph"
multi="False" />
</data>
</openerp>

View File

@ -19,7 +19,7 @@
#
##############################################################################
import wizard_tech_guide_rst
import tech_rst_guide
import generate_relation_graph

View File

@ -20,30 +20,22 @@
##############################################################################
import wizard
from osv import osv
from osv import fields
import pooler
from tools.translate import _
form_rep = '''<?xml version="1.0"?>
<form string="Relationship Graph">
<label colspan="2" string="(Relationship Graphs generated)" align="0.0"/>
</form>'''
class create_graph(osv.osv_memory):
_name = "create.relation.graph"
def _get_graph(self, cr, uid, datas, context=None):
mod_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
modules = mod_obj.browse(cr, uid, datas['ids'], context=context)
for module in modules:
module_data = mod_obj.get_relation_graph(cr, uid, module.name, context=context)
if module_data['module_file']:
mod_obj.write(cr, uid, [module.id], {'file_graph': module_data['module_file']}, context=context)
return {'type': 'ir.actions.act_window_close'}
def get_graph(self, cr, uid, datas, context=None):
mod_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
modules = mod_obj.browse(cr, uid, context['ids'], context=context)
for module in modules:
module_data = mod_obj.get_relation_graph(cr, uid, module.name, context=context)
if module_data['module_file']:
mod_obj.write(cr, uid, [module.id], {'file_graph': module_data['module_file']}, context=context)
return {'type': 'ir.actions.act_window_close'}
class create_graph(wizard.interface):
states = {
'init': {
'actions': [_get_graph],
'result': {'type': 'form', 'arch': form_rep, 'fields': {}, 'state': [('end','Ok')]}
},
}
create_graph('create.relation.graph')
create_graph()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,39 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_relationship_graph" model="ir.ui.view">
<field name="name">create.relation.graph.form</field>
<field name="model">create.relation.graph</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Generate Relationship Graph">
<separator string="Relationship Graphs" colspan="6"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="get_graph" string="Create Graphs" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
<record id="action_generate_relationship_graph" model="ir.actions.act_window">
<field name="name">Generate Relationship Graph</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">create.relation.graph</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_relationship_graph"/>
<field name="context">{'ids': [active_id], 'id': active_id}</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="generate_relationship_graph_values">
<field name="model_id" ref="model_create_relation_graph" />
<field name="name">Generate Relationship Graph</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_generate_relationship_graph'))" />
<field name="key">action</field>
<field name="model">ir.module.module</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_technical_guide" model="ir.ui.view">
<field name="name">tech.guide.rst.form</field>
<field name="model">tech.guide.rst</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create Technical Guide in rst format">
<separator string="Technical Guide in rst format" colspan="4"/>
<label string="Please choose a file where the Technical Guide will be written." colspan="4"/>
<field name="rst_file" />
<field name="name" invisible="1"/>
</form>
</field>
</record>
<act_window
id="wiz_tech_guide_rst"
multi="True"
key2="client_action_multi" name="Create RST Technical Guide2"
context="{'ids': [active_id], 'id': active_id}"
res_model="tech.guide.rst" src_model="ir.module.module"
view_mode="form" target="new" view_type="form"
view_id="view_technical_guide"/>
</data>
</openerp>

View File

@ -29,20 +29,7 @@ import wizard
import pooler
import os
import tools
choose_file_form = '''<?xml version="1.0"?>
<form string="Create Technical Guide in rst format">
<separator string="Technical Guide in rst format" colspan="4"/>
<label string="Please choose a file where the Technical Guide will be written." colspan="4"/>
<field name="rst_file" />
<field name="name" invisible="1"/>
</form>
'''
choose_file_fields = {
'rst_file': {'string': 'file', 'type': 'binary', 'required': True, 'readonly': True},
'name': {'string': 'filename', 'type': 'char', 'required': True, 'readonly': True},
}
from osv import osv,fields
class RstDoc(object):
def __init__(self, module, objects):
@ -319,13 +306,17 @@ class RstDoc(object):
return s
class wizard_tech_guide_rst(wizard.interface):
class wizard_tech_guide_rst(osv.osv_memory):
_name = "tech.guide.rst"
_columns = {
'rst_file': fields.binary('File',required = True, readonly = True),
'name': fields.char("Filename", size=64, required=True, readonly = True),
}
def _generate(self, cr, uid, data, context):
def _generate(self, cr, uid, context):
pool = pooler.get_pool(cr.dbname)
module_model = pool.get('ir.module.module')
module_ids = data['ids']
module_ids = context['ids']
module_index = []
@ -396,10 +387,7 @@ class wizard_tech_guide_rst(wizard.interface):
msg = "Temporary file %s could not be deleted. (%s)" % (tgz_tmp_filename, e)
logger.notifyChannel("warning", netsvc.LOG_WARNING, msg)
return {
'rst_file': base64.encodestring(out),
'name': 'modules_technical_guide_rst.tgz'
}
return base64.encodestring(out)
def _get_views(self, cr, uid, module_id, context=None):
pool = pooler.get_pool(cr.dbname)
@ -488,21 +476,12 @@ class wizard_tech_guide_rst(wizard.interface):
logger.notifyChannel("base_module_doc_rst", netsvc.LOG_ERROR, msg)
return ""
states = {
'init': {
'actions': [_generate],
'result': {
'type': 'form',
'arch': choose_file_form,
'fields': choose_file_fields,
'state': [
('end', 'Close', 'gtk-close'),
]
_defaults ={
'rst_file' : _generate,
'name': 'modules_technical_guide_rst.tgz'
}
},
}
wizard_tech_guide_rst('tech.guide.rst')
wizard_tech_guide_rst()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -47,7 +47,7 @@ Select datetime criteria of recording and objects to be recorded and Record modu
'website': 'http://www.openerp.com',
'depends': ['base'],
'init_xml': [],
'update_xml': ['security/ir.model.access.csv', 'base_module_record_wizard.xml'],
'update_xml': ['security/ir.model.access.csv', 'wizard/base_module_record_object_view.xml', 'wizard/base_module_record_data_view.xml',],
'demo_xml': [],
'installable': True,
'certificate': '0083134865813',

View File

@ -1,39 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<menuitem
parent="base.menu_custom"
name="Module Creation"
id="menu_wizard_base_mod_rec"
groups="base.group_extended"/>
<wizard
id="wizard_base_module_record_objects"
string="Export Customizations As a Module"
model="ir.module.module"
multi="True"
name="base_module_record.module_record_objects"/>
<menuitem
parent="menu_wizard_base_mod_rec"
name="Export Customizations As a Module"
type="wizard"
action="wizard_base_module_record_objects"
id="menu_wizard_base_module_record_objects"/>
<wizard
id="wizard_base_module_record_data"
string="Export Customizations As Data File"
model="ir.module.module"
multi="True"
name="base_module_record.module_record_data"/>
<menuitem
parent="menu_wizard_base_mod_rec"
name="Export Customizations As Data File"
type="wizard"
action="wizard_base_module_record_data"
id="menu_wizard_base_module_record_data"/>
</data>
</openerp>

View File

@ -20,163 +20,141 @@
#
##############################################################################
import wizard
import osv
import pooler
import time
info = '''<?xml version="1.0"?>
<form string="Module Recording">
<label string="Thanks For using Module Recorder" colspan="4" align="0.0"/>
</form>'''
from osv import osv, fields
import tools
from tools.translate import _
intro_start_form = '''<?xml version="1.0"?>
<form string="Objects Recording">
<field name="check_date"/>
<newline/>
<field name="filter_cond"/>
<separator string="Choose objects to record" colspan="4"/>
<field name="objects" colspan="4" nolabel="1"/>
<group><field name="info_yaml"/></group>
</form>'''
intro_start_fields = {
'check_date': {'string':"Record from Date",'type':'datetime','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S')},
'objects':{'string': 'Objects', 'type': 'many2many', 'relation': 'ir.model', 'help': 'List of objects to be recorded'},
'filter_cond':{'string':'Records only', 'type':'selection','selection':[('created','Created'),('modified','Modified'),('created_modified','Created & Modified')], 'required':True, 'default': lambda *args:'created'},
'info_yaml': {'string':'YAML','type':'boolean'}
}
exp_form = '''<?xml version="1.0"?>
<form string="Objects Recording">
<separator string="Result, paste this to your module's xml" colspan="4" />
<field name="res_text" nolabel="1" colspan="4"/>
</form>'''
exp_fields = {
'res_text': {'string':"Result",'type':'text', },
}
def _info_default(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.model')
list=('ir.ui.view','ir.ui.menu','ir.model','ir.model.fields','ir.model.access',\
'res.partner','res.partner.address','res.partner.category','workflow',\
'workflow.activity','workflow.transition','ir.actions.server','ir.server.object.lines')
data['form']['objects']=mod.search(cr,uid,[('model','in',list)])
cr.execute('select max(create_date) from ir_model_data')
c=(cr.fetchone())[0].split('.')[0]
c = time.strptime(c,"%Y-%m-%d %H:%M:%S")
sec=c.tm_sec + 1
c=(c[0],c[1],c[2],c[3],c[4],sec,c[6],c[7],c[8])
data['form']['check_date']=time.strftime("%Y-%m-%d %H:%M:%S",c)
return data['form']
def _record_objects(self, cr, uid, data, context):
check_date=data['form']['check_date']
filter=data['form']['filter_cond']
pool = pooler.get_pool(cr.dbname)
user=(pool.get('res.users').browse(cr,uid,uid)).login
mod = pool.get('ir.module.record')
mod_obj = pool.get('ir.model')
mod.recording_data = []
for id in data['form']['objects'][0][2]:
obj_name=(mod_obj.browse(cr,uid,id)).model
obj_pool=pool.get(obj_name)
if filter =='created':
search_condition =[('create_date','>',check_date)]
elif filter =='modified':
search_condition =[('write_date','>',check_date)]
elif filter =='created_modified':
search_condition =['|',('create_date','>',check_date),('write_date','>',check_date)]
if '_log_access' in dir(obj_pool):
if not (obj_pool._log_access):
search_condition=[]
if '_auto' in dir(obj_pool):
if not obj_pool._auto:
continue
elif '_log_access' not in dir(obj_pool):
search_condition = []
search_ids=obj_pool.search(cr,uid,search_condition)
for s_id in search_ids:
args=(cr.dbname,uid,obj_name,'copy',s_id,{},context)
mod.recording_data.append(('query',args, {}, s_id))
return {'type': 'ir.actions.act_window_close'}
def _check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.module.record')
if len(mod.recording_data):
if data['form']['info_yaml']:
return 'save_yaml'
else:
return 'info'
else:
return 'end'
class base_module_data(osv.osv_memory):
_name = 'base.module.data'
_description = "Base Module Data"
def default_get(self, cr, uid, fields, context=None):
mod = self.pool.get('ir.model')
res = super(base_module_data, self).default_get(cr, uid, fields, context=context)
def _create_xml(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.module.record')
res_xml = mod.generate_xml(cr, uid)
return { 'res_text': res_xml }
list = ('ir.ui.view', 'ir.ui.menu', 'ir.model', 'ir.model.fields', 'ir.model.access',\
'res.partner', 'res.partner.address', 'res.partner.category', 'workflow',\
'workflow.activity', 'workflow.transition', 'ir.actions.server', 'ir.server.object.lines')
if 'objects' in fields:
res.update({'objects': mod.search(cr, uid, [('model', 'in', list)])})
cr.execute('select max(create_date) from ir_model_data')
c = (cr.fetchone())[0].split('.')[0]
c = time.strptime(c, "%Y-%m-%d %H:%M:%S")
sec = c.tm_sec!=59 and c.tm_sec + 1
c = (c[0], c[1], c[2], c[3], c[4], sec, c[6], c[7], c[8])
if 'check_date' in fields:
res.update({'check_date': time.strftime("%Y-%m-%d %H:%M:%S",c)})
return res
def _create_yaml(self,cr,uid,data,context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.module.record')
res_xml = mod.generate_yaml(cr, uid)
return { 'res_text': res_xml }
class base_module_record_objects(wizard.interface):
states = {
'init': {
'actions': [_info_default],
'result': {
'type':'form',
'arch':intro_start_form,
'fields': intro_start_fields,
'state':[
('end', 'Cancel', 'gtk-cancel'),
('record', 'Record', 'gtk-ok'),
]
}
},
'record': {
'actions': [],
'result': {'type':'action','action':_record_objects,'state':'check'}
},
'check': {
'actions': [],
'result': {'type':'choice','next_state':_check}
},
'info': {
'actions': [ _create_xml ],
'result': {
'type':'form',
'arch': exp_form,
'fields':exp_fields,
'state':[
('end', 'End', 'gtk-cancel'),
]
},
},
'save_yaml': {
'actions': [ _create_yaml ],
'result': {
'type':'form',
'arch': exp_form,
'fields':exp_fields,
'state':[
('end', 'End', 'gtk-cancel'),
]
},
},
'end': {
'actions': [],
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
},
_columns = {
'check_date': fields.datetime('Record from Date', required=True),
'objects': fields.many2many('ir.model', 'base_module_record_object_rel', 'objects', 'model_id', 'Objects'),
'filter_cond': fields.selection([('created', 'Created'), ('modified', 'Modified'), ('created_modified', 'Created & Modified')], 'Records only', required=True),
'info_yaml': fields.boolean('YAML'),
}
base_module_record_objects('base_module_record.module_record_data')
_defaults = {
'check_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'filter_cond': 'created',
}
def _create_xml(self, cr, uid, data, context=None):
mod = self.pool.get('ir.module.record')
res_xml = mod.generate_xml(cr, uid)
return {'res_text': res_xml }
def _create_yaml(self, cr, uid, data, context=None):
mod = self.pool.get('ir.module.record')
res_xml = mod.generate_yaml(cr, uid)
return { 'res_text': res_xml }
def record_objects(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, [], context=context)[0]
check_date = data['check_date']
filter = data['filter_cond']
user = (self.pool.get('res.users').browse(cr, uid, uid)).login
mod = self.pool.get('ir.module.record')
mod_obj = self.pool.get('ir.model')
mod.recording_data = []
for id in data['objects']:
obj_name=(mod_obj.browse(cr, uid, id)).model
obj_pool=self.pool.get(obj_name)
if filter =='created':
search_condition =[('create_date','>',check_date)]
elif filter =='modified':
search_condition =[('write_date','>',check_date)]
elif filter =='created_modified':
search_condition =['|',('create_date','>',check_date),('write_date','>',check_date)]
if '_log_access' in dir(obj_pool):
if not (obj_pool._log_access):
search_condition=[]
if '_auto' in dir(obj_pool):
if not obj_pool._auto:
continue
search_ids=obj_pool.search(cr,uid,search_condition)
for s_id in search_ids:
args=(cr.dbname,uid,obj_name,'copy', s_id,{}, context)
mod.recording_data.append(('query', args, {}, s_id))
mod_obj = self.pool.get('ir.model.data')
if len(mod.recording_data):
if data['info_yaml']:
res=self._create_yaml(cr, uid, data, context)
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'module_create_xml_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': {
'default_res_text': tools.ustr(res['res_text']),
},
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.data',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
else:
res=self._create_xml(cr, uid, data, context)
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'module_create_xml_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': {
'default_res_text': tools.ustr(res['res_text']),
},
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.data',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'module_recording_message_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': context,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.objects',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
base_module_data()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
class base_module_record_data(osv.osv_memory):
_name = 'base.module.record.data'
_description = "Base Module Record Data"
_columns = {
'res_text': fields.text('Result'),
}
base_module_record_data()
#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="base_module_record_data_view" model="ir.ui.view">
<field name="name">base_module_record_data</field>
<field name="model">base.module.data</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Data Recording">
<field name="check_date"/>
<newline/>
<field name="filter_cond"/>
<separator string="Choose objects to record" colspan="4"/>
<field name="objects" colspan="4" nolabel="1"/>
<group><field name="info_yaml"/></group>
<separator colspan="4"/>
<group colspan="4" col="2">
<button icon="gtk-cancel" string="Cancel" special="cancel"/>
<button name="record_objects" icon="gtk-ok" string="Record" type="object"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_base_module_record_data">
<field name="name">Export Customizations as Data</field>
<field name="res_model">base.module.data</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="base_module_record_data_view"/>
</record>
<menuitem
parent="menu_wizard_base_mod_rec"
name="Export Customizations As Data file"
action="action_base_module_record_data"
id="menu_wizard_base_module_record_data"/>
<act_window
id="act_base_module_record_data"
name="Export Customizations As Data File"
res_model="base.module.data"
src_model="ir.module.module"
view_mode="form"
target="new"
multi="True"
key2="client_action_multi"/>
<record id="module_create_xml_view" model="ir.ui.view">
<field name="name">module.create.xml.form</field>
<field name="model">base.module.record.data</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Data Recording">
<separator string="Result, paste this to your module's xml" colspan="4" />
<field name="res_text" nolabel="1" colspan="4"/>
<separator colspan="4"/>
<group colspan="4" col="2">
<label string=""/>
<button icon="gtk-close" string="Close" special="cancel"/>
</group>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="base_module_record_objects_view" model="ir.ui.view">
<field name="name">base_module_record_objects</field>
<field name="model">base.module.record</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Objects Recording">
<field name="check_date"/>
<newline/>
<field name="filter_cond"/>
<separator string="Choose objects to record" colspan="4"/>
<field name="objects" colspan="4" nolabel="1"/>
<group><field name="info_yaml"/></group>
<separator colspan="4"/>
<group colspan="4" col="2">
<button icon="gtk-cancel" string="Cancel" special="cancel"/>
<button name="record_objects" icon="gtk-ok" string="Record" type="object"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_base_module_record_objects">
<field name="name">Export Customizations as a Module</field>
<field name="res_model">base.module.record</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="base_module_record_objects_view"/>
</record>
<menuitem
parent="base.menu_custom"
name="Module Creation"
id="menu_wizard_base_mod_rec"
groups="base.group_extended"/>
<menuitem
parent="menu_wizard_base_mod_rec"
name="Export Customizations As a Module"
action="action_base_module_record_objects"
id="menu_wizard_base_module_record_objects"/>
<act_window
id="act_base_module_record_objects"
name="Export Customizations As a Module"
res_model="base.module.record"
src_model="ir.module.module"
view_mode="form"
target="new"
multi="True"
key2="client_action_multi"/>
<record id="module_create_form_view" model="ir.ui.view">
<field name="name">module.create.form</field>
<field name="model">base.module.record.objects</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Module Recording">
<separator string="Module successfully created !" colspan="4"/>
<field name="module_filename"/>
<newline/>
<field name="module_file"/>
<separator string="Information" colspan="4"/>
<label string="If you think your module could interest other people, we'd like you to publish it on http://www.openerp.com, in the 'Modules' section. You can do it through the website or using features of the 'base_module_publish' module." colspan="4" align="0.0"/>
<label string="Thanks in advance for your contribution." colspan="4" align="0.0"/>
<separator colspan="4"/>
<group colspan="4" col="2">
<label string=""/>
<button icon="gtk-close" string="Close" special="cancel"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_module_created">
<field name="name">Module Recording</field>
<field name="res_model">base.module.record.objects</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="module_create_form_view"/>
</record>
<record id="info_start_form_view" model="ir.ui.view">
<field name="name">info.start.form.view</field>
<field name="model">base.module.record.objects</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Module Recording">
<separator string="Module Information" colspan="4"/>
<field name="name"/>
<field name="directory_name"/>
<field name="version"/>
<field name="author"/>
<field name="website" colspan="4"/>
<field name="category" colspan="4"/>
<field name="data_kind"/>
<newline/>
<field name="description" colspan="4"/>
<separator colspan="4"/>
<group colspan="4" col="2">
<button icon="gtk-cancel" string="Cancel" special="cancel"/>
<button string="Continue" name="inter_call" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="module_recording_message_view" model="ir.ui.view">
<field name="name">module_recording_message</field>
<field name="model">base.module.record.objects</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Module Recording">
<label string="Thanks For using Module Recorder" colspan="4" align="0.0"/>
<separator string="" colspan="4"/>
<group colspan="4" col="2">
<label string=""/>
<button icon="gtk-ok" string="OK" special="cancel"/>
</group>
</form>
</field>
</record>
<record id="yml_save_form_view" model="ir.ui.view">
<field name="name">yml.save.form</field>
<field name="model">base.module.record.objects</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Module Recording">
<separator string="YAML file successfully created !" colspan="4"/>
<newline/>
<field name="yaml_file" filename="module_filename"/>
<separator colspan="4"/>
<group colspan="4" col="2">
<label string=""/>
<button icon="gtk-close" string="Close" special="cancel"/>
</group>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -19,147 +19,166 @@
#
##############################################################################
import wizard
import osv
import pooler
import time
import base_module_save
from osv import osv, fields
import tools
from tools.translate import _
info = '''<?xml version="1.0"?>
<form string="Module Recording">
<label string="Thanks For using Module Recorder" colspan="4" align="0.0"/>
</form>'''
class base_module_record(osv.osv_memory):
_name = 'base.module.record'
_description = "Base Module Record"
def default_get(self, cr, uid, fields, context=None):
mod = self.pool.get('ir.model')
res = super(base_module_record, self).default_get(cr, uid, fields, context=context)
list=('ir.ui.view', 'ir.ui.menu', 'ir.model', 'ir.model.fields', 'ir.model.access', \
'res.partner', 'res.partner.address', 'res.partner.category', 'workflow', \
'workflow.activity', 'workflow.transition', 'ir.actions.server', 'ir.server.object.lines')
if 'objects' in fields:
res.update({'objects': mod.search(cr, uid, [('model', 'in', list)])})
cr.execute('select max(create_date) from ir_model_data')
c=(cr.fetchone())[0].split('.')[0]
c = time.strptime(c, "%Y-%m-%d %H:%M:%S")
sec=c.tm_sec!=59 and c.tm_sec + 1
c=(c[0],c[1],c[2],c[3],c[4],sec,c[6],c[7],c[8])
if 'check_date' in fields:
res.update({'check_date': time.strftime("%Y-%m-%d %H:%M:%S", c)})
return res
intro_start_form = '''<?xml version="1.0"?>
<form string="Objects Recording">
<field name="check_date"/>
<newline/>
<field name="filter_cond"/>
<separator string="Choose objects to record" colspan="4"/>
<field name="objects" colspan="4" nolabel="1"/>
<group><field name="info_yaml"/></group>
</form>'''
intro_start_fields = {
'check_date': {'string':"Record from Date",'type':'datetime','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S')},
'objects':{'string': 'Objects', 'type': 'many2many', 'relation': 'ir.model', 'help': 'List of objects to be recorded'},
'filter_cond':{'string':'Records only', 'type':'selection','selection':[('created','Created'),('modified','Modified'),('created_modified','Created & Modified')], 'required':True, 'default': lambda *args:'created'},
'info_yaml': {'string':'YAML','type':'boolean'}
}
def _info_default(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.model')
list=('ir.ui.view','ir.ui.menu','ir.model','ir.model.fields','ir.model.access',\
'res.partner','res.partner.address','res.partner.category','workflow',\
'workflow.activity','workflow.transition','ir.actions.server','ir.server.object.lines')
data['form']['objects']=mod.search(cr,uid,[('model','in',list)])
cr.execute('select max(create_date) from ir_model_data')
c=(cr.fetchone())[0].split('.')[0]
c = time.strptime(c,"%Y-%m-%d %H:%M:%S")
sec=c.tm_sec!=59 and c.tm_sec + 1
c=(c[0],c[1],c[2],c[3],c[4],sec,c[6],c[7],c[8])
data['form']['check_date']=time.strftime("%Y-%m-%d %H:%M:%S",c)
return data['form']
def _record_objects(self, cr, uid, data, context):
check_date=data['form']['check_date']
filter=data['form']['filter_cond']
pool = pooler.get_pool(cr.dbname)
user=(pool.get('res.users').browse(cr,uid,uid)).login
mod = pool.get('ir.module.record')
mod_obj = pool.get('ir.model')
mod.recording_data = []
for id in data['form']['objects'][0][2]:
obj_name=(mod_obj.browse(cr,uid,id)).model
obj_pool=pool.get(obj_name)
if filter =='created':
search_condition =[('create_date','>',check_date)]
elif filter =='modified':
search_condition =[('write_date','>',check_date)]
elif filter =='created_modified':
search_condition =['|',('create_date','>',check_date),('write_date','>',check_date)]
if '_log_access' in dir(obj_pool):
if not (obj_pool._log_access):
search_condition=[]
if '_auto' in dir(obj_pool):
if not obj_pool._auto:
continue
search_ids=obj_pool.search(cr,uid,search_condition)
for s_id in search_ids:
args=(cr.dbname,uid,obj_name,'copy',s_id,{},context)
mod.recording_data.append(('query',args, {}, s_id))
return {}
def inter_call(self,cr,uid,data,context):
res=base_module_save._create_module(self,cr, uid, data, context)
return res
def _create_yaml(self,cr,uid,data,context):
res=base_module_save._create_yaml(self,cr, uid, data, context)
return res
class base_module_record_objects(wizard.interface):
states = {
'init': {
'actions': [_info_default],
'result': {
'type':'form',
'arch':intro_start_form,
'fields': intro_start_fields,
'state':[
('end', 'Cancel', 'gtk-cancel'),
('record', 'Record', 'gtk-ok'),
]
}
},
'record': {
'actions': [],
'result': {'type':'action','action':_record_objects,'state':'check'}
},
'check': {
'actions': [],
'result': {'type':'choice','next_state':base_module_save._check}
},
'info': {
'actions': [],
'result': {
'type':'form',
'arch':base_module_save.intro_start_form,
'fields':base_module_save.intro_start_fields,
'state':[
('end', 'Cancel', 'gtk-cancel'),
('save', 'Continue', 'gtk-ok'),
]
},
},
'save': {
'actions': [inter_call],
'result': {
'type':'form',
'arch':base_module_save.intro_save_form,
'fields': base_module_save.intro_save_fields,
'state':[('end', 'Close', 'gtk-ok'),]
},
},
'save_yaml': {
'actions': [_create_yaml],
'result': {
'type':'form',
'arch':base_module_save.yaml_save_form,
'fields': base_module_save.yaml_save_fields,
'state':[
('end', 'Close', 'gtk-ok'),
]
}
},
'end': {
'actions': [],
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
},
_columns = {
'check_date': fields.datetime('Record from Date', required=True),
'objects': fields.many2many('ir.model', 'base_module_record_object_rel', 'objects', 'model_id', 'Objects'),
'filter_cond': fields.selection([('created', 'Created'), ('modified', 'Modified'), ('created_modified', 'Created & Modified')], 'Records only', required=True),
'info_yaml': fields.boolean('YAML'),
}
base_module_record_objects('base_module_record.module_record_objects')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
_defaults = {
'check_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'filter_cond': 'created',
}
def record_objects(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, [], context=context)[0]
check_date=data['check_date']
filter=data['filter_cond']
user=(self.pool.get('res.users').browse(cr,uid,uid)).login
mod = self.pool.get('ir.module.record')
mod_obj = self.pool.get('ir.model')
mod.recording_data = []
for id in data['objects']:
obj_name=(mod_obj.browse(cr,uid,id)).model
obj_pool=self.pool.get(obj_name)
if filter =='created':
search_condition =[('create_date', '>', check_date)]
elif filter =='modified':
search_condition =[('write_date', '>', check_date)]
elif filter =='created_modified':
search_condition =['|',('create_date', '>', check_date), ('write_date', '>', check_date)]
if '_log_access' in dir(obj_pool):
if not (obj_pool._log_access):
search_condition=[]
if '_auto' in dir(obj_pool):
if not obj_pool._auto:
continue
search_ids = obj_pool.search(cr,uid,search_condition)
for s_id in search_ids:
args=(cr.dbname, uid,obj_name, 'copy', s_id,{},context)
mod.recording_data.append(('query', args, {}, s_id))
mod_obj = self.pool.get('ir.model.data')
if len(mod.recording_data):
if data['info_yaml']:
mod = self.pool.get('ir.module.record')
res=base_module_save._create_yaml(self, cr, uid, data, context)
model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'yml_save_form_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': {
'default_yaml_file': tools.ustr(res['yaml_file']),
},
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.objects',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
else:
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'info_start_form_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': context,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.objects',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'module_recording_message_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': context,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.objects',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
base_module_record()
class base_module_record_objects(osv.osv_memory):
_name = 'base.module.record.objects'
_description = "Base Module Record Objects"
def inter_call(self,cr,uid,data,context=None):
res=base_module_save._create_module(self, cr, uid, data, context)
mod_obj = self.pool.get('ir.model.data')
model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'module_create_form_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
context.update(res)
return {
'name': _('Message'),
'context': {
'default_module_filename': tools.ustr(res['module_filename']),
'default_module_file': tools.ustr(res['module_file']),
},
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.objects',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
_columns = {
'name': fields.char('Module Name', size=64, required=True),
'directory_name': fields.char('Directory Name', size=32, required=True),
'version': fields.char('Version', size=16, required=True),
'author': fields.char('Author', size=64, required=True),
'category': fields.char('Category', size=64, required=True),
'website': fields.char('Documentation URL', size=64, required=True),
'description': fields.text('Full Description', required=True),
'data_kind': fields.selection([('demo', 'Demo Data'), ('update', 'Normal Data')], 'Type of Data', required=True),
'module_file': fields.binary('Module .zip File', filename="module_filename"),
'module_filename': fields.char('Filename', size=64),
'yaml_file': fields.binary('Module .zip File'),
}
_defaults = {
'author': 'OpenERP SA',
'category': 'Vertical Modules/Parametrization',
'website': 'http://www.openerp.com',
'data_kind': 'update'
}
base_module_record_objects()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -19,133 +19,39 @@
#
##############################################################################
import wizard
import osv
import pooler
from tools.translate import _
info = '''<?xml version="1.0"?>
<form string="Module Recording">
<label string="Thanks For using Module Recorder" colspan="4" align="0.0"/>
</form>'''
info_start_form = '''<?xml version="1.0"?>
<form string="Module Recording">
<separator string="Recording Information" colspan="4"/>
<field name="info_status"/>
<field name="info_text" colspan="4" nolabel="1"/>
<field name="info_yaml" colspan="4"/>
</form>'''
info_start_fields = {
'info_text': {'string':'Information', 'type':'text', 'readonly':True},
'info_status': {'string':'Status','type':'selection', 'selection':[('no','Not Recording'),('record','Recording')], 'readonly':True},
'info_yaml': {'string':'YAML','type':'boolean'}
}
intro_start_form = '''<?xml version="1.0"?>
<form string="Module Recording">
<separator string="Module Information" colspan="4"/>
<field name="name"/>
<field name="directory_name"/>
<field name="version"/>
<field name="author"/>
<field name="website" colspan="4"/>
<field name="category" colspan="4"/>
<field name="data_kind"/>
<newline/>
<field name="description" colspan="4"/>
</form>'''
intro_start_fields = {
'name': {'string':'Module Name', 'type':'char', 'size':64, 'required':True},
'directory_name': {'string':'Directory Name', 'type':'char', 'size':32, 'required':True},
'version': {'string':'Version', 'type':'char', 'size':16, 'required':True},
'author': {'string':'Author', 'type':'char', 'size':64, 'default': lambda *args: 'OpenERP SA', 'required':True},
'category': {'string':'Category', 'type':'char', 'size':64, 'default': lambda *args: 'Vertical Modules/Parametrization', 'required':True},
'website': {'string':'Documentation URL', 'type':'char', 'size':64, 'default': lambda *args: 'http://www.openerp.com', 'required':True},
'description': {'string':'Full Description', 'type':'text', 'required':True},
'data_kind': {'string':'Type of Data', 'type':'selection', 'selection':[('demo','Demo Data'),('update','Normal Data')], 'required':True, 'default': lambda *args:'update'},
}
intro_save_form = '''<?xml version="1.0"?>
<form string="Module Recording">
<separator string="Module successfully created !" colspan="4"/>
<field name="module_filename"/>
<newline/>
<field name="module_file" filename="module_filename"/>
<separator string="Information" colspan="4"/>
<label string="If you think your module could interest other people, we'd like you to publish it on http://www.openerp.com, in the 'Modules' section. You can do it through the website or using features of the 'base_module_publish' module." colspan="4" align="0.0"/>
<label string="Thanks in advance for your contribution." colspan="4" align="0.0"/>
</form>'''
intro_save_fields = {
'module_file': {'string': 'Module .zip File', 'type':'binary', 'readonly':True},
'module_filename': {'string': 'Filename', 'type':'char', 'size': 64, 'readonly':True},
}
yaml_save_form = '''<?xml version="1.0"?>
<form string="Module Recording">
<separator string="YAML file successfully created !" colspan="4"/>
<newline/>
<field name="yaml_file" filename="module_filename"/>
</form>'''
yaml_save_fields = {
'yaml_file': {'string': 'Module .zip File', 'type':'binary'},
}
import zipfile
import StringIO
import base64
def _info_default(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.module.record')
result = {}
info = "Details of "+str(len(mod.recording_data))+" Operation(s):\n\n"
import tools
from tools.translate import _
from osv import osv, fields
for line in mod.recording_data:
result.setdefault(line[0],{})
result[line[0]].setdefault(line[1][3], {})
result[line[0]][line[1][3]].setdefault(line[1][3], 0)
result[line[0]][line[1][3]][line[1][3]]+=1
for key1,val1 in result.items():
info+=key1+"\n"
for key2,val2 in val1.items():
info+="\t"+key2+"\n"
for key3,val3 in val2.items():
info+="\t\t"+key3+" : "+str(val3)+"\n"
return {'info_text': info, 'info_status':mod.recording and 'record' or 'no'}
def _create_yaml(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.module.record')
def _create_yaml(self, cr, uid, data, context=None):
mod = self.pool.get('ir.module.record')
try:
res_xml = mod.generate_yaml(cr, uid)
except Exception, e:
raise wizard.except_wizard(_('Error'),_(str(e)))
raise osv.except_osv(_('Error'),_(str(e)))
return {
'yaml_file': base64.encodestring(res_xml),
}
def _create_module(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.module.record')
def _create_module(self, cr, uid, ids, context=None):
mod = self.pool.get('ir.module.record')
res_xml = mod.generate_xml(cr, uid)
s=StringIO.StringIO()
data = self.read(cr, uid, ids, [], context=context)[0]
s = StringIO.StringIO()
zip = zipfile.ZipFile(s, 'w')
dname = data['form']['directory_name']
data['form']['update_name'] = ''
data['form']['demo_name'] = ''
if data['form']['data_kind'] =='demo':
data['form']['demo_name'] = '"%(directory_name)s_data.xml"' % data['form']
dname = data['directory_name']
data['update_name'] = ''
data['demo_name'] = ''
if ['data_kind'] =='demo':
data['demo_name'] = '"%(directory_name)s_data.xml"' % data
else:
data['form']['update_name'] = '"%(directory_name)s_data.xml"' % data['form']
data['form']['depends'] = ','.join(map(lambda x: '"'+x+'"',mod.depends.keys()))
data['update_name'] = '"%(directory_name)s_data.xml"' % data
data['depends'] = ','.join(map(lambda x: '"'+x+'"', mod.depends.keys()))
_terp = """{
"name" : "%(name)s",
"version" : "%(version)s",
@ -158,7 +64,7 @@ def _create_module(self, cr, uid, data, context):
"demo_xml" : [ %(demo_name)s],
"update_xml" : [%(update_name)s],
"installable": True
} """ % data['form']
} """ % data
filewrite = {
'__init__.py':'#\n# Generated by the OpenERP module recorder !\n#\n',
'__openerp__.py':_terp,
@ -174,78 +80,91 @@ def _create_module(self, cr, uid, data, context):
zip.close()
return {
'module_file': base64.encodestring(s.getvalue()),
'module_filename': data['form']['directory_name']+'-'+data['form']['version']+'.zip'
'module_filename': data['directory_name']+'-'+data['version']+'.zip'
}
def _check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.module.record')
if len(mod.recording_data):
if data['form']['info_yaml']:
return 'save_yaml'
else:
return 'info'
else:
return 'end'
class base_module_publish(wizard.interface):
states = {
'init': {
'actions': [_info_default],
'result': {
'type':'form',
'arch':info_start_form,
'fields': info_start_fields,
'state':[
('end', 'Cancel', 'gtk-cancel'),
('check', 'Continue', 'gtk-ok'),
]
}
},
'check': {
'actions': [],
'result': {'type':'choice','next_state':_check}
},
'info': {
'actions': [],
'result': {
'type':'form',
'arch':intro_start_form,
'fields': intro_start_fields,
'state':[
('end', 'Cancel', 'gtk-cancel'),
('save', 'Continue', 'gtk-ok'),
]
}
},
'save': {
'actions': [_create_module],
'result': {
'type':'form',
'arch':intro_save_form,
'fields': intro_save_fields,
'state':[
('end', 'Close', 'gtk-ok'),
]
}
},
'save_yaml': {
'actions': [_create_yaml],
'result': {
'type':'form',
'arch':yaml_save_form,
'fields': yaml_save_fields,
'state':[
('end', 'Close', 'gtk-ok'),
]
}
},
'end': {
'actions': [],
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
},
class base_module_save(osv.osv_memory):
_name = 'base.module.save'
_description = "Base Module Save"
def default_get(self, cr, uid, fields, context=None):
mod = self.pool.get('ir.module.record')
result = {}
info = "Details of "+str(len(mod.recording_data))+" Operation(s):\n\n"
res = super(base_module_save, self).default_get(cr, uid, fields, context=context)
for line in mod.recording_data:
result.setdefault(line[0],{})
result[line[0]].setdefault(line[1][3], {})
result[line[0]][line[1][3]].setdefault(line[1][3], 0)
result[line[0]][line[1][3]][line[1][3]]+=1
for key1,val1 in result.items():
info+=key1+"\n"
for key2,val2 in val1.items():
info+="\t"+key2+"\n"
for key3,val3 in val2.items():
info+="\t\t"+key3+" : "+str(val3)+"\n"
if 'info_text' in fields:
res.update({'info_text': info})
if 'info_status' in fields:
info_status = mod.recording and 'record' or 'no'
res.update({'info_status': info_status})
return res
_columns = {
'info_text': fields.text('Information', readonly=True),
'info_status': fields.selection([('no', 'Not Recording'),('record', 'Recording')], 'Status', readonly=True),
'info_yaml': fields.boolean('YAML'),
}
base_module_publish('base_module_record.module_save')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
def record_save(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, [], context=context)[0]
mod = self.pool.get('ir.module.record')
mod_obj = self.pool.get('ir.model.data')
if len(mod.recording_data):
if data['info_yaml']:
mod = self.pool.get('ir.module.record')
res=_create_yaml(self, cr, uid, data, context)
model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'yml_save_form_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': {
'default_yaml_file': tools.ustr(res['yaml_file']),
},
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.objects',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
else:
model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'info_start_form_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': context,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.objects',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'module_recording_message_view')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
return {
'name': _('Message'),
'context': context,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'base.module.record.objects',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
base_module_save()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="base_module_save_view" model="ir.ui.view">
<field name="name">base_module_save</field>
<field name="model">base.module.save</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Module Recording">
<separator string="Recording Information" colspan="4"/>
<field name="info_status"/>
<field name="info_text" colspan="4" nolabel="1"/>
<field name="info_yaml" colspan="4"/>
<separator colspan="4"/>
<group colspan="4" col="2">
<button icon="gtk-cancel" string="Cancel" special="cancel"/>
<button name="record_save" icon="gtk-ok" string="Continue" type="object"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_base_module_save">
<field name="name">Publish as module</field>
<field name="res_model">base.module.save</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="view_id" ref="base_module_save_view"/>
</record>
<menuitem
parent="menu_wizard_base_mod_rec"
name="Publish as Module"
action="action_base_module_save"
id="menu_wizard_base_module_save"/>
<act_window
id="act_base_module_save"
name="Publish as Module"
res_model="base.module.save"
src_model="ir.module.module"
view_mode="form"
target="new"
multi="True"
key2="client_action_multi"/>
</data>
</openerp>

View File

@ -2,15 +2,6 @@
<openerp>
<data>
<!-- Old wizard -->
<wizard
id="wizard_crm_phonecall_meeting_set"
keyword="client_action_multi"
model="crm.phonecall"
name="crm.phonecall.meeting_set"
multi="True"
string="Schedule Meeting"/>
<!-- Phonecall to meeting view -->

View File

@ -10,6 +10,5 @@
<report auto="False" id="report_users_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet" xsl="hr_timesheet/report/users_timesheet.xsl"/>
<wizard id="wizard_hr_timesheet_users" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet"/>
</data>
</openerp>