orm search() method with product.product, product.template BUG

Bug #656752 reported by Jacara
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Invalid
Undecided
Dhruti Shastri(OpenERP)

Bug Description

When I login by non-admin users one record appears four times, on the models used _inherits attribute. (For example: product.product -> inherits: product.template) But when I login by admin records appear fine.

I think the reason is in below code:

base/ir/ir_rule.py : line 137

def domain_get(self, cr, uid, model_name, mode='read', context={}):
        dom = self._compute_domain(cr, uid, model_name, mode=mode)
        if dom:
            query = self.pool.get(model_name)._where_calc(cr, uid, dom, active_test=False)
            return query.where_clause, query.where_clause_params, query.tables
        return [], [], ['"'+self.pool.get(model_name)._table+'"']

When I login "dom" is "None" and so there is dupplicate appearance.
But on other users (limited user) the "dom" gets some value (dom --> list: ['|', ('company_id', '=', False), ('company_id', 'child_of', [1])])
and so query below is constucted.

'SELECT "product_product".id FROM "product_product","product_template" WHERE (product_product.active = true) AND (product_template.company_id IS NULL OR (product_template.company_id in (1))) ORDER BY id

RESULT : [(1,),(1,),(1,),(1,),(2,),(2,),(2,),(2,),(3,),(3,),(3,),(3,),(4,),(4,),(4,),(4,)]

There is some condition check in tools.misc that is:

 if key in self.cache:

In case of admin is logged in this condition is satisfied and works fine but in other cases the record appearance duplicates like in attachment.,

---------------------------------------------------------------------------------------------------------------------------
openobject-server -r2799
openobject-addons -r 4152

I'm using Ubuntu 10.04LT and Python2.6

Revision history for this message
Jacara (baskhuujacara) wrote :
Revision history for this message
JMA(Open ERP) (jma-openerp) wrote :

Hello Jacara,

After having done multiple checks unfortunately the problem does not rise up.

Things happen to work quite normal for us.

Would you please update your code and create a new database?

Please re-check and notify us if the problem still persists.

Thank you.

Changed in openobject-addons:
assignee: nobody → DHS(OpenERP) (dhs-openerp)
Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :

Hello Jacara,

We do not happen to meet the error with the latest revisions.

I would request you to check with a fresh installation and updated code.

It sounds like a problem after a customized module.

Thanks.

Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :

Hello Jacara,

Please let us know when will this query be generated?

Thanks.

Changed in openobject-addons:
status: New → Invalid
Changed in openobject-addons:
milestone: none → 6.0
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.