changeset ae98c2ce5b75 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=ae98c2ce5b75
description:
        Remove contextual domain on company

        issue10302
        review338141004
diffstat:

 move.py     |   7 ++-----
 period.py   |   9 +++------
 shipment.py |  35 ++++++++++-------------------------
 3 files changed, 15 insertions(+), 36 deletions(-)

diffs (134 lines):

diff -r 5f85e27900cf -r ae98c2ce5b75 move.py
--- a/move.py   Tue Apr 13 23:47:22 2021 +0200
+++ b/move.py   Tue Apr 20 09:18:58 2021 +0200
@@ -245,14 +245,11 @@
         ('cancelled', 'Cancelled'),
         ], 'State', select=True, readonly=True,
         help="The current state of the stock move.")
-    company = fields.Many2One('company.company', 'Company', required=True,
+    company = fields.Many2One(
+        'company.company', "Company", required=True,
         states={
             'readonly': Eval('state') != 'draft',
             },
-        domain=[
-            ('id', If(Eval('context', {}).contains('company'), '=', '!='),
-                Eval('context', {}).get('company', -1)),
-            ],
         depends=['state'],
         help="The company the stock move is associated with.")
     unit_price = fields.Numeric('Unit Price', digits=price_digits,
diff -r 5f85e27900cf -r ae98c2ce5b75 period.py
--- a/period.py Tue Apr 13 23:47:22 2021 +0200
+++ b/period.py Tue Apr 20 09:18:58 2021 +0200
@@ -6,7 +6,7 @@
 
 from trytond.i18n import gettext
 from trytond.model import Workflow, ModelView, ModelSQL, fields
-from trytond.pyson import Eval, If
+from trytond.pyson import Eval
 from trytond.transaction import Transaction
 from trytond.pool import Pool
 from trytond.tools import grouped_slice
@@ -21,11 +21,8 @@
             'readonly': Eval('state') == 'closed',
             }, depends=['state'],
         help="When the stock period ends.")
-    company = fields.Many2One('company.company', 'Company', required=True,
-        domain=[
-            ('id', If(Eval('context', {}).contains('company'), '=', '!='),
-                Eval('context', {}).get('company', -1)),
-            ],
+    company = fields.Many2One(
+        'company.company', "Company", required=True,
         help="The company the stock period is associated with.")
     caches = fields.One2Many('stock.period.cache', 'period', 'Caches',
         readonly=True)
diff -r 5f85e27900cf -r ae98c2ce5b75 shipment.py
--- a/shipment.py       Tue Apr 13 23:47:22 2021 +0200
+++ b/shipment.py       Tue Apr 20 09:18:58 2021 +0200
@@ -128,14 +128,11 @@
             'readonly': Eval('state') != 'draft',
             }, depends=['state'],
         help="When the stock is expected to be received.")
-    company = fields.Many2One('company.company', 'Company', required=True,
+    company = fields.Many2One(
+        'company.company', "Company", required=True,
         states={
             'readonly': Eval('state') != 'draft',
             },
-        domain=[
-            ('id', If(Eval('context', {}).contains('company'), '=', '!='),
-                Eval('context', {}).get('company', -1)),
-            ],
         depends=['state'],
         help="The company the shipment is associated with.")
     reference = fields.Char("Reference", size=None, select=True,
@@ -576,14 +573,11 @@
             'readonly': Eval('state') != 'draft',
             }, depends=['state'],
         help="When the stock is expected to be returned.")
-    company = fields.Many2One('company.company', 'Company', required=True,
+    company = fields.Many2One(
+        'company.company', "Company", required=True,
         states={
             'readonly': Eval('state') != 'draft',
             },
-        domain=[
-            ('id', If(Eval('context', {}).contains('company'), '=', '!='),
-                Eval('context', {}).get('company', -1)),
-            ],
         depends=['state'],
         help="The company the shipment is associated with.")
     number = fields.Char('Number', size=None, select=True, readonly=True,
@@ -944,14 +938,11 @@
             'readonly': Eval('state') != 'draft',
             }, depends=['state'],
         help="When the stock is expected to be sent.")
-    company = fields.Many2One('company.company', 'Company', required=True,
+    company = fields.Many2One(
+        'company.company', "Company", required=True,
         states={
             'readonly': Eval('state') != 'draft',
             },
-        domain=[
-            ('id', If(Eval('context', {}).contains('company'), '=', '!='),
-                Eval('context', {}).get('company', -1)),
-            ],
         depends=['state'],
         help="The company the shipment is associated with.")
     customer = fields.Many2One('party.party', 'Customer', required=True,
@@ -1592,14 +1583,11 @@
             'readonly': Eval('state') != 'draft',
             }, depends=['state'],
         help="When the stock is expected to be returned.")
-    company = fields.Many2One('company.company', 'Company', required=True,
+    company = fields.Many2One(
+        'company.company', "Company", required=True,
         states={
             'readonly': Eval('state') != 'draft',
             },
-        domain=[
-            ('id', If(Eval('context', {}).contains('company'), '=', '!='),
-                Eval('context', {}).get('company', -1)),
-            ],
         depends=['state'],
         help="The company the shipment is associated with.")
     customer = fields.Many2One('party.party', 'Customer', required=True,
@@ -2029,14 +2017,11 @@
             },
         depends=['state'],
         help="When the stock is expected to be sent.")
-    company = fields.Many2One('company.company', 'Company', required=True,
+    company = fields.Many2One(
+        'company.company', "Company", required=True,
         states={
             'readonly': ~Eval('state').in_(['request', 'draft']),
             },
-        domain=[
-            ('id', If(Eval('context', {}).contains('company'), '=', '!='),
-                Eval('context', {}).get('company', -1)),
-            ],
         depends=['state'],
         help="The company the shipment is associated with.")
     number = fields.Char('Number', size=None, select=True, readonly=True,

Reply via email to