details:   https://code.tryton.org/tryton/commit/c801019931a0
branch:    default
user:      Cédric Krier <[email protected]>
date:      Wed Feb 11 09:38:43 2026 +0100
description:
        Allow cancellation stock group to cancel running and done productions

        Closes #13899
diffstat:

 modules/production/CHANGELOG     |   1 +
 modules/production/production.py |  10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 67f4e98f0dc8 -r c801019931a0 modules/production/CHANGELOG
--- a/modules/production/CHANGELOG      Wed Feb 11 10:41:09 2026 +0100
+++ b/modules/production/CHANGELOG      Wed Feb 11 09:38:43 2026 +0100
@@ -1,3 +1,4 @@
+* Allow cancellation stock group to cancel running and done productions
 
 Version 7.8.0 - 2025-12-15
 --------------------------
diff -r 67f4e98f0dc8 -r c801019931a0 modules/production/production.py
--- a/modules/production/production.py  Wed Feb 11 10:41:09 2026 +0100
+++ b/modules/production/production.py  Wed Feb 11 09:38:43 2026 +0100
@@ -16,7 +16,7 @@
 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 @@
                 ))
         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': {

Reply via email to