Prototype inheritance on account.invoice doesn't work.

Bug #1026578 reported by Andrius Preimantas @ hbee
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Medium
OpenERP's Framework R&D

Bug Description

Steps to reproduce:
1. install account module
2. install module which uses prototype inheritance on account.invoice object (I created a dummy module. You can find it in attachments)
3. Try to create an invoice and receive an error:
> Unknown Error
> Field move_id not found in browse_record(test.invoice, 3)

I used openerp 6.1 nightly built server and fresh database.
http://nightly.openerp.com/6.1/nightly/src/openerp-6.1-20120718-233405.tar.gz

Cheers

Revision history for this message
Andrius Preimantas @ hbee (andrius-preimantas) wrote :
summary: - Traditional inheritance on account.invoice doesn't work.
+ Prototype inheritance on account.invoice doesn't work.
Revision history for this message
Andrius Preimantas @ hbee (andrius-preimantas) wrote :

Any progress on this issue? I assume it concerns not only account.invoice object, the bug should be visible throughout the system when using prototype inheritance on any object, so it's quite important problem.

Revision history for this message
Andrius Preimantas @ hbee (andrius-preimantas) wrote :

Ok, so that's what I've figured out so far:

All the action takes place in BaseModel class, inside create method, on lines 4233-4240:

At the beginning of new account.invoice creation, an ID is acquired for this new object. This ID is passed to _store_get_values method (line 4234) which returns a list of tuples, which looks like this:

[(10, 'account.invoice', [52L], ['number']), (50, 'test.invoice', [52L], ['reconciled'])]

Then (line 4239) _store_set_values method is invoked on every object from the list, but IDS passed for each method invocation is one of the account.invoice object, which second invocation (test.invoice object) makes illogical (because IDS belongs to account.invoice object, not test.invoice).

Of course the problem lies somewhere deeper, but this should be good entry point for solving this issue.

Cheers,

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Jignesh Rathod(OpenERP) (jir-openerp) wrote :

Hello ,

This may be related to lp:799378.
Because if we have used different _name with _inherit then this type of
error will raised.

Thanks for reporting.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Ajay,

I don't think it's a real duplicate of lp:996816, as the exception is different and probably the bug as well. lp:799378, lp:996816 and this one all three are related to each other but we can not consider all as a duplicate because If we missed the one part of them then may be all things will not fixed. So I am going to remove the duplicate.

Hope you can understand!

Thank you!

Revision history for this message
Ignas Karpiejus @ hbee (ignas-karpiejus) wrote :
Download full text (3.5 KiB)

Hello all,

seems similar problem persists on OpenERP v7, I'm trying to inherit sale.order by prototyping and when trying to create default object sales order I'm getting an error linked to my new object, as I understand my inheritance should have no affect to original object. The error I get:

OpenERP Server Error
Client Traceback (most recent call last):
  File "/home/ignas/workspace/OpenERP7/openerp/addons/web/http.py", line 195, in dispatch
    response["result"] = method(self, **self.params)
  File "/home/ignas/workspace/OpenERP7/openerp/addons/web/controllers/main.py", line 1079, in call_kw
    return self._call_kw(req, model, method, args, kwargs)
  File "/home/ignas/workspace/OpenERP7/openerp/addons/web/controllers/main.py", line 1071, in _call_kw
    return getattr(req.session.model(model), method)(*args, **kwargs)
  File "/home/ignas/workspace/OpenERP7/openerp/addons/web/session.py", line 43, in proxy
    result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
  File "/home/ignas/workspace/OpenERP7/openerp/addons/web/session.py", line 31, in proxy_method
    result = self.session.send(self.service_name, method, *args)
  File "/home/ignas/workspace/OpenERP7/openerp/addons/web/session.py", line 104, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last):
  File "/home/ignas/workspace/OpenERP7/openerp/addons/web/session.py", line 90, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/ignas/workspace/OpenERP7/openerp/netsvc.py", line 295, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/ignas/workspace/OpenERP7/openerp/service/web_services.py", line 614, in dispatch
    res = fn(db, uid, *params)
  File "/home/ignas/workspace/OpenERP7/openerp/osv/osv.py", line 169, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/home/ignas/workspace/OpenERP7/openerp/osv/osv.py", line 123, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/ignas/workspace/OpenERP7/openerp/osv/osv.py", line 179, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/ignas/workspace/OpenERP7/openerp/osv/osv.py", line 166, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/ignas/workspace/OpenERP7/openerp/addons/sale/sale.py", line 341, in create
    return super(sale_order, self).create(cr, uid, vals, context=context)
  File "/home/ignas/workspace/OpenERP7/openerp/addons/mail/mail_thread.py", line 241, in create
    thread_id = super(mail_thread, self).create(cr, uid, values, context=context)
  File "/home/ignas/workspace/OpenERP7/openerp/osv/orm.py", line 4479, in create
    self.pool.get(object)._store_set_values(cr, user, ids, fields2, context)
  File "/home/ignas/workspace/OpenERP7/openerp/osv/orm.py", line 4601, in _store_set_values
    result = self._columns[val[0]].get(cr, self, ids, val, SUPERUSER_ID, context=context)
  File "/home/ignas/workspace/OpenERP7/openerp/osv/fields.py", line 1131, in get
    result = self._fnct(obj,...

Read more...

Revision history for this message
Giorgio di Napoli (notbossgroup) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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