Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
6 Ответы
3822 Представления

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