Skip to Content
Menu
This question has been flagged
2 Replies
2536 Views

Hi all!

I would like to use Odoo Studio to add a field to the "Contact" app. It should be a fax number and should be between Phone and Mobile.

But I can't add another number between Phone and Mobile with Studio, in resp.partner. Also these fields are not normal type "Char"?

Unfortunately I can't insert pictures in my post. I hope I have expressed myself in a halfway understandable way.

Avatar
Discard
Author Best Answer

Thank you for your answer. Unfortunately I could not implement it correctly. I updated the code, but could not achieve any success.Unfortunately the scheme is still a little new to me. I'm currently trying to work my way in.Unfortunately I cannot insert any code. Is there a trick?​

This is the code from line 2, 3 and 4.

<xpath expr="//form[1]/sheet[1]/group[1]/group[2]/field[@name'funktion'] position "after">
<field name="x_studio_field_qAgcW" widget="phone" string="Fax"/>
</xpatxh>

A second question is how can I hide the fax field if it is empty. Only when I go to edit do I want to see that this field is there. If it is empty, it will be hidden, if it is full, it will be displayed.´

Avatar
Discard

Please be aware that this are very basic questions which can be avoided when reading the documentation and watching the new learning videos on www.odoo.com/slides

Author

Correct. That it is a very fundamental question, I have already mentioned myself. Nevertheless, I could not answer the question through research and search.

Unfortunately the videos are no help either. Unfortunately I could not find the answer. The basic function is known to me.

I see several typos.

Update the second line i.e. <xpath expr="//form[1]/sheet[1]/group[1]/group[2]/field[@name'funktion'] position "after">

to make it look like this: <xpath expr="//form[1]/sheet[1]/group[1]/group[2]/div[1]" position="after">

The 4th line should be </xpath>

That should fix it.

Best Answer

The fields are defined within a "group" and it looks like Studio is allowing you to add the field only at the beginning or at the end of the group.

You can update the XML of the customization by following these steps to achieve the desired result:

  • Open Studio from the Contacts screen.

  • Using the normal Studio steps, add the new "Fax" field before "Phone".

  • Go to the "View" tab in the Studio editor on the left and click on the "XML" button/icon.

  • You will see a drop down list "res.partner.form". Click on it and scroll all the way to the bottom of the list and select "Odoo Studio: res.partner.form customization". This is the XML code that Studio generated for your change.

  • You will see a snippet of XML. Update the second line of the snippet to look this. 

<xpath expr="//form[1]/sheet[1]/group[1]/group[2]/div[1]" position="after">
  • Save your changes. This will position the "Fax" field between the "Phone" and the "Mobile" fields.

To answer your second question the "Phone" and "Mobile" fields are defined as "char" fields with the widget "phone".

Avatar
Discard