콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
282 화면

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

아바타
취소
작성자

Thanks for your confirmation !


베스트 답변

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.

아바타
취소
관련 게시물 답글 화면 활동
2
10월 23
4352
0
6월 22
23
4
6월 25
4045
3
9월 24
1666
0
11월 23
1646