[6.0.1] : Correction needed on creation of O2M records while parent record has more than one O2Ms.

Bug #705485 reported by Serge
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web Client
Fix Released
High
OpenERP R&D Web Team

Bug Description

Sample of view

server/bin/addons/base/res/partner/partner_view.xml

in partner view, use a form/tree for show the address

<notebook colspan="4">
                        <page string="General">
                            <field colspan="4" mode="form,tree" name="address" nolabel="1" select="1" height="260">

Bug from addons/openerp/widgets/form/_o2m.py REV 4227

f self.view_type == 'form':
            if current.id and not self.id:
                self.id = current.id
                params.id = self.id

Bug Description

If you add other one2many field after the address section, they use the ID of the address because code change the TERP_ID.

In my case i have partner id 90, address id 92, when i try to set a value to other one2many field declare after in the view, openerp generate a error because he try to read the partner id 92 and i dont have partner id 92, if i have a partner id 92 he read it and nothing let us know he read the bad one.

So to reproduce the error, use a partner lined with a address where the address id > last partner id

I dont have time to search why this code os added in revision 4227, but my solution to solve the problem at id to put in comment the line : params.id = self.id, but i<m sure is a better way to solve that, i just dont have time to search.

This a major bug again, because if i have more address than partner (that happen all time, because many partner have 2 address), each time i use a partner id link with a address id > last partner_id , is impossible to set other one2many fields.

Thank

Revision history for this message
DBR (OpenERP) (dbr-openerp) wrote :

Hello Serge,

Would you please elaborate more with proper example.

Thanks.

Changed in openobject-client-web:
status: New → Incomplete
Revision history for this message
Serge (sboivin) wrote :

create 10 partner, create 2 address by partner,

add a one2many field in the view, after the address parts

edit the last partner (id 10) try to modify the new one2many field, you will got a error, because the one2many fields have address id for parent, he need the partner_id.

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Following is the traceback:

Traceback (most recent call last): File "/home/jvo/workspace/6.0/server/bin/netsvc.py", line 489, in dispatch result = ExportService.getService(service_name).dispatch(method, auth, params) File "/home/jvo/workspace/6.0/server/bin/service/web_services.py", line 599, in dispatch res = fn(db, uid, *params) File "/home/jvo/workspace/6.0/server/bin/osv/osv.py", line 122, in wrapper return f(self, dbname, *args, **kwargs) File "/home/jvo/workspace/6.0/server/bin/osv/osv.py", line 176, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/home/jvo/workspace/6.0/server/bin/osv/osv.py", line 167, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/home/jvo/workspace/6.0/server/bin/osv/orm.py", line 2921, in read result = self._read_flat(cr, user, select, fields, context, load) File "/home/jvo/workspace/6.0/server/bin/osv/orm.py", line 3032, in _read_flat res2 = self._columns[val[0]].get(cr, self, ids, val, user, context=context, values=res) File "/home/jvo/workspace/6.0/server/bin/osv/fields.py", line 793, in get res = self._fnct(obj, cr, user, ids, name, self._arg, context) File "/home/jvo/workspace/6.0/server/bin/osv/fields.py", line 1060, in _fnct_read res[prop.res_id.id][prop.fields_id.name] = value or False KeyError: False

This is supposed to happen when you have NEWLY CREATED partner's ID less than the NEWLY created Address, and with the new address opened, add a bank account.

Thanks for reporting Serge, this can be considered as a blocking point.
Hence, I am setting the priority High.
Correct me If I misunderstood.

Thanks.

Changed in openobject-client-web:
status: Incomplete → Confirmed
importance: Undecided → High
assignee: nobody → OpenERP SA's Web Client R&D (openerp-dev-web)
summary: - [TRUNK 4430] Bug when you use a from view in a form view
+ [6.0.1] : Correction needed on creation of O2M records while parent
+ record has more than one O2Ms.
Revision history for this message
Sananaz (Open ERP) (sma-tiny) wrote :

Hello Serge,

Its fixed in trunk web-client. Please update your code.

Revision-info:
4467 <email address hidden>

Thank you for notifying.

Changed in openobject-client-web:
status: Confirmed → Fix Released
milestone: none → 6.0.1
Revision history for this message
Serge (sboivin) wrote :

i will test it today, thank ;)

Revision history for this message
Leigh Willard (leigh) wrote :

Since this is a major bug, is there a patch for it? We do not want to install trunk - we would like to free at the stable version.

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.