summaryrefslogtreecommitdiff
path: root/addons/base_module_record/wizard
diff options
context:
space:
mode:
authorAntony Lesuisse <al@openerp.com>2012-10-02 17:58:59 +0200
committerAntony Lesuisse <al@openerp.com>2012-10-02 17:58:59 +0200
commit17796fce4136800faeff9f8b553ed5c7d8e9d54c (patch)
treea9510c2d07f1533d74012ab9e0c02d9419470666 /addons/base_module_record/wizard
parentc7ec79dcda0cdba9234a5c3f0c6eb76c902ac5e2 (diff)
[REM] modules moved to openerp-extra
bzr revid: al@openerp.com-20121002155859-dfe6lycimc87tw93
Diffstat (limited to 'addons/base_module_record/wizard')
-rw-r--r--addons/base_module_record/wizard/__init__.py26
-rw-r--r--addons/base_module_record/wizard/base_module_record_data.py134
-rw-r--r--addons/base_module_record/wizard/base_module_record_data_view.xml63
-rw-r--r--addons/base_module_record/wizard/base_module_record_object_view.xml129
-rw-r--r--addons/base_module_record/wizard/base_module_record_objects.py173
-rw-r--r--addons/base_module_record/wizard/base_module_save.py169
-rw-r--r--addons/base_module_record/wizard/base_module_save_view.xml50
7 files changed, 0 insertions, 744 deletions
diff --git a/addons/base_module_record/wizard/__init__.py b/addons/base_module_record/wizard/__init__.py
deleted file mode 100644
index 533abfd84dc..00000000000
--- a/addons/base_module_record/wizard/__init__.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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/>.
-#
-##############################################################################
-
-import base_module_save
-import base_module_record_objects
-import base_module_record_data
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/base_module_record/wizard/base_module_record_data.py b/addons/base_module_record/wizard/base_module_record_data.py
deleted file mode 100644
index cb1e9507495..00000000000
--- a/addons/base_module_record/wizard/base_module_record_data.py
+++ /dev/null
@@ -1,134 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
-# $Id$
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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/>.
-#
-##############################################################################
-
-from osv import osv, fields
-import tools
-from tools.translate import _
-
-import time
-
-class base_module_data(osv.osv_memory):
- _name = 'base.module.data'
- _description = "Base Module Data"
-
- _columns = {
- 'check_date': fields.datetime('Record from Date', required=True),
- 'objects': fields.many2many('ir.model', 'base_module_record_model_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'),
- }
-
- def _get_default_objects(self, cr, uid, context=None):
- names = ('ir.ui.view', 'ir.ui.menu', 'ir.model', 'ir.model.fields', 'ir.model.access',
- 'res.partner', 'res.partner.category', 'workflow',
- 'workflow.activity', 'workflow.transition', 'ir.actions.server', 'ir.server.object.lines')
- return self.pool.get('ir.model').search(cr, uid, [('model', 'in', names)])
-
- _defaults = {
- 'check_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
- 'objects': _get_default_objects,
- '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)
- 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': _('Data Recording'),
- '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': _('Module Recording'),
- '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()
-
-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:
diff --git a/addons/base_module_record/wizard/base_module_record_data_view.xml b/addons/base_module_record/wizard/base_module_record_data_view.xml
deleted file mode 100644
index afe9833c209..00000000000
--- a/addons/base_module_record/wizard/base_module_record_data_view.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?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="arch" type="xml">
- <form string="Data Recording" version="7.0">
- <group>
- <field name="check_date"/>
- <field name="filter_cond"/>
- </group>
- <separator string="Choose objects to record"/>
- <field name="objects"/>
- <group><field name="info_yaml"/></group>
- <footer>
- <button name="record_objects" string="Record" type="object" class="oe_highlight"/>
- or
- <button string="Cancel" class="oe_link" special="cancel"/>
- </footer>
- </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="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"/>
- </form>
- </field>
- </record>
- </data>
-</openerp>
diff --git a/addons/base_module_record/wizard/base_module_record_object_view.xml b/addons/base_module_record/wizard/base_module_record_object_view.xml
deleted file mode 100644
index fdfb6e9fc66..00000000000
--- a/addons/base_module_record/wizard/base_module_record_object_view.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?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="arch" type="xml">
- <form string="Objects Recording" version="7.0">
- <group>
- <field name="check_date"/>
- <field name="filter_cond"/>
- </group>
- <separator string="Choose objects to record"/>
- <field name="objects"/>
- <group><field name="info_yaml"/></group>
- <footer>
- <button name="record_objects" string="Record" type="object" class="oe_highlight"/>
- or
- <button string="Cancel" class="oe_link" special="cancel"/>
- </footer>
- </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"/>
-
- <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="arch" type="xml">
- <form string="Module Recording">
- <group string="Module successfully created!">
- <field name="module_filename"/>
- <field name="module_file"/>
- </group>
- <separator string="Information"/>
- <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." align="0.0"/>
- <label string="Thanks in advance for your contribution." align="0.0"/>
- </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="arch" type="xml">
- <form string="Module Recording" version="7.0">
- <group string="Module Information">
- <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"/>
- </group>
- <separator string="Description"/>
- <field name="description"/>
- <footer>
- <button string="Continue" name="inter_call" type="object" class="oe_highlight"/>
- or
- <button string="Cancel" class="oe_link" special="cancel"/>
- </footer>
- </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="arch" type="xml">
- <form string="Module Recording">
- <label string="Thanks For using Module Recorder" colspan="4" align="0.0"/>
- </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="arch" type="xml">
- <form string="Module Recording">
- <separator string="YAML file successfully created !" colspan="4"/>
- <newline/>
- <field name="yaml_file" filename="module_filename"/>
- </form>
- </field>
- </record>
-
- </data>
-</openerp>
diff --git a/addons/base_module_record/wizard/base_module_record_objects.py b/addons/base_module_record/wizard/base_module_record_objects.py
deleted file mode 100644
index de2c6861c44..00000000000
--- a/addons/base_module_record/wizard/base_module_record_objects.py
+++ /dev/null
@@ -1,173 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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/>.
-#
-##############################################################################
-
-from osv import osv, fields
-import tools
-from tools.translate import _
-import base_module_save
-
-import time
-
-class base_module_record(osv.osv_memory):
- _name = 'base.module.record'
- _description = "Base Module Record"
-
- _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'),
- }
-
- def _get_default_objects(self, cr, uid, context=None):
- names = ('ir.ui.view', 'ir.ui.menu', 'ir.model', 'ir.model.fields', 'ir.model.access',
- 'res.partner', 'res.partner.category', 'workflow',
- 'workflow.activity', 'workflow.transition', 'ir.actions.server', 'ir.server.object.lines')
- return self.pool.get('ir.model').search(cr, uid, [('model', 'in', names)])
-
- _defaults = {
- 'check_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
- 'objects': _get_default_objects,
- '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:
diff --git a/addons/base_module_record/wizard/base_module_save.py b/addons/base_module_record/wizard/base_module_save.py
deleted file mode 100644
index a63e7197654..00000000000
--- a/addons/base_module_record/wizard/base_module_save.py
+++ /dev/null
@@ -1,169 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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/>.
-#
-##############################################################################
-
-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=None):
- mod = self.pool.get('ir.module.record')
- try:
- res_xml = mod.generate_yaml(cr, uid)
- except Exception, e:
- raise osv.except_osv(_('Error!'),_(str(e)))
- return {
- 'yaml_file': base64.encodestring(res_xml),
-}
-
-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()
- zip = zipfile.ZipFile(s, 'w')
- 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['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",
- "author" : "%(author)s",
- "website" : "%(website)s",
- "category" : "%(category)s",
- "description": \"\"\"%(description)s\"\"\",
- "depends" : [%(depends)s],
- "demo" : [ %(demo_name)s],
- "data" : [%(update_name)s],
- "installable": True
-} """ % data
- filewrite = {
- '__init__.py':'#\n# Generated by the OpenERP module recorder !\n#\n',
- '__openerp__.py':_terp,
- dname+'_data.xml': res_xml
- }
- for name,datastr in filewrite.items():
- info = zipfile.ZipInfo(dname+'/'+name)
- info.compress_type = zipfile.ZIP_DEFLATED
- info.external_attr = 2175008768
- if not datastr:
- datastr = ''
- zip.writestr(info, datastr)
- zip.close()
- return {
- 'module_file': base64.encodestring(s.getvalue()),
- 'module_filename': data['directory_name']+'-'+data['version']+'.zip'
- }
-
-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'),
- }
-
- 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:
diff --git a/addons/base_module_record/wizard/base_module_save_view.xml b/addons/base_module_record/wizard/base_module_save_view.xml
deleted file mode 100644
index 361e65344f1..00000000000
--- a/addons/base_module_record/wizard/base_module_save_view.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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="arch" type="xml">
- <form string="Module Recording" version="7.0">
- <group string="Recording Information">
- <field name="info_status"/>
- <field name="info_text"/>
- <field name="info_yaml"/>
- </group>
- <footer>
- <button name="record_save" string="Continue" type="object" class="oe_highlight"/>
- or
- <button string="Cancel" class="oe_link" special="cancel"/>
- </footer>
- </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>