OCA / product-configurator

Advanced Product Configurator (from the original Pledra project https://github.com/pledra/odoo-product-configurator)
GNU Affero General Public License v3.0
33 stars 76 forks source link

[16.0] product_configurator: xml domain #121

Open AurelijaNorvaisaite opened 5 months ago

AurelijaNorvaisaite commented 5 months ago

Module

product_configurator

Describe the bug

Can't create rule from product. `Traceback (most recent call last): File "/opt/odoo/odoo/odoo/http.py", line 1633, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) File "/opt/odoo/odoo/odoo/service/model.py", line 133, in retrying result = func() File "/opt/odoo/odoo/odoo/http.py", line 1660, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/opt/odoo/odoo/odoo/http.py", line 1864, in dispatch result = self.request.registry['ir.http']._dispatch(endpoint) File "/opt/odoo/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch result = endpoint(request.params) File "/opt/odoo/odoo/odoo/http.py", line 697, in route_wrapper result = endpoint(self, *args, *params_ok) File "/opt/odoo/odoo/addons/web/controllers/dataset.py", line 42, in call_kw return self._call_kw(model, method, args, kwargs) File "/opt/odoo/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/opt/odoo/odoo/odoo/api.py", line 464, in call_kw result = _call_kw_model(method, model, args, kwargs) File "/opt/odoo/odoo/odoo/api.py", line 435, in _call_kw_model result = method(recs, args, kwargs) File "/opt/odoo/odoo/odoo/models.py", line 1617, in name_search return self.browse(ids).sudo().name_get() File "/opt/odoo/odoo/odoo/models.py", line 5140, in browse if not ids: File "/opt/odoo/odoo/odoo/tools/query.py", line 217, in bool return bool(self._result) File "/opt/odoo/odoo/odoo/tools/func.py", line 28, in get value = self.fget(obj) File "/opt/odoo/odoo/odoo/tools/query.py", line 210, in _result self._cr.execute(query_str, params) File "/opt/odoo/odoo/odoo/sql_db.py", line 321, in execute res = self._obj.execute(query, params) psycopg2.errors.DatatypeMismatch: ARRAY types integer and boolean cannot be matched LINE 1: ...= true) AND ("product_attribute"."id" in (ARRAY[6,false,ARRA... ^

The above server error caused the following client error: RPC_ERROR: Odoo Server Error RPCError@http://localhost:8069/web/assets/1750-aec1d4e/web.assets_backend.min.js:997:274 makeErrorFromResponse@http://localhost:8069/web/assets/1750-aec1d4e/web.assets_backend.min.js:1001:163 jsonrpc/promise</<@http://localhost:8069/web/assets/1750-aec1d4e/web.assets_backend.min.js:1009:34`

To Reproduce

16.0:

Steps to reproduce the behavior:

  1. Go to configurable product -> section Configurator
  2. Create new configuration restriction with new Restriction (don't use existing one, but this issue can be with existing rule too)
  3. Go to restriction and try to create Rule.
  4. If restriction and rule are created from separate menu (not product), works correctly.

Expected behavior Should be allowed to create Restriction Rule.

Additional context It happens because of the domain on field declaration and xml file: domain=lambda self: self._compute_attribute_id_domain() domain="[('id', 'in', context.get('product_attribute_ids', []))]" Domains are duplicated and the one in xml is not working.

peterromao commented 4 months ago

I confirm this bug on Odoo 16.0-20231127 (Community Edition) Exact same steps to reproduce. I was going to create the issue but Aurelija Vitkauskiene beat me to it.

I just do not understand how you make it work in point 4. What do you mean by separate menu?

peterromao commented 3 months ago

I just do not understand how you make it work in point 4. What do you mean by separate menu?

I see now... it's via the Configurator base menu.