summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosse Colpaert <jco@odoo.com>2015-03-13 10:47:40 +0100
committerJosse Colpaert <jco@odoo.com>2015-03-13 13:58:19 +0100
commit20312e28808f3c0abf2df75e850788dcfe54f577 (patch)
tree62edf6e65b21d955a54abe333aa126f6bfe13bb4
parent09abac7608cc60a56de8e59184575f40629215d5 (diff)
[IMP] Deleting PO lines should work the same way as Cancelling PO
Also the test is adapted. When a product as treated as MTO, it should not without notice change to an MTS.
-rw-r--r--addons/purchase/purchase.py6
-rw-r--r--addons/purchase/test/process/run_scheduler.yml2
2 files changed, 4 insertions, 4 deletions
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 6190c52b3b7..382e8596997 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -1026,9 +1026,9 @@ class purchase_order_line(osv.osv):
if line.state not in ['draft', 'cancel']:
raise osv.except_osv(_('Invalid Action!'), _('Cannot delete a purchase order line which is in state \'%s\'.') %(line.state,))
procurement_obj = self.pool.get('procurement.order')
- procurement_ids_to_cancel = procurement_obj.search(cr, uid, [('purchase_line_id', 'in', ids)], context=context)
- if procurement_ids_to_cancel:
- self.pool['procurement.order'].cancel(cr, uid, procurement_ids_to_cancel)
+ procurement_ids_to_except = procurement_obj.search(cr, uid, [('purchase_line_id', 'in', ids)], context=context)
+ if procurement_ids_to_except:
+ self.pool['procurement.order'].write(cr, uid, procurement_ids_to_except, {'state': 'exception'}, context=context)
return super(purchase_order_line, self).unlink(cr, uid, ids, context=context)
def onchange_product_uom(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id,
diff --git a/addons/purchase/test/process/run_scheduler.yml b/addons/purchase/test/process/run_scheduler.yml
index 01aa497311d..83c5c6a099b 100644
--- a/addons/purchase/test/process/run_scheduler.yml
+++ b/addons/purchase/test/process/run_scheduler.yml
@@ -39,4 +39,4 @@
procurement = self.browse(cr, uid, ref('procurement_order_testcase0'))
procurement.purchase_line_id.unlink()
procurement.refresh()
- assert procurement.state == 'cancel', 'Procurement should be cancelled'
+ assert procurement.state == 'exception', 'Procurement should be in exception'