From b73b0eadb615ec9cc2c5f99448e5fba1f46c650b Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 11 Mar 2010 12:01:19 +0530 Subject: [PATCH] [IMP] point_of_sale: Convert the pos_confirm wizard into osv_memory bzr revid: sbh@tinyerp.com-20100311063119-x9zo7cuj2jpv96gn --- addons/point_of_sale/__terp__.py | 1 + addons/point_of_sale/pos_wizard.xml | 8 -- addons/point_of_sale/wizard/__init__.py | 2 +- addons/point_of_sale/wizard/pos_confirm.py | 59 ++++++++++++++ addons/point_of_sale/wizard/wizard_confirm.py | 78 ------------------- 5 files changed, 61 insertions(+), 87 deletions(-) create mode 100644 addons/point_of_sale/wizard/pos_confirm.py delete mode 100644 addons/point_of_sale/wizard/wizard_confirm.py diff --git a/addons/point_of_sale/__terp__.py b/addons/point_of_sale/__terp__.py index 464cb57ccf4..a3c227b623d 100644 --- a/addons/point_of_sale/__terp__.py +++ b/addons/point_of_sale/__terp__.py @@ -44,6 +44,7 @@ Main features : 'pos_report.xml', 'pos_wizard.xml', 'wizard/pos_add_product.xml', + 'wizard/pos_confirm.xml', 'pos_view.xml', 'pos_sequence.xml', 'posrule_data.xml', diff --git a/addons/point_of_sale/pos_wizard.xml b/addons/point_of_sale/pos_wizard.xml index 325350d031b..36613ddce36 100644 --- a/addons/point_of_sale/pos_wizard.xml +++ b/addons/point_of_sale/pos_wizard.xml @@ -30,14 +30,6 @@ - diff --git a/addons/point_of_sale/wizard/__init__.py b/addons/point_of_sale/wizard/__init__.py index 155c9b40c8c..b94ba0a0d0e 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_confirm import wizard_discount import wizard_get_sale import wizard_scan_product @@ -39,5 +38,6 @@ import wizard_pos_details import wizard_open_statement import wizard_all_closed_cashbox_of_the_day import pos_add_product +import pos_confirm # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/point_of_sale/wizard/pos_confirm.py b/addons/point_of_sale/wizard/pos_confirm.py new file mode 100644 index 00000000000..460e0e67a56 --- /dev/null +++ b/addons/point_of_sale/wizard/pos_confirm.py @@ -0,0 +1,59 @@ +# -*- 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 pos_confirm(osv.osv_memory): + _name = 'pos.confirm' + _description = 'Point of Sale Confirm' + def action_confirm(self, cr, uid, ids, context): + """ + @summary: Confirm the order and close the sales . + @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 :Blank dictionary + """ + + this = self.browse(cr, uid, ids[0], context=context) + record_id = context and context.get('record_id',False) + if isinstance(record_id, (int, long)): + record_id=[record_id] + if record_id: + company_id=self.pool.get('res.users').browse(cr,uid,uid).company_id + order_obj = self.pool.get('pos.order') + + for order_id in order_obj.browse(cr, uid, record_id, context=context): + if order_id.state =='paid': + order_obj.write(cr,uid,[order_id.id],{'journal_entry':True}) + order_obj.create_account_move(cr, uid, [order_id.id], context=context) + + wf_service = netsvc.LocalService("workflow") + for i in record_id: + wf_service.trg_validate(uid, 'pos.order', i, 'done', cr) + return {} + +pos_confirm() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/point_of_sale/wizard/wizard_confirm.py b/addons/point_of_sale/wizard/wizard_confirm.py deleted file mode 100644 index b819c840ae5..00000000000 --- a/addons/point_of_sale/wizard/wizard_confirm.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################################## - - -import wizard -import netsvc -import pooler -import time - -_form = """ -
-