Merge lp:~openerp-commiter/openobject-client/5.0-opw-52718-nch into lp:openobject-client/5.0

Proposed by Naresh(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-commiter/openobject-client/5.0-opw-52718-nch
Merge into: lp:openobject-client/5.0
Diff against target: 30 lines (+11/-0)
1 file modified
bin/widget/view/form_gtk/one2many_list.py (+11/-0)
To merge this branch: bzr merge lp:~openerp-commiter/openobject-client/5.0-opw-52718-nch
Reviewer Review Type Date Requested Status
Olivier Laurent (Open ERP) Pending
Review via email: mp+86664@code.launchpad.net

Description of the change

Hello,

There is a an error with one2many object in any form of OpenERP v5 It happens on all forms,
Here are the steps to reproduce:
1. Open any saved data (ie. Sale Order)
2. Change some data in one2many object (ie. quantites on lines) and
don't save, just press OK (quantity will change in one2many list)
3. Add a new line
4. Save the whole data (form)
5. The data you change in step 2. will return to original data

Regards,

To post a comment you must log in.

Unmerged revisions

1100. By Naresh(OpenERP)

[FIX]:reload of previous values in O2M

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/widget/view/form_gtk/one2many_list.py'
2--- bin/widget/view/form_gtk/one2many_list.py 2010-04-15 07:57:53 +0000
3+++ bin/widget/view/form_gtk/one2many_list.py 2011-12-22 07:06:27 +0000
4@@ -288,15 +288,26 @@
5 self._readonly = False
6 self.screen.current_view.widget.set_sensitive(True)
7 else:
8+ modified = {}
9 ok = 1
10 dia = dialog(self.attrs['relation'], parent=self._view.model, attrs=self.attrs, model_ctx=self.screen.models._context, default_get_ctx=ctx, window=self._window, readonly=self._readonly)
11 while ok:
12 ok, value = dia.run()
13 if ok:
14+ for m in self.screen.models.models:
15+ if m.is_modified():
16+ modified.setdefault(m, {})
17+ modified[m] = m.get()
18 self.screen.models.model_add(value)
19 value.signal('record-changed', value.parent)
20 self.screen.display()
21 dia.new()
22+ if modified:
23+ for model, val in modified.iteritems():
24+ for k, v in val.iteritems():
25+ if isinstance(v,list) and len(v) and isinstance(v[0],tuple):
26+ val[k] = v[0][2]
27+ model.set(val, True)
28 dia.destroy()
29
30 def _sig_edit(self, *args):