summaryrefslogtreecommitdiff
path: root/addons/base_module_doc_rst/wizard
diff options
context:
space:
mode:
authorKuldeep Joshi (OpenERP) <kjo@tinyerp.com>2012-02-02 15:57:13 +0530
committerKuldeep Joshi (OpenERP) <kjo@tinyerp.com>2012-02-02 15:57:13 +0530
commit580bd71dc7a0e1db5e9bf1a716893d637d1bbdbe (patch)
tree174a6345ce4e70dad8fde3f65889095728fa0f2d /addons/base_module_doc_rst/wizard
parentc7013988a265a966f03e555939e674e791c5559c (diff)
parent48cc23e6e1c16d5c8f37b6bfc9d406449a35587e (diff)
[FIX] base_module_record,base_module_doc_rst: change to osv.osv_memory
bzr revid: kjo@tinyerp.com-20120202102713-a0y7medo4izgrd71
Diffstat (limited to 'addons/base_module_doc_rst/wizard')
-rw-r--r--addons/base_module_doc_rst/wizard/__init__.py2
-rw-r--r--addons/base_module_doc_rst/wizard/generate_relation_graph.py32
-rw-r--r--addons/base_module_doc_rst/wizard/generate_relation_graph_view.xml39
-rw-r--r--addons/base_module_doc_rst/wizard/tech_guide_rst_view.xml30
-rw-r--r--addons/base_module_doc_rst/wizard/tech_rst_guide.py (renamed from addons/base_module_doc_rst/wizard/wizard_tech_guide_rst.py)51
5 files changed, 97 insertions, 57 deletions
diff --git a/addons/base_module_doc_rst/wizard/__init__.py b/addons/base_module_doc_rst/wizard/__init__.py
index c6614aacbc1..b3c66d995c1 100644
--- a/addons/base_module_doc_rst/wizard/__init__.py
+++ b/addons/base_module_doc_rst/wizard/__init__.py
@@ -19,7 +19,7 @@
#
##############################################################################
-import wizard_tech_guide_rst
+import tech_rst_guide
import generate_relation_graph
diff --git a/addons/base_module_doc_rst/wizard/generate_relation_graph.py b/addons/base_module_doc_rst/wizard/generate_relation_graph.py
index 9f789f0cc7a..5d2b7e9d3ef 100644
--- a/addons/base_module_doc_rst/wizard/generate_relation_graph.py
+++ b/addons/base_module_doc_rst/wizard/generate_relation_graph.py
@@ -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: \ No newline at end of file
diff --git a/addons/base_module_doc_rst/wizard/generate_relation_graph_view.xml b/addons/base_module_doc_rst/wizard/generate_relation_graph_view.xml
new file mode 100644
index 00000000000..29af49e6da9
--- /dev/null
+++ b/addons/base_module_doc_rst/wizard/generate_relation_graph_view.xml
@@ -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> \ No newline at end of file
diff --git a/addons/base_module_doc_rst/wizard/tech_guide_rst_view.xml b/addons/base_module_doc_rst/wizard/tech_guide_rst_view.xml
new file mode 100644
index 00000000000..2d95e828b10
--- /dev/null
+++ b/addons/base_module_doc_rst/wizard/tech_guide_rst_view.xml
@@ -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> \ No newline at end of file
diff --git a/addons/base_module_doc_rst/wizard/wizard_tech_guide_rst.py b/addons/base_module_doc_rst/wizard/tech_rst_guide.py
index 39933c39a3e..82513fdc892 100644
--- a/addons/base_module_doc_rst/wizard/wizard_tech_guide_rst.py
+++ b/addons/base_module_doc_rst/wizard/tech_rst_guide.py
@@ -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: \ No newline at end of file