Skip to Content
Menu
This question has been flagged
6 Replies
3512 Views

Hey folks,

I'm trying to add a fax field after the Phone field with the custom module. The module has been successfully installed, but I don't see my fax field. Here's my code.


my_module/views/res_partner_views.xml

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

<field name="name">Fax</field>

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

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

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

<xpath expr="//field[@name='phone']" position="after">

<field name="fax"/>

</xpath>

</field>


my_module/models/res_partner.py

from odoo import models, fields, api

class fax_partner(models.Model):

_inherit = 'res.partner'

fax = fields.Char(default="")

<xpath expr="//field[@name='phone']" position="after">


Strange but it works if I replace phone with eg. vat 

<xpath expr="//field[@name='vat']" position="after">
 

Any idea?


Thanks in advance.

Avatar
Discard
Author

I see that the field phone and mobile is from widget phone.

I don't know maybe it is important and there is something to consider.

Sorry I forgot to inform you that I am using odoo 11. From this version there is no fax field.

Author

What do you mean by that?

How to inherit models and views in Odoo read http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html

May be its helpful in you case. Just read and try to solve your problem.

Regards,

Sehrish

Author Best Answer

Someone has an idea?

Avatar
Discard
Best Answer

there is already a field named fax in the original partner view.

Avatar
Discard

Not in Odoo 11. THe fax field is missing