← Back to team overview

openerp-india team mailing list archive

[Bug 1087424] [NEW] multi company - access violation of res_company

 

Public bug reported:


this company rule 
[('id','child_of',[user.company_id.id])] 
returns only one record which is correct

I had to apply a workaround,

openerp/osv/orm.py

3436             for sub_ids in cr.split_for_in_conditions(ids):
3437                 if rule_clause:
3438                     cr.execute(query, [tuple(sub_ids)] + rule_params)
3439                     # FIXME - FGF
3440                     # the rules for company does not work for user in sub company having only access to this child, not to the mother
3441                     # cr.rowcount returns 1 - which is correct
3442                     # len(sub_ids) returns 2 - which is not correct
3443                     if cr.rowcount != len(sub_ids) and self._table != 'res_company':
3444                         raise except_orm(_('AccessError'),
3445                                          _('(A) Operation prohibited by access rules, or performed on an already deleted document (Operation: read, Document type: %s).')
3446                                          % (self._description,))

** Affects: openobject-addons
     Importance: Undecided
         Status: New

-- 
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/1087424

Title:
  multi company - access violation of res_company

Status in OpenERP Addons (modules):
  New

Bug description:
  
  this company rule 
  [('id','child_of',[user.company_id.id])] 
  returns only one record which is correct

  I had to apply a workaround,

  openerp/osv/orm.py

  3436             for sub_ids in cr.split_for_in_conditions(ids):
  3437                 if rule_clause:
  3438                     cr.execute(query, [tuple(sub_ids)] + rule_params)
  3439                     # FIXME - FGF
  3440                     # the rules for company does not work for user in sub company having only access to this child, not to the mother
  3441                     # cr.rowcount returns 1 - which is correct
  3442                     # len(sub_ids) returns 2 - which is not correct
  3443                     if cr.rowcount != len(sub_ids) and self._table != 'res_company':
  3444                         raise except_orm(_('AccessError'),
  3445                                          _('(A) Operation prohibited by access rules, or performed on an already deleted document (Operation: read, Document type: %s).')
  3446                                          % (self._description,))

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1087424/+subscriptions


Follow ups

References