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

Using field without map to the database

By
Pedro Leite
on 2/16/16, 11:14 AM 445 views

Hi,

I need to define a field that is not mapped to the database. What I did was:

var1 = fields.Char()
var2 = fields.Char()
var3 = fields.Float(manual=True)

As expected, it was only the mapped field var1 and var2. But my problem is the use of the var3 in my view. I need it only for temporary use, to store a value to address the submission form.


<tree editable="bottom" create="false">
    <field name="var1" readonly="1"/>
    <field name="var2" readonly="1"/>
    <field name="var3"/>
</tree>
I want the user to set the variable with a value, and submission treat this value and remove the variable var3 not to store in the database.

But the problem is that, ODOO try something like "select var1, var2, var3 from table", and var3 is not mapped in the database.

What I need is a tree, similar to the following:

var1
var2
var3
regA
descriptionA
10
regB
descriptionB
10

Anyone has a solution for my problem, or a best approach to this?

1

Axel Mendoza

--Axel Mendoza--
10203
| 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/16/16, 5:58 PM

Use a computed field or a function field, that are fields not stored in the database and you could assign the value using onchange, defaults or calculate the value. Read more here:

https://www.odoo.com/documentation/9.0/reference/orm.html

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/16/16, 11:14 AM
Seen: 445 times
Last updated: 2/17/16, 11:08 AM