Allow cancelling move done
issue11663 review443491003
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_move_cancel_fifo">
|
||||
<field name="text">You cannot cancel move "%(move)s" because it is used for FIFO cost price calculation.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_move_delete_fifo">
|
||||
<field name="text">You cannot delete move "%(move)s" because it is used for FIFO cost price calculation.</field>
|
||||
</record>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user