[stock][7.0]wrong search by context

Bug #1192484 reported by Julio Serna-http://www.vauxoo.com
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP Publisher's Warranty Team

Bug Description

1.-Steps to reproduce the issue you have observed
go to Warehouse / Products
search "stock"
and choose one location

2.- The result you observed
When choose location shows Error

3.-The result you expected
shows no errors

4.-
runbot (Build 13901)

Note: I uploaded a video http://youtu.be/rglT48auAWA

Tags: maintenance

Related branches

summary: - [stock][7.0]worng search by context
+ [stock][7.0]wrong search by context
Changed in openobject-addons:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Hello Vinay and Mohammed Shekha,
Do you news?

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

*Do you have news?

Revision history for this message
Julio Serna-http://www.vauxoo.com (hearthebreaker) wrote :

I tested the branch and solve the problem.
however when I want to do a search by context with several locations is only taking the last

Note: I uploaded a vide http://youtu.be/PUnUGBs6DjU

Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello Julio Serna,

I went through your query given in comment 3, I also went through your video.

After analysis I found that there is no issue with search, search is behaving as expected because context is not used for search here, here in product_view.xml field is defined for location_id, domain is generated based on facets, as there are facets on location_id so domain is created like ['|', ['location_id', '=', somevalue], ['location_id', '=', somevalue]].

Significance of context is different, context is not going to be used for search instead it is used to have some logic based on context value, like here in standard module location value of context is used in fields_view_get method of product.product(stock/product.py)

>>however when I want to do a search by context with several locations is only taking the last
No, domain created as expected, if you check your video you can see domain is created on two values location_id, '=', 18 or location_id, '=', 19.

Hope this will clears the picture on context and domain on field.

Thanks.

Changed in openobject-addons:
status: New → Fix Committed
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Hello Mohammed,

I uploaded a new video:
http://youtu.be/cDCeRUMR0rk

You're telling me that this is correct functionality and is not a bug.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Let's try to clarify the discussion a bit.

As Xavier mentioned on the merge proposal[1], Many2One search fields have always resolved `self` to a string value when it is used in a @filter_domain or @context attribute. This is necessary to keep a consistent API for partial matches, for example when self is "Sto" to match "Stock".
The reason why this bug occurs is not because of a change in Many2One fields, but simply because there used to be a widget="selection" attribute on some of the magic search fields where `self` is used, switching them to Selection fields instead. Selection search field *do resolve to IDs* because of their key-value nature.

Looking at the history, these widget="selection" attributes were dropped by mistake during a global cleanup of all search views in preparation of v7. In general there was no reason to keep a widget="selection" in a search view because of the unified search widget of v7 - the selection would never be visible in any case. However when `self` was being used for magical fields, this had the unfortunate side-effect of changing the type of `self`.
The revision were the cleanup occurred is [2], and a quick scan of the patch only reveals a few occurrences of this error: 6 in account/account_voucher, 1 in product, and 2 in stock.

The easiest fix is to re-add the missing widget="selection" attribute for these special cases.
This has already been fixed for account before the 7.0 release [3], and the product case was fixed in the mean time too, by actually allowing string values for the `pricelist` context.

The rest of the cases were fixed by restoring the widget="selection" attribute, just merged at revision [4].

Thanks for reporting and for your patience!

[1] https://code.launchpad.net/~openerp-dev/openerp-web/7.0-opw-585134-msh/+merge/146344
[2] addons 7.0 revno 7142 revid:<email address hidden>
[3] addons 7.0 revno 7895 revid:<email address hidden>
[4] addons 7.0 revno 9500 revid:<email address hidden>

Changed in openobject-addons:
importance: Undecided → Low
milestone: none → 7.0
status: Fix Committed → Fix Released
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

@Oliver,
FYI To avoid misunderstandings I have created a split bug with "Wrong compute Qty with two or more locations"
https://bugs.launchpad.net/openobject-addons/+bug/1234815

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.