Skip to Content
Menu
This question has been flagged
2 Replies
4079 Views

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
Discard
Best Answer

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
1
Sep 21
5115
1
Mar 21
5625
3
May 20
4210
4
Feb 25
2033
1
Aug 24
1864