Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6 ตอบกลับ
3829 มุมมอง

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.

อวตาร
ละทิ้ง
ผู้เขียน

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.

ผู้เขียน

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

ผู้เขียน คำตอบที่ดีที่สุด

Someone has an idea?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง

Not in Odoo 11. THe fax field is missing