[FIX] point_of_sale: opw-607551, mark the pos order as paid before trying to create...
authorDenis Ledoux <dle@openerp.com>
Mon, 19 May 2014 13:33:39 +0000 (15:33 +0200)
committerDenis Ledoux <dle@openerp.com>
Mon, 19 May 2014 13:33:39 +0000 (15:33 +0200)
This commit partially reverts rev. 6036 revid:fp@tinyerp.com-20111219220053-tn5gc1lmc13fjpyf, the second part of this commit already has been revert in a previous revision.

addons/point_of_sale/point_of_sale.py

index 76c48d2..2768cf8 100644 (file)
@@ -537,7 +537,7 @@ class pos_order(osv.osv):
             try:
                 wf_service.trg_validate(uid, 'pos.order', order_id, 'paid', cr)
             except Exception:
-                _logger.error('ERROR: Could not mark POS Order as Paid.', exc_info=True)
+                _logger.error('ERROR: Could not fully process the POS Order', exc_info=True)
         return order_ids
 
     def write(self, cr, uid, ids, vals, context=None):
@@ -692,8 +692,6 @@ class pos_order(osv.osv):
         move_obj = self.pool.get('stock.move')
 
         for order in self.browse(cr, uid, ids, context=context):
-            if not order.state=='draft':
-                continue
             addr = order.partner_id and partner_obj.address_get(cr, uid, [order.partner_id.id], ['delivery']) or {}
             picking_id = picking_obj.create(cr, uid, {
                 'origin': order.name,
@@ -1136,8 +1134,8 @@ class pos_order(osv.osv):
         return self.write(cr, uid, ids, {'state': 'payment'}, context=context)
 
     def action_paid(self, cr, uid, ids, context=None):
-        self.create_picking(cr, uid, ids, context=context)
         self.write(cr, uid, ids, {'state': 'paid'}, context=context)
+        self.create_picking(cr, uid, ids, context=context)
         return True
 
     def action_cancel(self, cr, uid, ids, context=None):