Skip to main content

How to add custom field on any object in OpenERP - Odoo

 

How to add custom field on any object in OpenERP - Odoo

Source: https://maheshwarimayur.blogspot.com/2013/02/how-to-add-new-field-on-any-object-in.html

How to add custom field on any object in OpenERP (Odoo) without doing any hardcode!!

Say for example we need a field “Weight” on Vehicle.

Step 1: Activate Developers Mode.

a) To do that click on user name at the right upper corner of your screen and select About OpenERP (Odoo) option.

Add custom field in OpenERP

Activate Developer Mode

 
b) You will get window as shown in image below. Click on the link Activate the developer mode.

Add custom field in OpenERP


Activate Developer Mode

c) We will get a debug view From where we can edit all views of selected object.

Add custom field in OpenERP

Debug View


Step 2: Identify your object

To do that just hover your mouse on any of the field. It will show you some information like field name, object, field type etc.

Add custom field in OpenERP

Field information

As we know now that our object name is 'fleet.vehicle' and we have to add a new field to this object say for example 'weight', type of this field is integer. Let's edit our object. Here one thing is to notice that these changes are for the existing database only, it will not reflect in other database.

a) Go to the menu Settings → Techniacl → Database Structure → Models and search for fleet.vehicle

Add custom field in OpenERP

Object Search

b) Open that object and click on edit, drag the mouse to reach bottom of the page and click on Add an item link.

Add custom field in OpenERP

Object View


c) Add all detail like field name, label, type then click on 'Save & Close' button and finally click on Save button which is in Red color.

Add custom field in OpenERP

Add new field

As a field x_weight is added to our object fleet.vehicle we will now edit different views of vehicle to see the changes.

Step 3: Edit View(Form, tree)

a) Before editing excising views lets observe our current view.
Open Vehicle form view and see there is not any field with label “Weight” on it.

Add custom field in OpenERP

Vehicle's form view without any Change


b) Select the option Edit Form View from Debug View window.

Add custom field in OpenERP


Edit Form View

c) You will get a window as below. Insert the new field to appropriate position, and click on save button.

Add custom field in OpenERP

Insert new field

d) Close the window and reload the page. Here we can notice that a new field is on vehicle form view. Same way we can edit search, tree view.

Add custom field in OpenERP


Vehicle's form view with a new weight field 



Cheers ENJOY OpenERP / ODOO  !! 

Hope that was helpful.

If I just made your day a little better then thank me with a coffee or maybe a pizza

Comments

Popular posts from this blog

[RAID] SWITCH FROM AHCI TO RAID WITH INTEL C600 CONTROLLER

I personally have used other ways to do this. Manipulating some registry settings in combination with a safe boot before booting normally does the trick as well. This works with both SATA SSD and M.2 NVMe drives and it enables relatively fast switching between back and forth between AHCI and RAID. I have described this method below.  I have also tried the same process used to switch from RAD to AHCI and that works as well. Switch to safe boot Reboot into BIOS Change from AHCI to RAID in the BIOS Boot into safe mode Turn off safe mode and reboot normally again Nothing else and that also did the trick, just like with moving from RAID to AHCI.  So the link above and my step by step below is here for completeness. You have options in case one of them doesn’t work! Step by step AHCI to RAID registry method This procedure I describe below works on Windows 10 1803/1809 and has been tested on Dell Latitude E6220 an XPS 13 9360. Editing the registry is...

[Hyper-V] - Lỗi không boot vào được sau khi convert máy vật lý sang máy ảo

XỬ LÝ LỖI KHÔNG BOOT ĐƯỢC VÀO MÁY ẢO SAU KHI CONVERT TỪ MÁY VẬT LÝ BẰNG DISK2VHD Sau khi convert server vật lý sang file VHD để import vào Hyper thì khi start máy ảo lên màn hình máy ảo chỉ nhấp nháy con trỏ chuột trên màn hình đen (blinking cursor) NGUYÊN NHÂN Do máy vật lý sử dụng ổ đĩa cài OS được format theo chuẩn GPT (thay vì MBR như truyền thống, tham khảo GPT và MBR ) XỬ LÝ Bước 1: chuyển ổ GPT thành MBR Copy file VHD của ổ đĩa chứa OS về 1 máy tính Windows 8 trở lên Trên máy Windows 8+ click phải chuột lên file VHD vừa copy, chọn lệnh Mount . Lúc này dùng 1 phần mềm miễn phí (vd: Mini Partition Wizard ) để convert ổ đĩa vừa mount từ GPT  -> MBR Sau đó Delete phần Partition dư ra ở phần đầu ổ đĩa được mount (khoảng vài trăm MB) Set " Active " cho ổ đĩa này để là ổ đĩa boot OS Nhấn Apply để phần mềm thực thi tác vụ Sau khi phần mềm làm xong, tắt phần mềm Mini Partition Wizard, vào My Computer chọn eject ổ đĩa đang mount . Copy file VHD vừa đư...

LỖI "The provided partition "Migration...." is not a valid Migration mailbox"

  Solution for a valid Migration mailbox could not be found for this organization To address this issue, we will: Delete Migration mailbox in Active Directory Users and Computers Recreate Migration mailbox with /PrepareAD command Enable Migration mailbox with Exchange Management Shell 1. Delete Migration mailbox in Active Directory Users and Computers We do see the mailbox in ADUC, let’s remove it. If you don’t see it, search for it. It might be in a different container than the default container  Users . We can always verify in Exchange Management Shell if the Migration mailbox is present. If it shows up in the output, it means that it’s present and enabled. The output should be empty. [PS] C:\> Set - ADServerSettings - ViewEntireForest $true ; Get - Mailbox - Identity "Migration.8f3e7716-2011-43e4-96b1-aba62d229136" - Arbitration | Format-Table Name , ServerName , Database , AdminDisplayVersion , ProhibitSendQuota Copy 2. Recreate Migration mailbox with /Prepare...