Cédric Krier pushed to branch branch/5.0 at Tryton / Tryton
Commits:
6ab7548b by Nicolas Évrard at 2023-06-27T14:59:33+02:00
Do not set previous record in selection changed callback when it is destroyed
Closes #12357
(grafted from cc4b93be0eeb71875b9db93093ffade0c2669727)
- - - - -
fc74b81a by Nicolas Évrard at 2023-05-11T15:39:34+02:00
Do not reset view when switching to a tabbed wizard form
Closes #12317
(grafted from 688198fbf4432175968378219f6c049cdd338868)
- - - - -
66651437 by Cédric Krier at 2023-06-08T18:42:07+02:00
Skip child position of exported data based on field names
When exporting data of a xxx2Many field, the column to skip should be based on
the child field names instead of the exported value (which can be 0 for
example).
Closes #12316
(grafted from a91e1a9f95ca2b22d4ce5372b1753999d03aa8af)
- - - - -
5 changed files:
- tryton/tryton/gui/window/view_form/view/list.py
- tryton/tryton/gui/window/wizard.py
- trytond/trytond/model/modelstorage.py
- trytond/trytond/tests/export_data.py
- trytond/trytond/tests/test_exportdata.py
Changes:
=====================================
tryton/tryton/gui/window/view_form/view/list.py
=====================================
@@ -956,7 +956,9 @@
def __select_changed(self, tree_sel):
previous_record = self.screen.current_record
- if previous_record and previous_record not in previous_record.group:
+ if (previous_record
+ and (previous_record not in previous_record.group
+ or previous_record.destroyed)):
previous_record = None
if tree_sel.get_mode() == gtk.SELECTION_SINGLE:
=====================================
tryton/tryton/gui/window/wizard.py
=====================================
@@ -308,7 +308,7 @@
def set_cursor(self):
if self.screen:
- self.screen.set_cursor()
+ self.screen.set_cursor(reset_view=False)
class WizardDialog(Wizard, NoModal):
=====================================
trytond/trytond/model/modelstorage.py
=====================================
@@ -591,10 +591,11 @@
child_lines = ModelStorage.__export_row(child_record,
child_fields_names)
if first:
- for child_fpos in range(len(fields_names)):
- if child_lines and child_lines[0][child_fpos]:
- data[child_fpos] = \
- child_lines[0][child_fpos]
+ if child_lines:
+ for child_fpos in range(len(fields_names)):
+ if child_fields_names[child_fpos]:
+ data[child_fpos] = (
+ child_lines[0][child_fpos])
lines += child_lines[1:]
first = False
else:
=====================================
trytond/trytond/tests/export_data.py
=====================================
@@ -13,6 +13,7 @@
"Export Data Target"
__name__ = 'test.export_data.target'
name = fields.Char('Name')
+ value = fields.Float("Value")
class ExportData(ModelSQL):
=====================================
trytond/trytond/tests/test_exportdata.py
=====================================
@@ -327,6 +327,26 @@
[[export1.id, 'Target 1'], ['', 'Target 2'], [export2.id, '']])
@with_transaction()
+ def test_one2many_empty_value(self):
+ "Test export_data one2many with first child with 0 value"
+ pool = Pool()
+ ExportData = pool.get('test.export_data')
+ ExportDataTarget = pool.get('test.export_data.target')
+
+ export, = ExportData.create([{}])
+ ExportDataTarget.create([{
+ 'value': 0,
+ 'one2many': export.id,
+ }, {
+ 'value': 42,
+ 'one2many': export.id,
+ }])
+
+ self.assertEqual(
+ ExportData.export_data([export], ['id', 'one2many/value']),
+ [[export.id, 0], ['', 42]])
+
+ @with_transaction()
def test_reference(self):
'Test export_data reference'
pool = Pool()
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/compare/e9e22c04e36236a954b79e3e4904d3c118170544...66651437ffbdb5cade0e767ac2a3cfcb5dc2450b
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/compare/e9e22c04e36236a954b79e3e4904d3c118170544...66651437ffbdb5cade0e767ac2a3cfcb5dc2450b
You're receiving this email because of your account on foss.heptapod.net.