Send only the required fields when fetching a readonly view definition

issue11134
review380081002
This commit is contained in:
Nicolas Évrard committed 2022-04-08 19:07:14 +02:00
1 parent 072a5eadea
commit 21d949ca79
2 files changed
+11 -20

No files matched your search

+4 -8
View File
@@ -75,7 +75,7 @@ class Template(IdentifiersMixin, metaclass=PoolMeta):
'readonly': Bool(Eval('shopify_identifiers', [-1])),
'invisible': ~Eval('salable', False),
},
depends=['default_uom_category', 'shopify_identifiers', 'salable'])
depends={'default_uom_category'})
@classmethod
def __setup__(cls):
@@ -89,7 +89,6 @@ class Template(IdentifiersMixin, metaclass=PoolMeta):
('category', 'in', [Eval(c, -1) for c in categories]),
('digits', '=', 0),
]
cls.shopify_uom.depends.extend(categories)
@classmethod
def _shopify_uom_categories(cls):
@@ -471,8 +470,7 @@ class AttributeSet(IdentifiersUpdateMixin, metaclass=PoolMeta):
If(Eval('shopify_option3'),
('id', '!=', Eval('shopify_option3')),
()),
],
depends=['attributes', 'shopify_option2', 'shopify_option3'])
])
shopify_option2 = fields.Many2One(
'product.attribute', "Option 2",
domain=[
@@ -486,8 +484,7 @@ class AttributeSet(IdentifiersUpdateMixin, metaclass=PoolMeta):
],
states={
'invisible': ~Eval('shopify_option1'),
},
depends=['attributes', 'shopify_option1', 'shopify_option3'])
})
shopify_option3 = fields.Many2One(
'product.attribute', "Option 3",
domain=[
@@ -501,8 +498,7 @@ class AttributeSet(IdentifiersUpdateMixin, metaclass=PoolMeta):
],
states={
'invisible': ~Eval('shopify_option2'),
},
depends=['attributes', 'shopify_option1', 'shopify_option2'])
})
@classmethod
def __setup__(cls):
+7 -12
View File
@@ -32,32 +32,28 @@ class Shop(metaclass=PoolMeta):
'required': Eval('type') == 'shopify',
'invisible': Eval('type') != 'shopify',
}
_depends = ['type']
shopify_url = fields.Char("Shop URL", states=_states, depends=_depends)
shopify_url = fields.Char("Shop URL", states=_states)
shopify_version = fields.Selection(
'get_shopify_versions', "Version", states=_states, depends=_depends)
shopify_password = fields.Char(
"Password", states=_states, depends=_depends)
'get_shopify_versions', "Version", states=_states)
shopify_password = fields.Char("Password", states=_states)
shopify_webhook_shared_secret = fields.Char(
"Webhook Shared Secret",
states={
'invisible': _states['invisible'],
},
depends=_depends)
})
shopify_webhook_endpoint_order = fields.Function(
fields.Char(
"Webhook Order Endpoint",
help="The URL to be called by Shopify for Order events."),
'on_change_with_shopify_webhook_endpoint_order')
shopify_warehouses = fields.One2Many(
'web.shop-stock.location', 'shop', "Warehouses",
states=_states, depends=_depends)
'web.shop-stock.location', 'shop', "Warehouses", states=_states)
shopify_payment_journals = fields.One2Many(
'web.shop.shopify_payment_journal', 'shop', "Payment Journals",
states=_states, depends=_depends)
states=_states)
del _states, _depends
del _states
@classmethod
def __setup__(cls):
@@ -69,7 +65,6 @@ class Shop(metaclass=PoolMeta):
field.states['invisible'] |= invisible
else:
field.states['invisible'] = invisible
field.depends.append('type')
@classmethod
def get_shopify_versions(cls):