Odoo change field attribute through extension

In Odoo there is a file addons/website_quote/models/sale_order.py which has a class SaleOrder. It has a field

website_description = fields.Html('Description', sanitize_attributes=False, translate=html_translate)

I would like this field to become not translatable, since every time the user saves a record he (the user) gets message "Update translations". Which annoyed the user.

website_description = fields.Html('Description', sanitize_attributes=False, translate=False)

To achieve this I would create another class that inherits SaleOrder and has this line

website_description = fields.Html('Description', sanitize_attributes=False, translate=False)

Is this right way to change field's attribute?

Upvotes: 2

Views: 931

Answers (1)

CZoellner
CZoellner

Reputation: 14801

You don't need to recreate all field attributes again with the new API:

from odoo import models, fields


class SaleOrder(models.Model):
    _inherit = "sale.order"

    website_description = fields.Html(translate=False)

That should be enough.

Upvotes: 2

Related Questions