Skip to Content
मेन्यू
This question has been flagged
1 Reply
291 Views

Hello,

I have a question regarding custom fields in Odoo:

  1. I initially created some custom fields using Odoo Studio, and these fields already contain data.
  2. A developer advised me that it’s better to create a custom module for new fields, so that the environment is consistent across all my Odoo instances.
  3. I don’t want to delete the Studio-created fields since they already hold values. Instead, I have recreated the same fields in a custom module.



Is there a risk of conflict when deploying the custom module, given that the fields already exist in the database from Studio? 


Additionally, when deploying the fields through the module, I am seeing this warning:

WARNING server Field sale.order.line.x_custom_field: unknown parameter 'tracking', if this is an actual parameter you may want to override the method _valid_field_parameter on the relevant model in order to allow it

  • What does this warning mean, and how should I resolve it when moving fields from Studio to a custom module?


Any guidance or best practices for safely migrating Studio fields to a custom module would be greatly appreciated!


Thank you

Avatar
Discard
Author

Thanks for your confirmation !


Best Answer

Hi,


Moving a Studio Char field (x_custom_field) from Studio → custom module


Python Code:

from odoo import models, fields


class SaleOrderLine(models.Model):

    _inherit = "sale.order.line"


    # This redeclares the Studio field

    x_custom_field = fields.Char(

        string="Custom Field",

        tracking=True

    )



If your model doesn’t use chatter (no mail.thread):


Remove tracking=True to avoid the warning:


Python Code:

from odoo import models, fields


class SaleOrderLine(models.Model):

    _inherit = "sale.order.line"


    x_custom_field = fields.Char(string="Custom Field")


As long as the field name (x_custom_field) and type (Char, Many2one, etc.) match what Studio made, Odoo will reuse the same DB column and your data is safe.


Hope it helps.

Avatar
Discard
Related Posts Replies Views Activity
2
अक्तू॰ 23
4355
0
जून 22
23
4
जून 25
4047
3
सित॰ 24
1666
0
नव॰ 23
1647