Пример #1
0
 def create(self, record):
     from Koo.Model.Group import RecordGroup
     group = RecordGroup(resource=self.attrs['relation'],
                         fields={},
                         parent=record,
                         context=self.context(record, eval=False))
     group.setDomainForEmptyGroup()
     group.tomanyfield = self
     self.connect(group, SIGNAL('modified'), self.groupModified)
     return group
Пример #2
0
 def set(self, record, value, test_state=False, modified=False):
     from Koo.Model.Group import RecordGroup
     # We can't add the context here as it might cause an infinite loop in
     # some cases where a field of the parent appears in the context,
     # and the parent is just being loaded.
     # This has crashed when switching view of the 'account.invoice.line'
     # one2many field in 'account.invoice' view.
     group = RecordGroup(resource=self.attrs['relation'], fields={
     }, parent=record, context=self.context(record, eval=False))
     group.tomanyfield = self
     group.modified.connect(self.groupModified)
     group.setDomain([('id', 'in', value)])
     group.load(value)
     record.values[self.name] = group
     if modified:
         self.changed(record)