Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Why when I create one field in sale.py it is not created in Postgresql database?

By
beriliox
on 2/29/16, 8:12 AM 306 views

I have a problem because when I create a field in sale.order.line model. This field does not appear in the database Postgresql when I make a query in sale_order_line.

This is the statement I created field in the model sale.order.line :

niu = fields.Char(string="NIU", compute="_niu_validation", default=" ", readonly=True)

Please if anyone could help me , I'll be very grateful. Thank you for your time and dedication.

1

Axel Mendoza

--Axel Mendoza--
10205
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 2/29/16, 8:18 AM

Hi @beriliox

That's is a computed field that it's not stored in the database, if you wanna store the result of the computation you need to add the argument store=True to the field definition, like:

niu = fields.Char(string="NIU", compute="_niu_validation", default=" ", readonly=True, store=True)

Thanks, but now Odoo shows me the following error: ProgrammingError: column "niu" of relation "sale_order_line" does not exist LINE 1: ...roduct_id", "product_packaging", "qty_delivered", "niu", "cr...

beriliox
on 2/29/16, 8:31 AM

You need to restart the Odoo server and update your module for Odoo convert the computed field into an store one

Axel Mendoza
on 2/29/16, 8:34 AM

Thanks. I do it ;)

beriliox
on 2/29/16, 8:59 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/29/16, 8:12 AM
Seen: 306 times
Last updated: 2/29/16, 8:22 AM