Odoo 14 Community Edition

I have a One2Many field called lines. I display the field as a tree in a form view like this.

<field name="lines">
    <tree editable="bottom">
        <field 
         ... doesn't matter ...
        />
    </tree>
</field>

The field is now editable but I would like to change it so that it will allow to create/delete the records within the tree by some conditions.

I tried create="0" delete="0" in the tree but it only works for "0" and "1". I can’t seem to find the way to put a condition in there.

How to overcome such challenge? The conditions can just be depending on the parent’s state — simple conditions.