Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
4 Răspunsuri
3631 Vizualizări

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>
Imagine profil
Abandonează
Autor Cel mai bun răspuns

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>
Imagine profil
Abandonează
Cel mai bun răspuns

True

no longer works in Odoo 15.

You need to set it like

autofocus



Imagine profil
Abandonează
Cel mai bun răspuns

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>

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

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

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

Best regards,

Tim

Imagine profil
Abandonează