diff --git a/addons/point_of_sale/__init__.py b/addons/point_of_sale/__init__.py
index 0baf4639019..2d195b3d4a5 100644
--- a/addons/point_of_sale/__init__.py
+++ b/addons/point_of_sale/__init__.py
@@ -23,7 +23,6 @@
import pos
import account_bank_statement
import pos_account_bank_statement
-import stock
import wizard
import report
diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py
index 597be8eaea7..5d4df5a5f10 100644
--- a/addons/point_of_sale/pos.py
+++ b/addons/point_of_sale/pos.py
@@ -1331,4 +1331,13 @@ class product_product(osv.osv):
'disc_controle': lambda *a: True,
}
product_product()
+
+class stock_picking(osv.osv):
+
+ _inherit = 'stock.picking'
+ _columns = {
+ 'pos_order': fields.many2one('pos.order', 'Pos order'),
+ }
+stock_picking()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/pos_view.xml b/addons/point_of_sale/pos_view.xml
index d2cc102a047..0089d6369f6 100644
--- a/addons/point_of_sale/pos_view.xml
+++ b/addons/point_of_sale/pos_view.xml
@@ -66,7 +66,7 @@
+ attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'return':'return'}" />
diff --git a/addons/point_of_sale/stock.py b/addons/point_of_sale/stock.py
deleted file mode 100644
index 9d2b24d69b8..00000000000
--- a/addons/point_of_sale/stock.py
+++ /dev/null
@@ -1,37 +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 .
-#
-##############################################################################
-
-from osv import osv, fields
-import time
-import netsvc
-
-
-class stock_picking(osv.osv):
-
- _inherit = 'stock.picking'
- _columns = {
- 'pos_order': fields.many2one('pos.order', 'Pos order'),
- }
-stock_picking()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py
index d7cb3414814..565ae257180 100644
--- a/addons/point_of_sale/wizard/pos_payment.py
+++ b/addons/point_of_sale/wizard/pos_payment.py
@@ -123,8 +123,7 @@ class pos_make_payment(osv.osv_memory):
"""
return result
- def check(self, cr, uid, ids, context=None):
-
+ def check(self, cr, uid, ids, context):
"""Check the order:
if the order is not paid: continue payment,
if the order is paid print invoice (if wanted) or ticket.
@@ -153,8 +152,11 @@ class pos_make_payment(osv.osv_memory):
return self.create_invoice(cr,uid,ids,context)
else:
context.update({'flag': True})
- order_obj.action_paid(cr,uid,[active_id],context)
- order_obj.write(cr, uid, [active_id],{'state':'paid'})
+ order_obj.action_paid(cr,uid,[active_id],context)
+ if context.get('return'):
+ order_obj.write(cr, uid, [active_id],{'state':'done'})
+ else:
+ order_obj.write(cr, uid, [active_id],{'state':'paid'})
return self.print_report(cr, uid, ids, context)
if order.amount_paid > 0.0:
context.update({'flag': True})
diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py
index 31d18ef09a5..91a063df9a9 100644
--- a/addons/point_of_sale/wizard/pos_return.py
+++ b/addons/point_of_sale/wizard/pos_return.py
@@ -186,6 +186,7 @@ class pos_return(osv.osv_memory):
line_obj.copy(cr,uid,line.id,{'qty':-qty ,
'order_id': new_order,
})
+ order_obj.write(cr,uid, active_id, {'state':'done'})
order_obj.write(cr,uid, new_order, {'state':'done'})
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)
@@ -334,8 +335,9 @@ class add_product(osv.osv_memory):
})
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)
- obj=order_obj.browse(cr,uid, active_ids[0])
-
+ obj=order_obj.browse(cr,uid, active_ids[0])
+ context.update({'return':'return'})
+
if obj.amount_total != obj.amount_paid:
return {
'name': _('Make Payment'),