diff options
| author | sbh (Open ERP) <sbh@tinyerp.com> | 2010-04-15 14:57:22 +0530 |
|---|---|---|
| committer | sbh (Open ERP) <sbh@tinyerp.com> | 2010-04-15 14:57:22 +0530 |
| commit | 3c0443a9d366ee64fcc1cb1561e17dbcc68bb2bc (patch) | |
| tree | 721aee4e29f7796f3acb607ec82096f62a58e851 | |
| parent | 5623ed5e8c0cec0a636dc8f9ba125ae02d4eab3f (diff) | |
[IMP] product:convert the price_list wizard into osv_memory wizard
bzr revid: sbh@tinyerp.com-20100415092722-snzdrw61zoolk367
| -rw-r--r-- | addons/product/__terp__.py | 2 | ||||
| -rw-r--r-- | addons/product/product_wizard.xml | 11 | ||||
| -rw-r--r-- | addons/product/wizard/__init__.py | 2 | ||||
| -rw-r--r-- | addons/product/wizard/product_price.py | 67 | ||||
| -rw-r--r-- | addons/product/wizard/product_price_view.xml | 33 | ||||
| -rw-r--r-- | addons/product/wizard/wizard_price.py | 59 |
6 files changed, 102 insertions, 72 deletions
diff --git a/addons/product/__terp__.py b/addons/product/__terp__.py index 4128e992c82..b3e18ced10a 100644 --- a/addons/product/__terp__.py +++ b/addons/product/__terp__.py @@ -49,13 +49,13 @@ 'update_xml': [ 'security/product_security.xml', 'security/ir.model.access.csv', + 'wizard/product_price_view.xml', 'product_data.xml', 'product_report.xml', 'product_view.xml', 'pricelist_view.xml', 'partner_view.xml', 'company_view.xml', - 'product_wizard.xml', 'process/product_process.xml' ], 'installable': True, diff --git a/addons/product/product_wizard.xml b/addons/product/product_wizard.xml deleted file mode 100644 index f226cd4e543..00000000000 --- a/addons/product/product_wizard.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" ?> -<openerp> - <data> - <wizard - id="report_wizard_price" - string="Price List" - model="product.product" - name="product.price_list" - keyword="client_print_multi"/> - </data> -</openerp> diff --git a/addons/product/wizard/__init__.py b/addons/product/wizard/__init__.py index fed1bcf3783..47f5f2641fc 100644 --- a/addons/product/wizard/__init__.py +++ b/addons/product/wizard/__init__.py @@ -18,7 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## -import wizard_price +import product_price # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/product/wizard/product_price.py b/addons/product/wizard/product_price.py new file mode 100644 index 00000000000..e5d73945c13 --- /dev/null +++ b/addons/product/wizard/product_price.py @@ -0,0 +1,67 @@ +# -*- 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 +from tools.translate import _ + + +class product_price_list(osv.osv_memory): + _name = 'product.price_list' + _description = 'Product Price List' + + _columns = { + 'price_list': fields.many2one('product.pricelist', 'PriceList', required=True), + 'qty1': fields.integer('Quantity-1'), + 'qty2': fields.integer('Quantity-2'), + 'qty3': fields.integer('Quantity-3'), + 'qty4': fields.integer('Quantity-4'), + 'qty5': fields.integer('Quantity-5'), + } + _defaults = { + 'qty1': lambda *a: 0, + 'qty2': lambda *a: 0, + 'qty3': lambda *a: 0, + 'qty4': lambda *a: 0, + 'qty5': lambda *a: 0, + } + + def print_report(self, cr, uid, ids, context=None): + + """ + To get the date and print the report + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param context: A standard dictionary + @return : return report + """ + datas = {'ids': context.get('active_ids', [])} + res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context) + res = res and res[0] or {} + datas['form'] = res + return { + 'type': 'ir.actions.report.xml', + 'report_name': 'product.pricelist', + 'datas': datas, + } +product_price_list() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/product/wizard/product_price_view.xml b/addons/product/wizard/product_price_view.xml new file mode 100644 index 00000000000..17d9010ed43 --- /dev/null +++ b/addons/product/wizard/product_price_view.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> + + <!-- Product Price List --> + + <record id="view_product_price_list" model="ir.ui.view"> + <field name="name">Price List</field> + <field name="model">product.price_list</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Price list"> + <field name="price_list" /> + <field name="qty1" colspan="2" /> + <field name="qty2" colspan="2" /> + <field name="qty3" colspan="2" /> + <field name="qty4" colspan="2" /> + <field name="qty5" colspan="2" /> + <button icon='gtk-cancel' special="cancel" + string="Close" /> + <button name="print_report" string="Print Report" + colspan="1" type="object" icon="gtk-print" /> + </form> + </field> + </record> + + <act_window id="action_product_price_list" + key2="client_action_multi" name="Price List" + res_model="product.price_list" src_model="product.product" + view_mode="form" target="new" view_type="form" /> + +</data> +</openerp> diff --git a/addons/product/wizard/wizard_price.py b/addons/product/wizard/wizard_price.py deleted file mode 100644 index 12c810b802d..00000000000 --- a/addons/product/wizard/wizard_price.py +++ /dev/null @@ -1,59 +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 wizard - -qty1_form = '''<?xml version="1.0"?> -<form string="Price list"> - <field name="price_list" /> - <field name="qty1" colspan="2" /> - <field name="qty2" colspan="2" /> - <field name="qty3" colspan="2" /> - <field name="qty4" colspan="2" /> - <field name="qty5" colspan="2" /> - -</form>''' -qty1_fields = { - 'price_list' : {'string' : 'PriceList', 'type' : 'many2one', 'relation' : 'product.pricelist', 'required':True }, - 'qty1': {'string':'Quantity-1', 'type':'integer', 'default':0}, - 'qty2': {'string':'Quantity-2', 'type':'integer', 'default':0}, - 'qty3': {'string':'Quantity-3', 'type':'integer', 'default':0}, - 'qty4': {'string':'Quantity-4', 'type':'integer', 'default':0}, - 'qty5': {'string':'Quantity-5', 'type':'integer', 'default':0}, -} - - -class wizard_qty(wizard.interface): - - states = { - 'init': { - 'actions': [], - 'result': {'type':'form', 'arch':qty1_form, 'fields':qty1_fields, 'state':[('end','Cancel'),('price','Print')]} - }, - 'price': { - 'actions': [], - 'result': {'type':'print', 'report':'product.pricelist', 'state':'end'} - } - - } -wizard_qty('product.price_list') -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - |
