[FIX] stock: allow inventory user to validate delivery orders when moves have to be merged

When validating a delivery order, some stock moves might be merged by an
internal function, which thus might delete some stock moves.
Since an inventory user has no right to unlink stock moves,
the validation might fail.
We simply had a sudo when doing the unlink, since this is an external method.

opw 1836761
This commit is contained in:
len-odoo
2018-04-27 13:08:05 +02:00
committed by len-odoo
parent 0050019390
commit 3acb4a5389
+1 -1
View File
@@ -593,7 +593,7 @@ class StockMove(models.Model):
# We are using propagate to False in order to not cancel destination moves merged in moves[0]
moves_to_unlink.write({'propagate': False})
moves_to_unlink._action_cancel()
moves_to_unlink.unlink()
moves_to_unlink.sudo().unlink()
return (self | self.env['stock.move'].concat(*moves_to_merge)) - moves_to_unlink
def _get_relevant_state_among_moves(self):