[FIX] purchase: unlink of a PO line now correctly canl the linked procurement. Yaml test fixed as well (there is no stock.move created anymore untill the PO is confirmed). These errors were introduced with the last merge with trunk
bzr revid: qdp-launchpad@openerp.com-20140204090901-xakhcchof90fh73h
This commit is contained in:
parent
256d7f37a2
commit
d096e9f1b8
|
@ -974,12 +974,10 @@ class purchase_order_line(osv.osv):
|
|||
return super(purchase_order_line, self).copy_data(cr, uid, id, default, context)
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
procurement_ids_to_cancel = []
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.move_dest_id:
|
||||
procurement_ids_to_cancel.extend(procurement.id for procurement in line.move_dest_id.procurements)
|
||||
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'].action_cancel(cr, uid, procurement_ids_to_cancel)
|
||||
self.pool['procurement.order'].cancel(cr, uid, procurement_ids_to_cancel)
|
||||
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,
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
-
|
||||
!python {model: procurement.order}: |
|
||||
procurement = self.browse(cr, uid, ref('procurement_order_testcase0'))
|
||||
move = procurement.purchase_id.order_line[0].move_dest_id
|
||||
procurement.purchase_id.order_line[0].unlink()
|
||||
assert move.state == 'cancel', 'Move should be cancelled'
|
||||
procurement.purchase_line_id.unlink()
|
||||
procurement.refresh()
|
||||
assert procurement.state == 'cancel', 'Procurement should be cancelled'
|
||||
|
|
Loading…
Reference in New Issue