How to make a tree only editable inline (no creation, no deletion) in Odoo8?

谁说胖子不能爱 提交于 2019-12-12 13:23:33

问题


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},
        }

来源:https://stackoverflow.com/questions/32203548/how-to-make-a-tree-only-editable-inline-no-creation-no-deletion-in-odoo8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!