Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
6 Replies
3857 Tampilan

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
Buang
Penulis

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.

Penulis

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

Penulis Jawaban Terbai

Someone has an idea?

Avatar
Buang
Jawaban Terbai

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

Avatar
Buang

Not in Odoo 11. THe fax field is missing