跳至内容
菜单
此问题已终结
2 回复
7361 查看

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']