Odoo Help


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.


on_change function in a Treeview

on 2/6/13, 10:18 PM 1,887 views

I have a function on_change in a Treeview (editable="bottom"):


Product Name | Qty.(onchange) | Unit Cost(onchange) | Total (readonly)

Product1 | 3.00 | 512.00 | 1536.00

*The problem is when i try to save after on_change, the field [Total] which is a readonly gets cleared/disappear. Just found out that when you set it to readonly=False the value of [Total] remains.

*Is there any method to lock the field rather than setting it to readonly=True? *Or it's still a bug from OpenERP 6.1?

You can inherit create and write methods to save the value on Total

Juanjo Algaz
on 3/20/13, 7:40 AM

Nicolas Bessi

--Nicolas Bessi--
| 5 7 8
Lausanne, Switzerland
--Nicolas Bessi--
Nicolas Bessi
On 2/7/13, 3:14 AM

As far as I know readonly fields are not sent to server. You may set an invisible field with the correct value and a related field to display readonly value.

On 2/7/13, 3:34 AM

Thanks nbessi, now I know somehow its a bug from 6.1

I also want to know using related field how to use in same table ? Example: fields.related(?, 'total', type='float', relation='current.table', string='Total', store=True),

on 1/4/14, 7:35 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

0 follower(s)


Asked: 2/6/13, 10:18 PM
Seen: 1887 times
Last updated: 3/16/15, 8:10 AM