[FIX] sale, sale_stock: fixing problems and workflow related to the shipping_except...
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Tue, 15 Oct 2013 15:00:35 +0000 (17:00 +0200)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Tue, 15 Oct 2013 15:00:35 +0000 (17:00 +0200)
bzr revid: qdp-launchpad@openerp.com-20131015150035-ccdbua7e881adwx7

addons/sale/sale_workflow.xml
addons/sale_stock/sale_stock.py
addons/sale_stock/test/cancel_order_sale_stock.yml

index 41794d6..b8e29ac 100644 (file)
         <record id="trans_ship_ship_except" model="workflow.transition">
             <field name="act_from" ref="act_ship"/>
             <field name="act_to" ref="act_ship_except"/>
-            <field name="condition">test_state('canceled')</field>
+            <field name="signal">ship_except</field>
         </record>
         
         <record id="trans_ship_except_ship" model="workflow.transition">
index c7f0684..8ba711b 100644 (file)
@@ -395,6 +395,15 @@ class sale_order_line(osv.osv):
 class stock_move(osv.osv):
     _inherit = 'stock.move'
 
+    def action_cancel(self, cr, uid, ids, context=None):
+        sale_ids = []
+        for move in self.browse(cr, uid, ids, context=context):
+            if move.procurement_id and move.procurement_id.sale_line_id:
+                sale_ids.append(move.procurement_id.sale_line_id.order_id.id)
+        if sale_ids:
+            self.pool.get('sale.order').signal_ship_except(cr, uid, sale_ids)
+        return super(stock_move, self).action_cancel(cr, uid, ids, context=context)
+
     def _create_invoice_line_from_vals(self, cr, uid, move, invoice_line_vals, context=None):
         invoice_line_id = self.pool.get('account.invoice.line').create(cr, uid, invoice_line_vals, context=context)
         if move.procurement_id and move.procurement_id.sale_line_id:
index 58779ed..9ea0ce3 100644 (file)
     picks = self.search(cr, uid, [('origin','=','Test/001'),('backorder_id','<>',False)])
     self.action_cancel(cr, uid, picks)
 -
-  I invoice from order.
--
-  Only Stock User can change data related warehouse therefore test with that user which have stcok user rights,
--
-  !context
-    uid: 'res_stock_user'
--
   I run the scheduler.
 -
   !python {model: procurement.order}: |