How Odoo dynamically creates a field

Source: Internet
Author: User

Creating fields dynamically is not a common requirement, but in some cases we do need to create fields dynamically.

There are two ways to create a field in Odoo, one is defined by the Python file class, the other is created manually on the interface, and Odoo distinguishes between the two types of fields through the State field.

Fields created through the interface must start with X_.

The author tried to create a base type field dynamically through a Python file, and the results did not find a suitable method. But after a long time to find out, you can do this by dynamically creating manual fields.


Domestic human resources applications often need to count each person's payroll, and the composition of the salary is flexible dynamic (although can be fixed, but once the change to change the module code), so it is very difficult to summarize a general table,

It is very easy to do this with the method of dynamically creating fields:

The wage composition in the table is a dynamic one2many, without modifying the code implementation summary matrix:

How Odoo dynamically creates a field

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.