Ashvin Rathod (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-base_module_doc_rst_osv_memory_convert-ara
 into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-base_module_doc_rst_osv_memory_convert-ara/+merge/74077

Hello,

Convert wizard.interface to osv memory wizard for base_module_doc_rst module

Thanks,
ara
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-base_module_doc_rst_osv_memory_convert-ara/+merge/74077
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-base_module_doc_rst_osv_memory_convert-ara.
=== modified file 'base_module_doc_rst/__openerp__.py'
--- base_module_doc_rst/__openerp__.py	2011-03-18 14:06:18 +0000
+++ base_module_doc_rst/__openerp__.py	2011-09-05 11:14:18 +0000
@@ -35,7 +35,7 @@
     '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': ['base_module_doc_rst_view.xml', 'module_report.xml', 'wizard/generate_relationship_graph_view.xml', 'wizard/tech_guide_rst_view.xml'],
     'demo_xml': [],
     'installable': True,
     'certificate': '001288481437217734509',

=== removed 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	1970-01-01 00:00:00 +0000
@@ -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>

=== 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-09-05 11:14:18 +0000
@@ -18,32 +18,22 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
-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="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')
-
+
+class relationship_graph(osv.osv_memory):
+
+    _name = "relationship.graph"
+    _descritption = 'Relationship Graph'
+    
+    def generate_graph(self, cr, uid, fields, context=None):
+        mod_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
+        modules = mod_obj.browse(cr, uid, context.get('active_ids', False), 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'}
+    
+relationship_graph()
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file

=== added file 'base_module_doc_rst/wizard/generate_relationship_graph_view.xml'
--- base_module_doc_rst/wizard/generate_relationship_graph_view.xml	1970-01-01 00:00:00 +0000
+++ base_module_doc_rst/wizard/generate_relationship_graph_view.xml	2011-09-05 11:14:18 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="generate_relation_graph_view" model="ir.ui.view">
+            <field name="name">Generate Relationship Graph</field>
+            <field name="model">relationship.graph</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Relationship Graph">
+                    <label colspan="2" string="Relationship Graphs generated"/>
+                    <newline/>
+                    <button name="generate_graph" icon="gtk-ok" string="Ok" type="object"/>
+                </form>
+            </field>
+        </record>
+
+        <act_window
+            id="act_generate_relationship_graph"
+            name="Generate Relationship Graph"
+            res_model="relationship.graph"
+            src_model="ir.module.module"
+            view_mode="form"
+            target="new"
+            key2="client_action_multi"/>
+
+    </data>
+</openerp>
\ No newline at end of file

=== added file 'base_module_doc_rst/wizard/tech_guide_rst_view.xml'
--- base_module_doc_rst/wizard/tech_guide_rst_view.xml	1970-01-01 00:00:00 +0000
+++ base_module_doc_rst/wizard/tech_guide_rst_view.xml	2011-09-05 11:14:18 +0000
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="technical_guide_rst_view" model="ir.ui.view">
+            <field name="name">Create RST Technical Guide</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" col="4">
+                    <separator string="Technical Guide in rst format" colspan="6"/>
+                    <label string="Please choose a file where the Technical Guide will be written." colspan="6"/>
+                    <field name="rst_file" colspan="4"/>
+                    <field name="name" invisible="1"/>
+                    <separator string="" colspan="6"/>
+                    <group colspan="6" col="4" >
+                        <label string="" colspan="3"/>
+                        <button icon="gtk-close" special="cancel" string="Close"/>
+                    </group>
+                </form>
+            </field>
+        </record>
+
+        <act_window
+            id="act_technical_guide_rst"
+            name="Create RST Technical Guide"
+            res_model="tech.guide.rst"
+            src_model="ir.module.module"
+            view_mode="form"
+            target="new"
+            multi="True"
+            key2="client_action_multi"/>
+
+    </data>
+</openerp>

=== modified file 'base_module_doc_rst/wizard/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/wizard_tech_guide_rst.py	2011-09-05 11:14:18 +0000
@@ -18,6 +18,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
+from osv import osv, fields
 from os.path import join
 import base64
 import tempfile
@@ -25,28 +26,11 @@
 import httplib
 
 import netsvc
-import wizard
 import pooler
 import os
 import tools
-
 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 +306,20 @@
         return s
 
 
-class wizard_tech_guide_rst(wizard.interface):
-
-
-    def _generate(self, cr, uid, data, context):
+class tech_guide_rst(osv.osv_memory):
+
+    _name = 'tech.guide.rst'
+    _descritption = 'Technical Guide RST'
+    
+    _columns = {
+        'rst_file': fields.binary('file', required=True, readonly=True),
+        'name': fields.char('filename', required=True, size=64, readonly=True),
+   }
+
+    def default_get(self, cr, uid, fields, context):
         pool = pooler.get_pool(cr.dbname)
         module_model = pool.get('ir.module.module')
-        module_ids = data['ids']
-
+        module_ids = module_model.browse(cr, uid, context.get('active_ids', False), context=context)
         module_index = []
 
         # create a temporary gzipped tarfile:
@@ -337,8 +327,7 @@
         try:
             tarf = tarfile.open(tgz_tmp_filename, 'w:gz')
 
-            modules = module_model.browse(cr, uid, module_ids)
-            for module in modules:
+            for module in module_ids:
                 index_dict = {
                     'name': module.name,
                     'shortdesc': module.shortdesc,
@@ -491,19 +480,5 @@
             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')
+tech_guide_rst()
 

_______________________________________________
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

Reply via email to