[IMP]Product:Optimize Code of Wiz

bzr revid: aag@tinyerp.co.in-20110407055147-knj8p33livb9dg23
This commit is contained in:
aag (OpenERP) 2011-04-07 11:21:47 +05:30
parent 656c2f2b53
commit ad21115835
5 changed files with 24 additions and 119 deletions

View File

@ -55,7 +55,7 @@ Print product labels with barcode.
'product_data.xml',
'product_report.xml',
'product_view.xml',
'wizard/res_product_installer.xml',
'wizard/product_installer.xml',
'product_shortcut_data.xml',
'pricelist_view.xml',
'partner_view.xml',

View File

@ -19,7 +19,6 @@
#
##############################################################################
import product_price
import res_product_installer
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_form_config_action" model="ir.actions.act_window">
<field name="name">Create some products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="product.product_normal_form_view"/>
</record>
<!-- register configuration wizard -->
<record id="config_wizard_res_product_installer" model="ir.actions.todo">
<field name="action_id" ref="product_form_config_action"/>
<field name="target">current</field>
<field name="restart">never</field>
<field name="state">skip</field>
</record>
</data>
</openerp>

View File

@ -1,54 +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 fields, osv
import pooler
class res_product_installer(osv.osv_memory):
_name = 'res.product.installer'
_inherit = 'res.config'
_columns = {
}
_defaults = {
}
def execute(self, cr, uid, ids, context=None):
if context is None:
context = {}
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'product', 'product_normal_form_view')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'product.product',
'views': [(id2, 'form')],
# 'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
'nodestroy':True,
}
res_product_installer()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- configartion view -->
<!---->
<!-- <record id="view_res_product_installer" model="ir.ui.view">-->
<!-- <field name="name">Configure Product</field>-->
<!-- <field name="model">res.product.installer</field>-->
<!-- <field name="type">form</field>-->
<!-- <field name="inherit_id" ref="base.res_config_view_base"/>-->
<!-- <field name="arch" type="xml">-->
<!-- <data>-->
<!-- <form position="attributes">-->
<!-- <attribute name="string">Product Application Configuration</attribute>-->
<!-- </form>-->
<!-- <separator string="title" position="attributes">-->
<!-- <attribute name="string">Configure Product</attribute>-->
<!-- </separator>-->
<!-- <xpath expr='//separator[@string="vsep"]' position='attributes'>-->
<!-- <attribute name='rowspan'>15</attribute>-->
<!-- <attribute name='string'></attribute>-->
<!-- </xpath>-->
<!-- <xpath expr='//button[@name="action_skip"]' position='replace'/>-->
<!-- </data>-->
<!-- </field>-->
<!-- </record>-->
<!---->
<!-- <record id="action_view_res_product_installer" model="ir.actions.act_window">-->
<!-- <field name="name">Configure Product</field>-->
<!-- <field name="type">ir.actions.act_window</field>-->
<!-- <field name="res_model">res.product.installer</field>-->
<!-- <field name="view_id" ref="view_res_product_installer"/>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">form</field>-->
<!-- <field name="target">new</field>-->
<!-- </record>-->
<!---->
<!-- register configuration wizard -->
<!-- <record id="config_wizard_res_product_installer" model="ir.actions.todo">-->
<!-- <field name="action_id" ref="action_view_res_product_installer"/>-->
<!-- <field name="restart">on_trigger</field>-->
<!-- </record>-->
<!-- -->
<record id="product_form_config_action" model="ir.actions.act_window">
<field name="name">Create some products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="product.product_normal_form_view"/>
</record>
<!-- register configuration wizard -->
<record id="config_wizard_res_product_installer" model="ir.actions.todo">
<field name="action_id" ref="product_form_config_action"/>
<field name="target">current</field>
<field name="restart">never</field>
<field name="state">skip</field>
</record>
</data>
</openerp>