Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
4251 Vizualizări

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.

Imagine profil
Abandonează
Cel mai bun răspuns

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.

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
sept. 21
5281
1
mar. 21
5767
3
mai 20
4367
4
feb. 25
2347
1
aug. 24
1979