[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.
This commit is contained in:
parent
09abac7608
commit
20312e2880
|
@ -1026,9 +1026,9 @@ class purchase_order_line(osv.osv):
|
||||||
if line.state not in ['draft', 'cancel']:
|
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,))
|
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_obj = self.pool.get('procurement.order')
|
||||||
procurement_ids_to_cancel = procurement_obj.search(cr, uid, [('purchase_line_id', 'in', ids)], context=context)
|
procurement_ids_to_except = procurement_obj.search(cr, uid, [('purchase_line_id', 'in', ids)], context=context)
|
||||||
if procurement_ids_to_cancel:
|
if procurement_ids_to_except:
|
||||||
self.pool['procurement.order'].cancel(cr, uid, procurement_ids_to_cancel)
|
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)
|
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,
|
def onchange_product_uom(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id,
|
||||||
|
|
|
@ -39,4 +39,4 @@
|
||||||
procurement = self.browse(cr, uid, ref('procurement_order_testcase0'))
|
procurement = self.browse(cr, uid, ref('procurement_order_testcase0'))
|
||||||
procurement.purchase_line_id.unlink()
|
procurement.purchase_line_id.unlink()
|
||||||
procurement.refresh()
|
procurement.refresh()
|
||||||
assert procurement.state == 'cancel', 'Procurement should be cancelled'
|
assert procurement.state == 'exception', 'Procurement should be in exception'
|
||||||
|
|
Loading…
Reference in New Issue