Do not recycle first record as product result

The value of the field of the first record, which is edited in the list, will
be lost. Because the editable widget is started before the search pop-up and
it override the new default value with its content when the pop-up is closed.
So we can not reuse record create before the pop-up.

issue7941
review49681002
This commit is contained in:
Cédric Krier committed 2019-01-02 18:53:18 +01:00
1 parent 0f73879d51
commit 6cc13fd3d4
1 file changed
+3 -7
@@ -382,18 +382,14 @@ class One2Many(Widget):
win_search.screen.search_filter()
win_search.show()
def make_product(first=first):
def make_product():
self.screen.group.remove(first, remove=True)
if not product:
self.screen.group.remove(first, remove=True)
return
fields = list(product.keys())
for values in itertools.product(*list(product.values())):
if first:
record = first
first = None
else:
record = self.screen.new(default=False)
record = self.screen.new(default=False)
default_value = default.copy()
for field, value in zip(fields, values):
id_, rec_name = value