trytond-patches/issue12711002_1.diff
Sergi Almacellas Abellana e8364e7e94 Add patch for issue4353
2014-11-20 14:24:43 +01:00

42 lines
1.5 KiB
Diff

Index: trytond/trytond/model/fields/one2one.py
===================================================================
--- a/trytond/trytond/model/fields/one2one.py
+++ b/trytond/trytond/model/fields/one2one.py
@@ -43,7 +43,6 @@
])
to_delete.extend(relations)
if value:
- to_create = []
for record_id in ids:
to_create.append({
self.origin: record_id,
Index: trytond/tests/test_fields.py
===================================================================
--- a/trytond/trytond/tests/test_fields.py
+++ b/trytond/trytond/tests/test_fields.py
@@ -2269,6 +2269,21 @@
'name': 'one2one5',
'one2one': target5.id,
}])
+ targets = self.one2one_target.create([{
+ 'name': 'multiple1',
+ }, {
+ 'name': 'multiple2',
+ }])
+ one2ones = self.one2one.create([{
+ 'name': 'origin6',
+ 'one2one': targets[0].id,
+ }, {
+ 'name': 'origin7',
+ 'one2one': targets[1].id,
+ }])
+ for one2one, target in zip(one2ones, targets):
+ self.assert_(one2one)
+ self.assertEqual(one2one.one2one, target)
transaction.cursor.rollback()