4

I'm trying to make a tree editable inline. I don't want to be able to create or remove records from that tree.

So what I did is the next:

<tree string="Event participants" create="false" delete="false" editable="bottom">

But this is not working properly, because when I set the parameter create to false, the Save button disappears, and the only way to save the changes made on a record is to click on other one after the modification (which is a bit confusing).

If I set create to true, the button Save appears again but also the Create button, which I don't want. I tried several combinations (edit="true", editable="top", editable="bottom" with both create="false" and create="true") but I didn't achieve my purpose.

Can anyone help me here, please?

EDIT

XML code of the tree view:

<record model="ir.ui.view" id="view_event_participant_diploma_tree">
    <field name="name">ei.event.participant.diploma.tree</field>
    <field name="model">ei.event.participant</field>
    <field name="priority" eval="17"/>
    <field name="arch" type="xml">
        <tree string="Event participants" create="false" delete="false" editable="bottom">
            <field name="name"/>
            <field name="surname"/>
            <field name="parent_id"/>
            <field name="tin"/>
            <field name="diploma"/>
            <field name="diploma_delivered"/>
            <field name="state"/>
        </tree>
    </field>
</record>

Python code of the function which opens the tree view:

@api.multi
def open_diploma_management(self):
    tree_view_id = self.env.ref(
        'event_ina.view_event_participant_diploma_tree').id
    for event in self:
        return {
            'name': 'Diplomas management',
            'view_type': 'form',
            'view_mode': 'tree',
            'views': [(tree_view_id, 'tree'), ],
            'res_model': 'ei.event.participant',
            'domain': [('event_id', '=', event.id)],
            'type': 'ir.actions.act_window',
            'target': 'current',
            'flags': {'action_buttons': True},
        }
forvas
  • 9,801
  • 7
  • 62
  • 158
  • 1
    When you set `create="false"` only the `Add new item` will be hidden, and the `save` button should appear after you clicking on `Edit` button, I've been trying your combination `create="false" delete="false" editable="botton"` and it working properly, please share your code with as to be able to help you more. – Juan Salcedo Aug 25 '15 at 14:16
  • Thank you @JuanSalcedo, I've edited my question to show all the code which should be affecting to the tree view. – forvas Aug 26 '15 at 07:45

0 Answers0