[FIX] purchase: deletion of PO lines in states other than approved/done
This is related to revision 65d7cc524d
The `order_line` field of `purchase.order` is readonly within states
aprroved, done. See the field definition. This means it should be
possible to remove lines of a `purchase.order` when the PO is in
any other state than approved or done.
Therefore, the deletion of lines shouldn't be prevented
when the PO is not in state approved or done
opw-634538
This commit is contained in:
parent
242e61796b
commit
acd61f8f0e
|
@ -934,7 +934,7 @@ class purchase_order_line(osv.osv):
|
|||
def unlink(self, cr, uid, ids, context=None):
|
||||
procurement_ids_to_cancel = []
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.state not in ['draft', 'cancel']:
|
||||
if line.order_id.state in ['approved', 'done'] and 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,))
|
||||
if line.move_dest_id:
|
||||
procurement_ids_to_cancel.extend(procurement.id for procurement in line.move_dest_id.procurements)
|
||||
|
|
Loading…
Reference in New Issue