From cefc85c5841ce79144fcc569db79972961be388f Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Wed, 10 Mar 2010 19:25:48 +0530 Subject: [PATCH] [IMP] point_of_sale: Converted Add Product wizard into osv_memory wizard bzr revid: sbh@tinyerp.com-20100310135548-810h40effu2jtwft --- addons/point_of_sale/__terp__.py | 1 + addons/point_of_sale/wizard/__init__.py | 2 +- .../point_of_sale/wizard/pos_add_product.py | 66 ++++++++++++++ .../point_of_sale/wizard/pos_add_product.xml | 35 ++++++++ .../wizard/wizard_add_product.py | 88 ------------------- 5 files changed, 103 insertions(+), 89 deletions(-) create mode 100644 addons/point_of_sale/wizard/pos_add_product.py create mode 100644 addons/point_of_sale/wizard/pos_add_product.xml delete mode 100644 addons/point_of_sale/wizard/wizard_add_product.py diff --git a/addons/point_of_sale/__terp__.py b/addons/point_of_sale/__terp__.py index 794793e3baa..464cb57ccf4 100644 --- a/addons/point_of_sale/__terp__.py +++ b/addons/point_of_sale/__terp__.py @@ -43,6 +43,7 @@ Main features : 'security/ir.model.access.csv', 'pos_report.xml', 'pos_wizard.xml', + 'wizard/pos_add_product.xml', 'pos_view.xml', 'pos_sequence.xml', 'posrule_data.xml', diff --git a/addons/point_of_sale/wizard/__init__.py b/addons/point_of_sale/wizard/__init__.py index 1ff9c124861..155c9b40c8c 100644 --- a/addons/point_of_sale/wizard/__init__.py +++ b/addons/point_of_sale/wizard/__init__.py @@ -23,7 +23,6 @@ import wizard_pos_payment import wizard_default_journal import wizard_refund_order -import wizard_add_product import wizard_confirm import wizard_discount import wizard_get_sale @@ -39,5 +38,6 @@ import wizard_pos_sales_user_current_user import wizard_pos_details import wizard_open_statement import wizard_all_closed_cashbox_of_the_day +import pos_add_product # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/point_of_sale/wizard/pos_add_product.py b/addons/point_of_sale/wizard/pos_add_product.py new file mode 100644 index 00000000000..e11dd89e3d9 --- /dev/null +++ b/addons/point_of_sale/wizard/pos_add_product.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +import netsvc +from osv import osv,fields +from tools.translate import _ + +class add_product(osv.osv_memory): + _name = 'pos.add.product' + _description = 'Add Product' + + _columns = { + 'product_id': fields.many2one('product.product', 'Product',required=True), + 'quantity': fields.float('Quantity ', required=True), + } + _defaults = { + 'quantity': lambda *a: 1, + } + + def select_product(self, cr, uid, ids, context): + """ + @summary: To get the product and quantity and add in order . + @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 : Retrun the add product form again for addin more product + """ + this = self.browse(cr, uid, ids[0], context=context) + record_id = context and context.get('record_id',False) + if record_id: + order_obj = self.pool.get('pos.order') + order_obj.add_product(cr, uid, record_id, this.product_id.id,this.quantity,context=context) + + return { + 'name': _('Add Product'), + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'pos.add.product', + 'view_id': False, + 'target':'new', + 'views': False, + 'type': 'ir.actions.act_window', + } +add_product() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/point_of_sale/wizard/pos_add_product.xml b/addons/point_of_sale/wizard/pos_add_product.xml new file mode 100644 index 00000000000..fe9d7ed7418 --- /dev/null +++ b/addons/point_of_sale/wizard/pos_add_product.xml @@ -0,0 +1,35 @@ + + + + + + + Add Product + pos.add.product + form + +
+ + + +