search() is not called when name_search() not defined

Bug #1013603 reported by Cuong
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Low
OpenERP's Framework R&D

Bug Description

Hi,

I face an issue with search() method. Let me take an example for more clear. There are 2 classes: A, B

===
class A(osv.osv):

    def search():

    return super(A, self).search(....)

A()

class B(osv.osv):

   _columns = {
      a_id: many2one('A')....
  }

B()
===

Now, I open the form of model B and edit it, I choose a value of a_id. A.search() is not executed.

But if I define name_search() for A as follow:

===
def name_search():
    self.search(...)
    return self.name_get(cr, uid, ids, context=context)
===

Then A.search() is executed due to explicit called by self.search() inside name_get().

This is actual issue when I do some customizations on search of A. For example, I define a domain for a_id as [('code','child_of','abc')]. Without name_get(), it will fail with domain error. With name_get() defined, it can do as expected.

After many tests, I see that search() of a model must be called explicit through other methods (name_get() here), otherwise it will fail, can't do any customizations on domain search.

I think that orm should call search() overriden method of model at any time. my above tests show that orm calls search() of osv.osv.

Thanks,

Amit Parik (amit-parik)
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
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.