'How to import fields with readonly attr in Odoo14?

I would like to import fields with readonly attr from web, specifically field and values from 'mail.tracking.value' model.

I have tried to change fields by inheriting, but it haven't worked as spected:

from datetime import datetime

from odoo import api, fields, models


class MailTracking(models.Model):
    _inherit = 'mail.tracking.value'

    field = fields.Many2one(readonly=False)
    field_desc = fields.Char('Field Description', required=True, readonly=False)
    field_type = fields.Char('Field Type', readonly=False)

    old_value_integer = fields.Integer('Old Value Integer', readonly=False)
    old_value_float = fields.Float('Old Value Float', readonly=False)
    old_value_monetary = fields.Float('Old Value Monetary', readonly=False)
    ...

Anyone has a solution to this problem?



Solution 1:[1]

probably you can try add this force_save="1"attribute on xml field, it used to force save when field is readonly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 A. Maulana Afifi