Allow cancellation stock group to cancel running and done productions

Closes #13899
This commit is contained in:
Cédric Krier
2026-02-11 09:38:43 +01:00
parent 9d871c8244
commit 27a6a3e0b3
2 changed files with 8 additions and 3 deletions
+1
View File
@@ -1,3 +1,4 @@
* Allow cancellation stock group to cancel running and done productions
Version 7.8.0 - 2025-12-15
--------------------------
+7 -3
View File
@@ -16,7 +16,7 @@ from trytond.modules.company.model import employee_field, set_employee
from trytond.modules.product import price_digits, round_price
from trytond.modules.stock.shipment import ShipmentAssignMixin
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Bool, Eval, If
from trytond.pyson import Bool, Eval, Id, If
from trytond.transaction import Transaction
from .exceptions import CostWarning
@@ -201,8 +201,12 @@ class Production(
))
cls._buttons.update({
'cancel': {
'invisible': ~Eval('state').in_(['request', 'draft',
'assigned']),
'invisible': (
(Eval('state') == 'cancelled')
| (Eval('state').in_(['running', 'done'])
& ~Id('stock',
'group_stock_cancellation').in_(
Eval('context', {}).get('groups', [])))),
'depends': ['state'],
},
'draft': {