[FIX] website: use context in dynamic snippet

Prior to this commit, when using a ir.filter on a dynamic snippet,
the filter would not use the product context defined in itself.
This would cause unexpected behaviour like ignoring
the 'display_default_code: False' in the website_sale ir.filter.

This commit adds context to database record lookups.

task-2654924

X-original-commit: d10d406739239e8d8fc240b2c6b2596b1ee6e610
Part-of: odoo/odoo#80867
This commit is contained in:
Arthur Detroux (ard)
2021-12-03 18:24:06 +00:00
parent 2d99d81da7
commit 40de474f68
@@ -93,7 +93,7 @@ class WebsiteSnippetFilter(models.Model):
if search_domain:
domain = expression.AND([domain, search_domain])
try:
records = self.env[filter_sudo.model_id].search(
records = self.env[filter_sudo.model_id].with_context(**literal_eval(filter_sudo.context)).search(
domain,
order=','.join(literal_eval(filter_sudo.sort)) or None,
limit=limit