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

Hello

Could someone help me to know the correct way to modify a form, for example in the recruitment procedure, I am trying to add or deletes some fields, and then how to do to be reflected in the data database 

I will appreciate for your help

Аватар
Отменить
Лучший ответ

Hi,

To add custom field to a existing view, already many documentation is available also there is lot of similar questions in the forum itself.

To add a custom field check out this video, in which it is explained : Add custom field

from odoo import models, fields

class TestInherited(models.Model):
_inherit = 'model_name'

custom_field = fields.Char(string='Custom Field')

Then in the XML,

<!--Inherit the corresponding form view--> 
<record id="view_sale_order_custom" model="ir.ui.view">
<field name="name">test.custom.form.inherited</field>
<field name="model">model_name</field>
<field name="inherit_id" ref="external_id_of_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='field_in_original_form']" position="after">
<field name="custom_field"/>
  </xpath>
</field>
</record>

Thanks

Аватар
Отменить
Автор Лучший ответ

Hello Niyas, Is  this procedure avaible for Odoo Commnity version?

If yes, I tried to modify with the developer mode the form, showed in the web site for the applicant, but it is not update in the backend


Аватар
Отменить

Did you declare the xml file in the manifest? Like this :

'data': [ 'views/sale_order_custom.xml']