KEMBAR78
How to Add a New Field to an Existing Model | PPTX
How to Add a New Field to an
Existing Model
We can adding new fields by inherit the corresponding model
in the python and you have to add the new fields, once this is
done, you can inherit the view and add the new field or
existing fields to the view.
● Consider a situation where we need to add a new field in product which specifies the
product is available or not.
● For doing this, we need to inherit the model
○ In python file: inherit the model and specify the new field
○ Make sure to verify the ‘ Model ’ and ‘ External ID ’ of the view that we want to add
the new field
○ In xml file: Specify the external id as ‘ref’ and the path where we want to place the
field
● Output of this code will be:
Check our company website
for related blogs and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.

How to Add a New Field to an Existing Model

  • 1.
    How to Adda New Field to an Existing Model
  • 2.
    We can addingnew fields by inherit the corresponding model in the python and you have to add the new fields, once this is done, you can inherit the view and add the new field or existing fields to the view.
  • 3.
    ● Consider asituation where we need to add a new field in product which specifies the product is available or not. ● For doing this, we need to inherit the model ○ In python file: inherit the model and specify the new field
  • 4.
    ○ Make sureto verify the ‘ Model ’ and ‘ External ID ’ of the view that we want to add the new field
  • 5.
    ○ In xmlfile: Specify the external id as ‘ref’ and the path where we want to place the field
  • 6.
    ● Output ofthis code will be:
  • 7.
    Check our companywebsite for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo.