diff --git a/message.xml b/message.xml index ad0eadb00c..021b30e02d 100644 --- a/message.xml +++ b/message.xml @@ -3,6 +3,9 @@ this repository contains the full copyright notices and license terms. --> + + You cannot cancel move "%(move)s" because it is used for FIFO cost price calculation. + You cannot delete move "%(move)s" because it is used for FIFO cost price calculation. diff --git a/move.py b/move.py index b576aad865..056c72d1ce 100644 --- a/move.py +++ b/move.py @@ -129,6 +129,11 @@ class Move(metaclass=PoolMeta): @ModelView.button @Workflow.transition('cancelled') def cancel(cls, moves): + for move in moves: + if move.fifo_quantity: + raise AccessError( + gettext('product_cost_fifo.msg_move_cancel_fifo', + move=move.rec_name)) super().cancel(moves) @classmethod