Create fleet vehicle contract : backtrace error

Bug #1089876 reported by Marcel van der Boom (HS-Development BV)
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 1

Bug Description

When creating a contract for a vehicle in a fleet the system issues a backtrace

Server Traceback (most recent call last):
  File "/var/openobject-server/hsd-7.0/web/addons/web/session.py", line 87, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/var/openobject-server/hsd-7.0/server/openerp/netsvc.py", line 281, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/var/openobject-server/hsd-7.0/server/openerp/service/web_services.py", line 603, in dispatch
    res = fn(db, uid, *params)
  File "/var/openobject-server/hsd-7.0/server/openerp/osv/osv.py", line 169, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/var/openobject-server/hsd-7.0/server/openerp/osv/osv.py", line 123, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/var/openobject-server/hsd-7.0/server/openerp/osv/osv.py", line 179, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/var/openobject-server/hsd-7.0/server/openerp/osv/osv.py", line 166, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/var/openobject-server/hsd-7.0/server/openerp/addons/base/res/res_partner.py", line 403, in name_get
    name = record.name
  File "/var/openobject-server/hsd-7.0/server/openerp/osv/orm.py", line 486, in __getattr__
    raise AttributeError(e)
AttributeError: 'Field name not found in browse_record(res.partner, 9)'

The last line contains the ID of the user logged in, which sounds wrong.

Tags: fleet
Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :

Hello,

I have checked your issue with latest build:
 (Build 2109)
 - server (4682)
 - addons (8296)
 - web (3603)
But I did not face any problem.So, would you please try with latest code? and provide us some more information about your issue.For your more information I have attached video please have a look on that..

Thanks,,
Waiting For your replay... :)

Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :
Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Marcel van der Boom (HS-Development BV) (mrb) wrote :

The error occurs on the latest revisions.

When I log in as root user (id: 1) for which there is a record with id:1 in res_partner table, the error does not occur.

So, the error occurs for all users which have an ID value and that same value does NOT exits in the res_partner table.

Changed in openobject-addons:
status: Incomplete → New
Revision history for this message
Marcel van der Boom (HS-Development BV) (mrb) wrote :

This seems to be the culprit in file fleet.py: [790]

    _defaults = {
        'purchaser_id': lambda self, cr, uid, ctx: uid,

Which passes uid into context, which in turn is interpreted as a partner id in res.partner.

Either leave out the default there, or prefill it with the proper partner.

tags: added: fleet
Changed in openobject-addons:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Marcel,

You are totally right and we confirm the same error happens when we have non-admin user with non-existent Partner.

This is more or less same like assigning product instead of template.

Attached is the merge what we did for a fix locally.

Thanks.

Changed in openobject-addons:
status: Confirmed → Fix Committed
Revision history for this message
Marcel van der Boom (HS-Development BV) (mrb) wrote :

Thanks, the merge is similar to what we did locally indeed.

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Marcel,

We can also call a method to get _defaults value!

We chose to do inline code.

Thanks.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Contributed fix landed at revision 8399 revision-id: <email address hidden>

Thanks for reporting and fixing!

Changed in openobject-addons:
status: Fix Committed → Fix Released
milestone: none → 7.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.