Allow cancellation of done drop shipments

Same as 0d599a48d351 but for drop shipment.

Closes #14223
This commit is contained in:
Cédric Krier
2025-09-10 09:50:17 +02:00
parent baf798eb6a
commit b519f15a05
2 changed files with 5 additions and 8 deletions
@@ -1,3 +1,4 @@
* Allow cancellation of done drop shipments
Version 7.6.0 - 2025-04-28
--------------------------
+4 -8
View File
@@ -165,6 +165,7 @@ class ShipmentDrop(
('cancelled', 'draft'),
('shipped', 'done'),
('shipped', 'cancelled'),
('done', 'cancelled'),
))
cls._buttons.update({
'cancel': {
@@ -274,14 +275,9 @@ class ShipmentDrop(
@process_purchase('supplier_moves')
def cancel(cls, shipments):
Move = Pool().get('stock.move')
Move.cancel([m for s in shipments for m in s.supplier_moves])
Move.cancel([m for s in shipments for m in s.customer_moves
if s.state == 'shipped'])
Move.write([m for s in shipments for m in s.customer_moves
if s.state != 'shipped'], {
'shipment': None,
'origin_drop': None,
})
Move.cancel([
m for s in shipments
for m in s.supplier_moves + s.customer_moves])
@classmethod
@ModelView.button