Allow to add on One2Many in editable list view

This commit is contained in:
Cédric Krier committed 2008-03-22 18:38:25 +01:00
1 parent 83ba798d88
commit efc70e0071
2 files changed
+22

No files matched your search

@@ -79,6 +79,9 @@ class EditableTreeView(gtk.TreeView):
if focus_column and (focus_column._type in ('many2one','many2many')) \
and self.screen.form:
self.screen.form.message_state(_('Relation Field: F1: New F2: Open/Search'))
elif focus_column and (focus_column._type in ('one2many')) \
and self.screen.form:
self.screen.form.message_state(_('Relation Field: F1: New'))
elif focus_column and (focus_column._type in ('boolean')):
start_editing = False
elif self.screen.form:
@@ -457,6 +457,25 @@ class O2M(Char):
def value_from_text(self, model, text):
raise UnsettableColumn('Can not set column of type o2m')
def open_remote(self, model, create=True, changed=False, text=None):
if not create:
raise NotImplementedError
modelfield = model.mgroup.mfields[self.field_name]
relation = modelfield.attrs['relation']
context = modelfield.context_get(model)
dia = O2MDialog(relation, parent=model, attrs=modelfield.attrs,
default_get_ctx=context, window=self.window)
res = True
while res:
res, value = dia.run()
if res:
model.value[self.field_name].model_add(value)
value.signal('record-changed', value.parent)
dia.new()
dia.destroy()
return False, False
class M2M(Char):