server-tools icon indicating copy to clipboard operation
server-tools copied to clipboard

[18.0] base_name_search_improved: smart search doesn't work on archived records

Open Bart-dh opened this issue 7 months ago • 4 comments

Module

base_name_search_improved

Describe the bug

Smart search option in search view does not work for archived records

To Reproduce

Bug encountered in 18.0 Bug not present in 15.0 Other versions not tested

Steps to reproduce the behavior:

  1. Add smart search to product.template model, add Default code as smart search field for example
  2. In product list, search a products default code using smart search
  3. Product is returned
  4. Archive product
  5. Activate filter 'Archived' and do the same search
  6. Product is not returned

Expected behavior I except the smart search to work regardless of archived or not.

Bart-dh avatar May 13 '25 14:05 Bart-dh

Let me fix it

arch-fan avatar Jul 29 '25 05:07 arch-fan

Taking a look, it doesn't seem to be an issue of the module.

https://github.com/OCA/server-tools/blob/9932351695720ea46c8da671f142b707c634b755/base_name_search_improved/models/ir_model.py#L162

This records include both, archived and not archived.

arch-fan avatar Jul 29 '25 06:07 arch-fan

Taking a look, it doesn't seem to be an issue of the module.

server-tools/base_name_search_improved/models/ir_model.py

Line 162 in 9932351

return [(record.id, record.display_name) for record in records] This records include both, archived and not archived.

Have you tested this in an environment? Because Odoo search does not include archived records unless explicitly added in the domain, which I do not see here

Bart-dh avatar Aug 20 '25 12:08 Bart-dh

@Bart-dh Here it is solved https://github.com/OCA/server-tools/pull/3357, do you want to try it?

lef-adhoc avatar Sep 02 '25 19:09 lef-adhoc