跳至內容
選單
此問題已被標幟
2 回覆
7357 瀏覽次數

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