Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
4136 Vistas

So basically  only thing I did was to inherit a model and then add a new field like this:

# -*- coding: utf-8 -*-
from odoo import models, fields, api


class ProductProduct(models.Model):
    _inherit = 'product.product'

    new_test_field = fields.Float()


I restarted my server many times.

But for some reason I'm still getting an error:


Error to render compiling AST
UndefinedColumn: column product_product.new_test_field does not exist
LINE 1: ...product"."varaint_sequence" as "varaint_sequence","product_p...
                                                                                                                ^


I'm not even using this variable anywhere else. It is just that one line.

I have no idea what is wrong. I looks like some kind of bug in Odoo. I was declaring new fields like this many times before and now it does not work for some reason. WHY?

I even used the same code on different Odoo instance and it worked without any problems.

Working on Odoo13.

Edit: I cleared python cache and it seems to be working. But I still don't know why in this particular case it didn't work the usual way - just by restarting server.

Avatar
Descartar
Mejor respuesta

2 things:

  1. Make sure you name the field by including a string in it's definition like so.

    1. new_test_field = fields.Float('New Test Field')
  2. Add an import of your custom .py file in the __init__.py in the folder in which your custom .py resides so that Odoo recognizes it.

Avatar
Descartar
Mejor respuesta

Hi,

Can you try to upgrade the module from command line/terminal and see whether it will resolve the issue :

How To Upgrade Module From Terminal in Odoo


Thanks

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
sept 21
5165
1
mar 21
5673
3
may 20
4259
4
feb 25
2120
1
ago 24
1891