Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6975 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
maj 21
3945
3
sty 17
15045
1
kwi 21
8269
1
maj 18
1165
5
cze 20
6510