Carlos RocaandAaron Bohy c6b0248b5f [FIX] web: SearchView of many2one is not getting the form domain
Steps to reproduce the problem:

1. Add a many2one field to lines of a model, example: sale.order.line
2. Add it to form view of the lines with a domain
3. Click on Search more... option
4. You will see results out of the scope of the domain

In the getDomain is passed an object that has only the key
fieldName but for knew in what view is the field placed
it needs to be provided the key viewType, this both are placed
on the class object this.recordParams builded at:
https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L129

If this key is not provided the viewType is beeing filled
with the element viewType, this element is the record opened placed
in the parent view, so by default if will be kanban or list. So
if the domain is filled just in the form view, the search panel
will get the domain [], so all the entries will be displayed and
they will be able to be selected.

If we see the next line:
https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L431
We will see that getContext is getting this.recordParams as
argument, for the same reason that the domain should have it.

With this changes the getDomain method is getting the viewType
to take the domain instead of the viewType of the lines displayed
on the parent view.

closes odoo/odoo#163513

X-original-commit: 1eef2e8711124df9cbe7373ef6056b51f1b2617c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2024-04-26 18:54:33 +00:00
2024-04-15 09:10:09 +00:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%