[IMP]: base_report_creator: Convert old base_report_creator_open wizard into osv_memory wizard report_open and report_open_view

bzr revid: atp@tinyerp.co.in-20100322101034-1mtsdi8kc1lgrfwf
This commit is contained in:
atp (Open ERP) 2010-03-22 15:40:34 +05:30
parent 765b10a0a4
commit a91dadcc9f
6 changed files with 114 additions and 23 deletions

View File

@ -38,6 +38,7 @@ the "Dashboard" menu.
'update_xml': [
'security/ir.model.access.csv',
'wizard/report_menu_create_view.xml',
'wizard/report_open_view.xml',
'base_report_creator_wizard.xml',
'base_report_creator_view.xml'
],

View File

@ -151,26 +151,11 @@
id="menu_base_report_creator_action"
action="base_report_creator_action_tree"/>
<wizard
id="wizard_report_open"
string="Open Report"
name="base_report_creator.report.open"/>
<record model="ir.values" id="ir_open_report">
<field name="key2" eval="'tree_but_open'"/>
<field name="model" eval="'base_report_creator.report'"/>
<field name="name">Browse Report</field>
<field name="value" eval="'ir.actions.wizard,%d'%wizard_report_open"/>
<field name="object" eval="True"/>
</record>
<record model="ir.values" id="ir_open_report_multi">
<field name="key2" eval="'client_action_multi'"/>
<field name="model" eval="'base_report_creator.report'"/>
<field name="name">Browse Report</field>
<field name="value" eval="'ir.actions.wizard,%d'%wizard_report_open"/>
<field name="object" eval="True"/>
</record>
<act_window id="action_report_open"
key2="client_action_multi" name="Open Report"
res_model="report.open" src_model="base_report_creator.report"
view_mode="form" target="new" view_type="form" />
</data>
</openerp>

View File

@ -3,3 +3,4 @@
"access_base_report_creator_report_fields","base_report_creator.report.fields","model_base_report_creator_report_fields","base.group_system",1,1,1,1
"access_base_report_creator_report_filter","base_report_creator.report.filter","model_base_report_creator_report_filter","base.group_system",1,1,1,1
"access_report_menu_create","report.menu.create","model_report_menu_create","base.group_system",1,1,1,1
"access_report_open","report.open","model_report_open","base.group_system",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 access_base_report_creator_report_fields base_report_creator.report.fields model_base_report_creator_report_fields base.group_system 1 1 1 1
4 access_base_report_creator_report_filter base_report_creator.report.filter model_base_report_creator_report_filter base.group_system 1 1 1 1
5 access_report_menu_create report.menu.create model_report_menu_create base.group_system 1 1 1 1
6 access_report_open report.open model_report_open base.group_system 1 1 1 1

View File

@ -20,8 +20,7 @@
##############################################################################
import wiz_set_filter_fields
import base_report_creator_open
import report_menu_create
import report_open
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,71 @@
# -*- 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 fields, osv
class report_open(osv.osv_memory):
"""
Open report
"""
_name = "report.open"
_description = __doc__
def open_report(self, cr, uid, ids, context=None):
"""
This Function opens base creator report view
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of report open's IDs
@param context: A standard dictionary for contextual values
@return : Dictionary value for base creator report form
"""
if not context:
context = {}
context_id = context and context.get('active_id', False) or False
if context.get('report_id', False):
raise osv.except_osv(_('UserError'), _('No Wizards available for this object!'))
rep = self.pool.get('base_report_creator.report').browse(cr, uid, context_id, context)
view_mode = rep.view_type1
if rep.view_type2:
view_mode += ',' + rep.view_type2
if rep.view_type3:
view_mode += ',' + rep.view_type3
value = {
'name': rep.name,
'view_type': 'form',
'view_mode': view_mode,
'res_model': 'base_report_creator.report',
'context': {'report_id': context_id},
'view_id': False,
'type': 'ir.actions.act_window'
}
return value
report_open()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Report Open wizard -->
<record id="view_report_open" model="ir.ui.view">
<field name="name">report.open.form</field>
<field name="model">report.open</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Report open">
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel"
string="Cancel" />
<button icon="gtk-open" string="Open Report"
name="open_report" type="object" />
</group>
</form>
</field>
</record>
<record id="action_report_open" model="ir.actions.act_window">
<field name="name">Open Report</field>
<field name="res_model">report.open</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_report_open"/>
<field name="target">new</field>
</record>
</data>
</openerp>