Devishree Brahmbhatt (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-862227-dbr into
lp:openobject-addons.
Requested reviews:
Bhumika (OpenERP) (sbh-openerp)
Related bugs:
Bug #862227 in OpenERP Addons: "[6.1]Need to convert old wizard.interface to
osv.osv_memory wizard"
https://bugs.launchpad.net/openobject-addons/+bug/862227
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-862227-dbr/+merge/78077
Hello Ma'am,
Fixes : wizard.interface to osv.osv_memory wizard
Improved following modules:
base_module_doc_rst
base_module_quality
google_map
Rename:
base_module_doc_rst/wizard/wizard_tech_guide_rst.py =>
base_module_doc_rst/wizard/tech_guide_rst.py
So,Kindly review it.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-862227-dbr/+merge/78077
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-862227-dbr.
=== modified file 'base_module_doc_rst/base_module_doc_rst_wizard.xml'
--- base_module_doc_rst/base_module_doc_rst_wizard.xml 2011-01-14 00:11:01 +0000
+++ base_module_doc_rst/base_module_doc_rst_wizard.xml 2011-10-04 10:43:38 +0000
@@ -1,20 +1,49 @@
<?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" />
+ <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>
+ <act_window id="wiz_gen_graph"
+ multi="True"
+ key2="client_action_multi" name="Generate Relationship Graph1"
+ context="{'ids': [active_id], 'id': active_id}"
+ res_model="create.relation.graph" src_model="ir.module.module"
+ view_mode="form" target="new" view_type="form"
+ />
+
+<!-- tech.guide.rst.form -->
+
+ <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"
+ />
+
</data>
</openerp>
=== modified file 'base_module_doc_rst/wizard/__init__.py'
--- base_module_doc_rst/wizard/__init__.py 2011-01-14 00:11:01 +0000
+++ base_module_doc_rst/wizard/__init__.py 2011-10-04 10:43:38 +0000
@@ -19,6 +19,6 @@
#
##############################################################################
-import wizard_tech_guide_rst
+import tech_guide_rst
import generate_relation_graph
=== modified file 'base_module_doc_rst/wizard/generate_relation_graph.py'
--- base_module_doc_rst/wizard/generate_relation_graph.py 2011-01-14 00:11:01 +0000
+++ base_module_doc_rst/wizard/generate_relation_graph.py 2011-10-04 10:43:38 +0000
@@ -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>'''
-
-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'}
-
-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')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+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, 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'}
+
+create_graph()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== renamed file 'base_module_doc_rst/wizard/wizard_tech_guide_rst.py' => 'base_module_doc_rst/wizard/tech_guide_rst.py'
--- base_module_doc_rst/wizard/wizard_tech_guide_rst.py 2011-01-14 00:11:01 +0000
+++ base_module_doc_rst/wizard/tech_guide_rst.py 2011-10-04 10:43:38 +0000
@@ -29,24 +29,11 @@
import pooler
import os
import tools
+from osv import osv
+from osv import fields
import base_module_doc_rst
-
-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},
-}
-
class RstDoc(object):
def __init__(self, module, objects):
self.dico = {
@@ -322,14 +309,17 @@
return s
-class wizard_tech_guide_rst(wizard.interface):
-
-
- def _generate(self, cr, uid, data, context):
+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, context):
pool = pooler.get_pool(cr.dbname)
module_model = pool.get('ir.module.module')
- module_ids = data['ids']
-
+ module_ids = context['ids']
module_index = []
# create a temporary gzipped tarfile:
@@ -399,10 +389,7 @@
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)
@@ -491,19 +478,9 @@
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'),
- ]
- }
- },
- }
-
-wizard_tech_guide_rst('tech.guide.rst')
-
+ _defaults ={
+ 'rst_file' : _generate,
+ 'name': 'modules_technical_guide_rst.tgz'
+ }
+
+wizard_tech_guide_rst()
=== modified file 'base_module_quality/base_module_quality_wizard.xml'
--- base_module_quality/base_module_quality_wizard.xml 2011-01-14 00:11:01 +0000
+++ base_module_quality/base_module_quality_wizard.xml 2011-10-04 10:43:38 +0000
@@ -1,12 +1,47 @@
<?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"/>
+ <record id="view_quality_detail_save" model="ir.ui.view">
+ <field name="name">quality.detail.save.form</field>
+ <field name="model">quality.detail.save</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Standard entries">
+ <field name="name"/>
+ <newline/>
+ <field name="module_file"/>
+ </form>
+ </field>
+ </record>
+ <act_window id="quality_detail_save"
+ multi="True"
+ key2="client_action_multi" name="quality_detail_save"
+ context="{'ids': [active_id], 'id': active_id}"
+ res_model="quality.detail.save" src_model="ir.module.module"
+ view_mode="form" target="new" view_type="form"
+ />
+
+ <record id="view_create_quality_check_wiz" model="ir.ui.view">
+ <field name="name">create.quality.check.wiz.form</field>
+ <field name="model">create.quality.check.wiz</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Quality Check ">
+ <separator string="Quality Check Results" colspan="6"/>
+ <button string="_Cancel" icon="gtk-cancel" special="cancel" />
+ <button name="open_quality_check" type="object" string="Ok" icon="gtk-ok" />
+ </form>
+ </field>
+ </record>
+
+ <act_window id="create_quality_check_id"
+ name="Quality Check"
+ context="{'ids': [active_id], 'id': active_id}"
+ res_model="create.quality.check.wiz"
+ src_model="ir.module.module"
+ view_mode="form"
+ target="new"
+ view_type="form"
+ />
</data>
-</openerp>
\ No newline at end of file
+</openerp>
=== modified file 'base_module_quality/wizard/module_quality_check.py'
--- base_module_quality/wizard/module_quality_check.py 2011-01-14 00:11:01 +0000
+++ base_module_quality/wizard/module_quality_check.py 2011-10-04 10:43:38 +0000
@@ -26,20 +26,21 @@
import pooler
from osv import osv, fields
-class quality_check(wizard.interface):
+class quality_check(osv.osv_memory):
+ _name = "create.quality.check.wiz"
def _create_quality_check(self, cr, uid, data, context=None):
pool = pooler.get_pool(cr.dbname)
obj_quality = pool.get('module.quality.check')
objs = []
- for id in data['ids']:
+ for id in context['ids']:
module_data = pool.get('ir.module.module').browse(cr, uid, 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 _open_quality_check(self, 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))+"])]",
@@ -50,13 +51,6 @@
'type': 'ir.actions.act_window'
}
- 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:
\ No newline at end of file
+quality_check()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'base_module_quality/wizard/quality_save_report.py'
--- base_module_quality/wizard/quality_save_report.py 2011-01-14 00:11:01 +0000
+++ base_module_quality/wizard/quality_save_report.py 2011-10-04 10:43:38 +0000
@@ -23,39 +23,34 @@
import cStringIO
import wizard
-from osv import osv
+from osv import osv,fields
import pooler
from tools.translate import _
-form_rep = '''<?xml version="1.0"?>
-<form string="Standard entries">
- <field name="name"/>
- <newline/>
- <field name="module_file"/>
-</form>'''
-
-
-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 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'}
-
-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')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+class save_report(osv.osv_memory):
+ _name = 'quality.detail.save'
+ _columns = {
+ 'name': fields.char("File name", size=64, required=True, readonly = True, help = 'Save report as .html format'),
+ 'module_file': fields.binary('Save report',required = True),
+ }
+
+ 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 out
+
+ def get_name(self, cr, uid, datas, context=None):
+ data = pooler.get_pool(cr.dbname).get('module.quality.detail').browse(cr, uid, datas['id'])
+ return data.name + '.html'
+
+ _defaults = {
+ 'module_file' : get_detail,
+ 'name': get_name,
+ }
+save_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'google_map/google_map_wizard.xml'
--- google_map/google_map_wizard.xml 2011-01-14 00:11:01 +0000
+++ google_map/google_map_wizard.xml 2011-10-04 10:43:38 +0000
@@ -1,12 +1,28 @@
<?xml version="1.0" ?>
<openerp>
<data>
+ <record id="view_google_map_form" model="ir.ui.view">
+ <field name="name">launch.map.form</field>
+ <field name="model">launch.map</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Launch Map">
+ <group colspan="4" col="8">
+ <separator string="Launch Google Map" colspan="4"/>
+ <newline/>
+ <button string="_Cancel" icon="gtk-cancel" special="cancel" />
+ <button name="launch_wizard" type="object" string="Ok" icon="gtk-ok" />
+ </group>
+ </form>
+ </field>
+ </record>
- <wizard
- string="Launch Google Map"
- model="res.partner.address"
- name="google_map_launch"
- id="wizard_google_map"
- keyword="client_action_multi"/>
+ <act_window id="wizard_google_map"
+ multi="True"
+ key2="client_action_multi" name="Open Map"
+ context="{'ids': [active_id], 'id': active_id}"
+ res_model="launch.map" src_model="res.partner.address"
+ view_mode="form" target="new" view_type="form"
+ />
</data>
</openerp>
=== modified file 'google_map/wizard/google_map_launch.py'
--- google_map/wizard/google_map_launch.py 2011-01-14 00:11:01 +0000
+++ google_map/wizard/google_map_launch.py 2011-10-04 10:43:38 +0000
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# 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/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -25,37 +25,32 @@
from osv import fields
import time
-def _launch_wizard(self, cr, uid, data, context=None):
- address_obj= pooler.get_pool(cr.dbname).get('res.partner.address')
- m= address_obj.browse(cr, uid, data['id'], context=context)
- url=''
- url="http://maps.google.com/maps?oi=map&q="
- if m.street:
- url+=m.street.replace(' ','+')
- if m.street2:
- url+='+'+m.street2.replace(' ','+')
- if m.city:
- url+='+'+m.city.replace(' ','+')
- if m.state_id:
- url+='+'+m.state_id.name.replace(' ','+')
- if m.country_id:
- url+='+'+m.country_id.name.replace(' ','+')
- if m.zip:
- url+='+'+m.zip.replace(' ','+')
- return {
- 'type': 'ir.actions.act_url',
- 'url':url,
- 'target': 'new'
- }
-
-class launch_map(wizard.interface):
-
- states= {'init' : {'actions': [],
- 'result':{'type':'action',
- 'action': _launch_wizard,
- 'state':'end'}
- }
- }
-launch_map('google_map_launch')
+
+class launch_map(osv.osv_memory):
+ _name = 'launch.map'
+
+ def launch_wizard(self, cr, uid, data, context=None):
+
+ address_obj= pooler.get_pool(cr.dbname).get('res.partner.address')
+ m= address_obj.browse(cr, uid, context.get('id'), context=context)
+ url=''
+ url="http://maps.google.com/maps?oi=map&q="
+ if m.street:
+ url+=m.street.replace(' ','+')
+ if m.street2:
+ url+='+'+m.street2.replace(' ','+')
+ if m.city:
+ url+='+'+m.city.replace(' ','+')
+ if m.state_id:
+ url+='+'+m.state_id.name.replace(' ','+')
+ if m.country_id:
+ url+='+'+m.country_id.name.replace(' ','+')
+ if m.zip:
+ url+='+'+m.zip.replace(' ','+')
+ return {
+ 'type': 'ir.actions.act_url',
+ 'url':url,
+ 'target': 'new'
+ }
+launch_map()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
=== modified file 'share/res_users.py'
--- share/res_users.py 2011-09-30 08:27:49 +0000
+++ share/res_users.py 2011-10-04 10:43:38 +0000
@@ -24,7 +24,7 @@
_name = "res.groups"
_inherit = 'res.groups'
_columns = {
- 'share': fields.boolean('Share Group', readonly=True,
+ 'share': fields.boolean('Share Group', groups='share.group_share', readonly=True,
help="Group created to set access rights for sharing data with some users.")
}
res_groups()
@@ -33,7 +33,7 @@
_name = 'res.users'
_inherit = 'res.users'
_columns = {
- 'share': fields.boolean('Share User', readonly=True,
+ 'share': fields.boolean('Share User', groups='share.group_share', readonly=True,
help="External user with limited access, created only for the purpose of sharing data.")
}
res_users()
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp