Skip to Content
Menu
This question has been flagged
2 Replies
759 Views

when I add a new field for the installed custom module, it does not appear in the data structure model and  I have an error field that does not exit in the XML file.

Avatar
Discard

Can you please explain a bit more, how did you add the new field? was it through the interface or code? how did you place it on the xml file?

Author

I added the new field throght the code and then added it in XML file as same as the old fields

Best Answer

Hi,

Try Refer the following blog to get the proper way to add new field to existing views.

https://www.cybrosys.com/blog/adding-custom-fields-to-existing-views-in-odoo-v12

Regards

Avatar
Discard
Author

Hi,
I followed the same steps in this article, but I still have the same problem.

Best Answer

Hi,

See this example of adding new field to sale order model.

Video: https://www.youtube.com/watch?v=z1Tx7EGkPy0


In python side, inherit the model and add the field:

# -*- coding: utf-8 -*-
from odoo import api, fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
sale_description = fields.Char(string='Sale Description')


Then in the xml: https://github.com/odoomates/odooapps/blob/14.0/om_hospital/views/sale.xml#:~:text=%3Crecord id%3D%22view_order_form_inherit,%3C/record%3E




Also make sure that you have restarted the odoo service before installing the module.


Thanks

Avatar
Discard