summaryrefslogtreecommitdiff
path: root/addons/base_module_record/wizard
diff options
context:
space:
mode:
authorMustufa Rangwala (OpenERP) <mra@tinyerp.com>2011-09-08 12:36:49 +0530
committerMustufa Rangwala (OpenERP) <mra@tinyerp.com>2011-09-08 12:36:49 +0530
commit36801f6fb0da27b339e4e4ff171b034749b77f88 (patch)
treeb923ea43b512ab49c488cce073b6bf30b7be6daa /addons/base_module_record/wizard
parent13589722908ae38002899ebec1f416ec9bd9b3ee (diff)
[IMP] base_module_record: record save => Code improvement, remove pooler
bzr revid: mra@tinyerp.com-20110908070649-npoyi70r3zilmcw1
Diffstat (limited to 'addons/base_module_record/wizard')
-rw-r--r--addons/base_module_record/wizard/base_module_save.py33
1 files changed, 14 insertions, 19 deletions
diff --git a/addons/base_module_record/wizard/base_module_save.py b/addons/base_module_record/wizard/base_module_save.py
index 5991174202e..1d54e212a28 100644
--- a/addons/base_module_record/wizard/base_module_save.py
+++ b/addons/base_module_record/wizard/base_module_save.py
@@ -19,33 +19,30 @@
#
##############################################################################
-import wizard
-import pooler
-import tools
import zipfile
import StringIO
import base64
+
+import tools
from tools.translate import _
from osv import osv, fields
-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, ids, 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)
data = self.read(cr, uid, ids, [], context=context)[0]
- s=StringIO.StringIO()
+ s = StringIO.StringIO()
zip = zipfile.ZipFile(s, 'w')
dname = data['directory_name']
data['update_name'] = ''
@@ -90,9 +87,8 @@ class base_module_save(osv.osv_memory):
_name = 'base.module.save'
_description = "Base Module Save"
- def default_get(self, cr, uid, fields, context):
- pool = pooler.get_pool(cr.dbname)
- mod = pool.get('ir.module.record')
+ 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)
@@ -120,15 +116,13 @@ class base_module_save(osv.osv_memory):
'info_yaml': fields.boolean('YAML'),
}
- def record_save(self, cr, uid, ids, context):
+ def record_save(self, cr, uid, ids, context=None):
data = self.read(cr, uid, ids, [], context=context)[0]
- pool = pooler.get_pool(cr.dbname)
- mod = pool.get('ir.module.record')
+ mod = self.pool.get('ir.module.record')
mod_obj = self.pool.get('ir.model.data')
if len(mod.recording_data):
if data['info_yaml']:
- pool = pooler.get_pool(cr.dbname)
- mod = pool.get('ir.module.record')
+ 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']
@@ -170,6 +164,7 @@ class base_module_save(osv.osv_memory):
'type': 'ir.actions.act_window',
'target': 'new',
}
+
base_module_save()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file