[6.1][7.0][trunk] Search for product and product category is not made for a daily use

Bug #1267845 reported by Yann Papouin
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Medium
OpenERP R&D Addons Team 3
OpenERP Community Backports (Addons)
Status tracked in 7.0
6.1
Fix Committed
Low
Yann Papouin
7.0
New
Undecided
Unassigned

Bug Description

The name_search method does not take into account common case in daily use (see examples below), the user should not have to remove the brackets to have a match:

Consider a product A:
- default_code = 'REFA'
- name = 'My product A'

Consider a product B:
- default_code = 'REFB'
- name = 'My product B

The current name_get returns:
- [REFA] My product A

If the user edit the name_get the following cases are not allowing to retrieve any of the products above:
- [REFA
- [REF

Another model case: product.category, the user should be able to retrieve a category even when the category separator is used. Consider the following categories:

- All products / Main Group / Group A
- All products / Main Group / Group B
- All products / Main Group / Group C
- All products / Another Group / Group A
- All products / Another Group / Group B

If the user edit the name_get the following cases are not allowing to retrieve any of the categories above:

- All products / Main Group / Group A
- All products / Main Group / Grou
- All products / Main Group /
- All products / Main

Related branches

Revision history for this message
Yann Papouin (yann-papouin) wrote :

See my proposal attached

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Yann, I think you are mixing two concepts: name_get and name_search. Both methods are used with differente purposes: on one hand, name_get retrieves the visible name that the record is going to have got, and on the other, name_search allow to make any query with parameters supplied, and usually returning the output as a list on "name_get records".

On product, name_search allows to search by reference or by name, so you can search entering 'REF' the products REFA and REFB, but '[REF' is not working, because there isn't any reference that contains the bracket.

On category, name_search only searches for the name of the leaf category, which I consider also that is not convenient, but any other thing is a change of behaviour, not a bug. I have made a module that changes this behaviour, which I'm going to attach to this bug.

Regards.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This module is for v7, but easily backportable to v6.1

Revision history for this message
Yann Papouin (yann-papouin) wrote :

Thanks Pedro for your module, but that's not the behaviour I was looking for.

Personally, I think that anything done into name_get must be undone in name_search since their behaviours are inter-connected:
- If the product name_get adds brackets in name_get they must be removed before search in name_search
- If the category name_get adds slashes in name_get they must be removed before search in name_search

Please note that OpenERP SA already did this for product but only when both brackets are there, I'm just extending their process by removing extra brackets. And since nothing exists for product category, I implemented the same process there.

Note that this change should allow to fix one of my old bug report:
https://bugs.launchpad.net/openobject-server/+bug/812340

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
status: New → Confirmed
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.