Im new to odoo and I need to change the modal view that shows when you edit a contact and you click the Add button on Contacts & Addresses. I need the view name to add some code with xpath.
Asked
Active
Viewed 202 times
2 Answers
0
The add button refers to one2many
field named child_ids
in res.partner
model see
https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/views/res_partner_views.xml#L238
By clicking on it directs you to the form view so you can create a new record in res.partner
so basically the view that you are looking for is res.partner.form

nouraellm
- 357
- 8
- 15
0
you can do this in your python file with your specific id please attention to this example:
<record model="ir.ui.view" id="level_form">
<field name="name">example form</field>
<field name="model">levels.from</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="levelno" />
<button name="open_conditional_view" string="Classify"
type="object" class="oe_highlight"/>
</field>
</group>
</sheet>
</form>
</field>
</record>
you have to define type = object and write the function with the same name of this button and at your model.py file like this:
def open_conditional_view(self):
if your condition to set view:
view_id = self.env.ref('your_module_name.id of your view when condition is true').id
else:
view_id = self.env.ref('your_module_name.id of your view when condition is false').id
return {
'name': 'test ',
'view_mode':'form',
'res_model':'your model name of view',
'type':'ir.actions.act_window',
'target':'new',
'views':[(view_id,'tree')],
}

reyhane janboori
- 332
- 1
- 8