Force value of parent Reference field

Since 2.6, reference field can be used in One2Many so in this case the value
should be forced like for Many2One.

review2581002
(transplanted from 67acb340ba7caf7f6c801e2c7af6884e6603b614)
This commit is contained in:
Cédric Krier committed 2014-01-09 18:45:14 +01:00
1 parent 6eab7fefb8
commit 695e08021c
1 file changed
+6
@@ -777,6 +777,12 @@ class ReferenceField(CharField):
return None
def get(self, record):
if record.parent_name == self.name:
if record.parent:
return '%s,%s' % (record.group.parent.model_name,
record.parent.id)
else:
return None
if (record.value.get(self.name)
and record.value[self.name][0]
and record.value[self.name][1] >= -1):