← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 710859] [NEW] [6.0] many2one field on search screen searches by name - doesn't work for object with a custom name_get function

 

Public bug reported:

First off, loving the enhancements in version 6.0! The new menu
structure possibilities and custom search screens are a massive
improvement! :)

However, I've found a bit of an issue with the handling of many2one
fields on a custom Search screen. The web client and hence the server
uses the record 'Name' field, instead of the selected ID to search
many2one fields.

This is a problem for any objects that have a custom name_get function.

For example, I have a search screen with a partner_contact_id field on
it, which is a many2one field pointing at the res.partner.contact
object. When I select my name in the box ("Russell Briggs") the query
that is generated on the server on the res.partner.contact object is:

['|', ('name', 'ilike', 'Russell Briggs'), ('first_name', 'ilike',
'Russell Briggs')]

This doesn't return any records, because the actual record in the
database has first_name = "Russell" and name = "Briggs"

It would make more sense if the server searched by ID when a record is
selected in a many2one search field, is there a reason why this is not
the case?

** Affects: openobject-client-web
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/710859

Title:
  [6.0] many2one field on search screen searches by name - doesn't work
  for object with a custom name_get function

Status in OpenERP Web Client:
  New

Bug description:
  First off, loving the enhancements in version 6.0! The new menu
  structure possibilities and custom search screens are a massive
  improvement! :)

  However, I've found a bit of an issue with the handling of many2one
  fields on a custom Search screen. The web client and hence the server
  uses the record 'Name' field, instead of the selected ID to search
  many2one fields.

  This is a problem for any objects that have a custom name_get
  function.

  For example, I have a search screen with a partner_contact_id field on
  it, which is a many2one field pointing at the res.partner.contact
  object. When I select my name in the box ("Russell Briggs") the query
  that is generated on the server on the res.partner.contact object is:

  ['|', ('name', 'ilike', 'Russell Briggs'), ('first_name', 'ilike',
  'Russell Briggs')]

  This doesn't return any records, because the actual record in the
  database has first_name = "Russell" and name = "Briggs"

  It would make more sense if the server searched by ID when a record is
  selected in a many2one search field, is there a reason why this is not
  the case?





Follow ups

References