Merge lp://staging/~openerp-dev/openobject-addons/7.0-opw-596679-rgo into lp://staging/openobject-addons/7.0

Proposed by Ravi Gohil (OpenERP)
Status: Merged
Merged at revision: 10007
Proposed branch: lp://staging/~openerp-dev/openobject-addons/7.0-opw-596679-rgo
Merge into: lp://staging/openobject-addons/7.0
Diff against target: 31 lines (+5/-5)
1 file modified
procurement/procurement.py (+5/-5)
To merge this branch: bzr merge lp://staging/~openerp-dev/openobject-addons/7.0-opw-596679-rgo
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Approve
Naresh(OpenERP) Pending
Review via email: mp+186294@code.staging.launchpad.net

Description of the change

Hi,

This branch fixes the issue faced when user, who belongs to the company other than the 'Your Company', tries to create record for object stock.warehouse.orderpoint(Warehouse/Configuration/Reordering Rules), it says, "Access denied - Document type: Warehouse, Operation: read"

The reason is the xml_id(warehouse0) used to set the default warehouse for stock.warehouse.orderpoint object, which may not belong to current user's company.

I fixed this issue by searching the warehouse belonging to current user's company and set accordingly.

Kindly review the fix.

Thanks.

To post a comment you must log in.
Revision history for this message
Romain Deheele - Camptocamp (romaindeheele) wrote :

Hi,

I've tested your branch.
It leads to the next traceback :
2013-10-17 11:24:42,490 3719 ERROR rhonalia openerp.netsvc: company_id
Traceback (most recent call last):
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/rdeheele/oerp/sandbox/parts/addons/product/product.py", line 752, in copy
    context=context)
  File "/home/rdeheele/oerp/sandbox/parts/addons/mail/mail_thread.py", line 302, in copy
    return super(mail_thread, self).copy(cr, uid, id, default=default, context=context)
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/orm.py", line 5038, in copy
    new_id = self.create(cr, uid, data, context)
  File "/home/rdeheele/oerp/sandbox/parts/addons/mail/mail_thread.py", line 242, in create
    thread_id = super(mail_thread, self).create(cr, uid, values, context=context)
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/orm.py", line 4477, in create
    result += self._columns[field].set(cr, self, id_new, field, vals[field], user, rel_context) or []
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/fields.py", line 559, in set
    id_new = obj.create(cr, user, act[2], context=context)
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/orm.py", line 4325, in create
    vals = self._add_missing_default_values(cr, user, vals, context)
  File "/home/rdeheele/oerp/sandbox/parts/server/openerp/osv/orm.py", line 2491, in _add_missing_default_values
    defaults = self.default_get(cr, uid, missing_defaults, context)
  File "/home/rdeheele/oerp/sandbox/parts/addons/procurement/procurement.py", line 554, in default_get
    warehouse_ids = warehouse_obj.search(cr, uid, [('company_id', '=', res['company_id'])], context=context)
KeyError: 'company_id'

Revision history for this message
Ravi Gohil (OpenERP) (rgo-openerp) wrote :

Hi Romain Deheele,

Thanks for pointing the mistake.

I just updated the branch to fix the mistake, would you please check again and share the feeback.

Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Merged in 7.0, thanks for the fix

revno: 10007 [merge]
revision-id: <email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.