details:   https://code.tryton.org/tryton/commit/6e8bf4283b7a
branch:    8.2
user:      Cédric Krier <[email protected]>
date:      Wed Nov 04 11:47:33 2026 +0100
description:
        Invert editable expressions

        Some expressions were not inverted when transferred from readonly to 
editable.

        Closes #15213
        (grafted from e0edc315b9859632e1a42b2ce1dee7878f7c006c)
diffstat:

 modules/account_budget/account.py              |   4 ++--
 modules/carrier_weight/carrier.py              |  10 ++++++----
 modules/product/product.py                     |   8 ++++----
 modules/purchase_request_quotation/purchase.py |   2 +-
 4 files changed, 13 insertions(+), 11 deletions(-)

diffs (109 lines):

diff -r c25089803a71 -r 6e8bf4283b7a modules/account_budget/account.py
--- a/modules/account_budget/account.py Wed Oct 28 15:14:37 2026 +0100
+++ b/modules/account_budget/account.py Wed Nov 04 11:47:33 2026 +0100
@@ -306,13 +306,13 @@
     lines = fields.One2Many(
         'account.budget.line', 'budget', "Lines",
         states={
-            'editable': Eval('id', -1) < 0,
+            'editable': Eval('id', -1) >= 0,
             },
         order=[('left', 'ASC'), ('id', 'ASC')])
     root_lines = fields.One2Many(
         'account.budget.line', 'budget', "Lines",
         states={
-            'editable': Eval('id', -1) < 0,
+            'editable': Eval('id', -1) >= 0,
             },
         filter=[
             ('parent', '=', None),
diff -r c25089803a71 -r 6e8bf4283b7a modules/carrier_weight/carrier.py
--- a/modules/carrier_weight/carrier.py Wed Oct 28 15:14:37 2026 +0100
+++ b/modules/carrier_weight/carrier.py Wed Nov 04 11:47:33 2026 +0100
@@ -5,7 +5,7 @@
 from trytond.model import ModelSQL, ModelView, fields
 from trytond.modules.currency.fields import Monetary
 from trytond.pool import PoolMeta
-from trytond.pyson import Bool, Eval, Id
+from trytond.pyson import Eval, Id
 from trytond.transaction import Transaction
 
 
@@ -17,21 +17,23 @@
         states={
             'invisible': Eval('carrier_cost_method') != 'weight',
             'required': Eval('carrier_cost_method') == 'weight',
-            'editable': Bool(Eval('weight_price_list', [])),
+            'editable': ~Eval('weight_price_list', []),
             },
         help="The Unit of Measure of weight criteria for the price list.")
     weight_currency = fields.Many2One('currency.currency', 'Currency',
         states={
             'invisible': Eval('carrier_cost_method') != 'weight',
             'required': Eval('carrier_cost_method') == 'weight',
-            'editable': Bool(Eval('weight_price_list', [])),
+            'editable': ~Eval('weight_price_list', []),
             },
         help="The currency of the price.")
     weight_price_list = fields.One2Many('carrier.weight_price_list', 'carrier',
         'Price List',
         states={
             'invisible': Eval('carrier_cost_method') != 'weight',
-            'readonly': ~(Eval('weight_uom', 0) & Eval('weight_currency', 0)),
+            'readonly': ~(
+                Eval('weight_uom', None)
+                & Eval('weight_currency', None)),
             },
         help="Add price per weight to the carrier service.\n"
         "The first line for which the weight is greater is used.\n"
diff -r c25089803a71 -r 6e8bf4283b7a modules/product/product.py
--- a/modules/product/product.py        Wed Oct 28 15:14:37 2026 +0100
+++ b/modules/product/product.py        Wed Nov 04 11:47:33 2026 +0100
@@ -20,7 +20,7 @@
 from trytond.modules.company.model import (
     CompanyMultiValueMixin, CompanyValueMixin)
 from trytond.pool import Pool
-from trytond.pyson import Eval, Get, If
+from trytond.pyson import Bool, Eval, Get, If
 from trytond.tools import is_full_text, lstrip_wildcard
 from trytond.transaction import Transaction, inactive_records
 from trytond.wizard import Button, StateTransition, StateView, Wizard
@@ -153,7 +153,7 @@
     list_price = fields.MultiValue(fields.Numeric(
             "List Price", digits=price_digits,
             states={
-                'editable': ~Eval('context', {}).get('company'),
+                'editable': Bool(Eval('context', {}).get('company', None)),
                 },
             help="The standard price the product is sold at."))
     list_prices = fields.One2Many(
@@ -515,7 +515,7 @@
     list_price = fields.MultiValue(fields.Numeric(
             "List Price", digits=price_digits,
             states={
-                'editable': ~Eval('context', {}).get('company'),
+                'editable': Bool(Eval('context', {}).get('company', None)),
                 },
             help="The standard price the variant is sold at.\n"
             "Leave empty to use the list price of the product."))
@@ -528,7 +528,7 @@
     cost_price = fields.MultiValue(fields.Numeric(
             "Cost Price", digits=price_digits,
             states={
-                'editable': ~Eval('context', {}).get('company'),
+                'editable': Bool(Eval('context', {}).get('company', None)),
                 },
             help="The amount it costs to purchase or make the variant, "
             "or carry out the service."))
diff -r c25089803a71 -r 6e8bf4283b7a 
modules/purchase_request_quotation/purchase.py
--- a/modules/purchase_request_quotation/purchase.py    Wed Oct 28 15:14:37 
2026 +0100
+++ b/modules/purchase_request_quotation/purchase.py    Wed Nov 04 11:47:33 
2026 +0100
@@ -111,7 +111,7 @@
     supplier = fields.Many2One(
         'party.party', "Supplier", required=True,
         states={
-            'editable': Eval('lines', [0]) & Eval('supplier'),
+            'editable': ~(Eval('lines', [0]) & Eval('supplier', None)),
             },
         context={
             'company': Eval('company', -1),

Reply via email to