openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #27658
[Bug 1309105] Re: stock.picking.out group by in multi companies
** Also affects: ocb-addons
Importance: Undecided
Status: New
** Also affects: ocb-addons/7.0
Importance: Undecided
Status: New
** Changed in: ocb-addons/7.0
Status: New => Fix Committed
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1309105
Title:
stock.picking.out group by in multi companies
Status in OpenERP Community Backports (Addons):
Fix Committed
Status in OpenERP Community Backports (Addons) 7.0 series:
Fix Committed
Status in OpenERP Addons (modules):
New
Bug description:
In multi company context, when using the group by 'state' in Delivery
Orders I encountered the following error:
(Document type: Picking List, Operation: read)
Traceback (most recent call last):
File ".../server/openerp/netsvc.py", line 296, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File ".../server/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File ".../server/openerp/osv/osv.py", line 190, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File ".../server/openerp/osv/osv.py", line 132, in wrapper
return f(self, dbname, *args, **kwargs)
File ".../server/openerp/osv/osv.py", line 199, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File ".../server/openerp/osv/osv.py", line 187, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File ".../server/openerp/osv/orm.py", line 2759, in read_group
data = self.read(cr, uid, data_ids, [groupby], context=context)
File ".../addons/stock/stock.py", line 3128, in read
return self.pool.get('stock.picking').read(cr, uid, ids, fields=fields, context=context, load=load)
File ".../server/openerp/osv/orm.py", line 3680, in read
result = self._read_flat(cr, user, select, fields, context, load)
File ".../server/openerp/osv/orm.py", line 3735, in _read_flat
self._check_record_rules_result_count(cr, user, sub_ids, result_ids, 'read', context=context)
File ".../server/openerp/osv/orm.py", line 3939, in _check_record_rules_result_count
(self._description, operation))
except_osv: (u'Access Denied', u'The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: Picking List, Operation: read)')
After digging a bit, I found that orm method read_group calls
orm.py: 2640
self._apply_ir_rules(cr, uid, query, 'read', context=context)
In there, we get the get domain on stock.picking.out which will be
empty by default. So query will not have any ir_rule applied.
Then, in read_group again, there is the big query that will get the
counts. However it will also takes min(id).
The min id will be passed in read() to which will again be applied the
ir_rules. But this time it won't be None, it will read stock.picking
rule and not the unexistant stock.picking.out rule.
Thus it will fail if min id is a stock picking out from the other
company than the current user's company.
As a temporary patch I duplicated stock.stock_picking_rule for
stock.picking.in and stock.picking.out
I'll provide a patch to solve it on the read_group method in stock
module
To manage notifications about this bug go to:
https://bugs.launchpad.net/ocb-addons/+bug/1309105/+subscriptions
References