Hi, I have Odoo 12.0-20200916 (Community Edition) running in Windows 10.
I created a custom model at Odoo12\server\odoo\addons\sale_management\models\my_sale_order.py
to add a new field to the form. Now I want to do something when record is save so i try to override the write method.
Below is my code for my_sale_order.py
from odoo import models, fields, api
class SaleOrder(models.Model):
_inherit = 'sale.order'
additional_note = fields.Char(string='Additional Note')
@api.multi
def write(self, values):
res = super(SaleOrder, self).write(values)
# do something
return res
When i upgrade the Sales module it returns below error,
Odoo Server Error
Traceback (most recent call last): File "D:\MyData\Odoo\Odoo12\server\odoo\models.py", line 1128, in _validate_fields check(self) File "d:\mydata\odoo\odoo12\server\odoo\addons\base\models\ir_ui_view.py", line 351, in _check_xml self.postprocess_and_fields(view.model, view_doc, view.id) File "d:\mydata\odoo\odoo12\server\odoo\addons\base\models\ir_ui_view.py", line 1098, in postprocess_and_fields self.raise_view_error(_('Model not found: %(model)s') % dict(model=model), view_id) File "d:\mydata\odoo\odoo12\server\odoo\addons\base\models\ir_ui_view.py", line 568, in raise_view_error raise ValueError(message) ValueError: Model not found: sale.order.template
hope these customization tips will help you: https://sites.google.com/view/thinkincode/erp/odoo