Skip to Content
Menu
This question has been flagged
4 Replies
3283 Views

I would like to set the personal information tab as the default one instead of Contacs & Adresses.

I found on the forum that Autofocus should do the trick... But it seems not working. (Odoo Community V10 project)


<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Declared the same in every module that may need it -->
<record id="view_partner_form" model="ir.ui.view">
<field name="name">view_partner_form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_contact_personal_information_page.personal_information"/>
<field name="arch" type="xml">
<data>
<xpath expr="//page[1]" position="attributes">
<attribute name="autofocus">False</attribute>
</xpath>
<xpath expr="//page[@name='personal_information_page']" position="attributes">
<attribute name="autofocus">autofocus</attribute>
</xpath>
</data>
</field>
</record>
</odoo>
Avatar
Discard
Author Best Answer

Hi,

tried this.

But the solution is very 'simple'... To remove the default autofocus in the base view, just put it to blanc.

<xpath expr="//page[1]" position="attributes">
<attribute name="autofocus"></attribute>
</xpath>
Avatar
Discard
Best Answer

True

no longer works in Odoo 15.

You need to set it like

autofocus



Avatar
Discard
Best Answer

So solution will be combination of both reply.

<record id="view_partner_form_autofocus" model="ir.ui.view">

<field name="name">res.partner.form</field>

<field name="model">res.partner</field>

<field name="inherit_id" ref="base.view_partner_form"/>

<field name="arch" type="xml">

<xpath expr="//page[1]" position="attributes">

<attribute name="autofocus"></attribute>

</xpath>

<xpath expr="//page[@name='personal_information_page']" position="attributes">

<attribute name="autofocus">True</attribute>

</xpath>

</field>

</record>

Avatar
Discard
Best Answer

Hi,

You may try the following code and see if it works on your situtaion.

<attribute name="autofocus">True</attribute>

Best regards,

Tim

Avatar
Discard