← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 656752] Re: orm search() method with product.product, product.template BUG

 

Hello Jacara,

Please let us know when will this query be generated?

Thanks.

** Changed in: openobject-addons
       Status: New => Invalid

-- 
orm search() method with product.product, product.template BUG
https://bugs.launchpad.net/bugs/656752
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP OpenObject.

Status in OpenObject Addons Modules: Invalid

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