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:
1 parent
c8112db48b
commit
4bacba8f75
1 file changed
+6
@@ -816,6 +816,12 @@ class ReferenceField(CharField):
|
||||
return None
|
||||
|
||||
def get(self, record, check_load=True, readonly=True, modified=False):
|
||||
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):
|
||||
|
||||
Reference in new issue
Block a user