Mohammed Shekha(Open ERP) has proposed merging
lp:~openerp-dev/openobject-client-web/6.0-opw-516504-msh into
lp:openobject-client-web.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-516504-msh/+merge/96061
Hello,
Fixed the issue of many2many in which record is disappeared when we selects
some record from manymany and without saving parent record when we edit
many2many record and save it, the records of many2many which we just selected
will disappeared.
Demo :- To face this issue make tree view of account.tax editable, now go to
Products -> Edit any product -> account tax(many2many field) in Accounting tab
-> Select some records in many2many field now without saving the parent record
of product edit any many2many record and save it, you will see the record will
disappeared from the list.
Reason :- The reason is when we edit and save the record for editable list view
at that time save method of listgrid.py is called, here we replace the ids by
all_ids, all_ids is the result of read method, here we have not saved parent
record so database does not contains that many2many entries with this product.
Hence changed the code to fix this issue.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-516504-msh/+merge/96061
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-client-web/6.0-opw-516504-msh.
=== modified file 'addons/openerp/controllers/listgrid.py'
--- addons/openerp/controllers/listgrid.py 2011-07-04 07:22:13 +0000
+++ addons/openerp/controllers/listgrid.py 2012-03-06 05:40:21 +0000
@@ -71,12 +71,13 @@
data = {fld : [(id and 1, id, data.copy())]}
proxy.write([params.parent.id], data, ctx)
- all_ids = proxy.read([params.parent.id], [fld])[0][fld]
- new_ids = [i for i in all_ids if i not in ids]
+ if not id:
+ all_ids = proxy.read([params.parent.id], [fld])[0][fld]
+ new_ids = [i for i in all_ids if i not in ids]
- ids = all_ids
- if new_ids:
- id = new_ids[0]
+ ids = all_ids
+ if new_ids:
+ id = new_ids[0]
else:
data = frm.copy()
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp