Hello,
In Odoo 18, I have two models:
class A(models.Model):
_name = 'class.a'
name = fields.Char(string='Name')
other_field = fields.Char(string='Other Field')
class B(models.Model):
_name = 'class.b'
name = fields.Char(string='Name')
a_ids = fields.Many2many(string='A_ids', comodel_name='class.a')
And I have an XML view for the 'class.b'
<record id="class_b_fom_view" model="ir.ui.view">
<field name="name">class.b.form.view</field>
<field name="model">class.b</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<field name="name"/>
<field name="a_ids">
<list create="False">
<field name="name"/>
<field name="other_field"/>
</list>
<form create="False" edit="False" delete="False">
<field name="name"/>
<field name="other_field"/>
</form>
</field>
</form>
</field>
</record>
I can add existing 'class.a' records.
I can't create, modify or delete 'class.a' records.
However, if I click on a record already selected, and if I click on the maximization button (top, at left of X close button) of the form of 'class.a', Odoo switch to the normal 'class.a' form and I can modify and suppress the record, as well as create a new 'class.a' record.
How to avoid this behavior, e.g.deleting the maximization button or hiding it?
Best regards,
Boris
Who is supposed to create/write/unlink class.a records? Because this sounds more like bad permission management. With two access rules you could simply prevent peasants from doing any modification and only grant it to users with elevated access.