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.

1

Display value, but no need to store in database [Closed]

By
patrick
on 4/2/13, 8:20 AM 1,489 views

The Question has been closed

by
patrick
on 04/23/2013 12:50:57

In the process of modifying the interface of OE7, I run into the following issue:

I need to change sale.order.line, so that the price is readonly (and stored in the database afterwards).

When setting the option readonly=1 in the XML-file causes the field NOT to use the field when storing the entry (known feature/bug, see other questions on this forum). So I thought about creating a field on the screen, which is NOT in the database, and setting invisible=1 on the field from the screen. I also need to modify the related on_change method to fill the additional field.

My question is, how to I specify a field on a screen, when there is no corresponding database field? Or is this impossible?

1

Francesco OpenCode

--Francesco OpenCode--
3608
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 4/2/13, 8:32 AM

In this case you must function field with parameter store = False. This mean that the field will be calculate on fly every time you see it but it has not relative field in database.

You mean defining a field in the .py file, and use this additional field to show something as readonly?

patrick
on 4/2/13, 8:46 AM

If you set a field as readonly, when you use the on_change to set its value, openerp doesn't save it. I think that if you need to show only a value, you can use a function field with store = False.

Francesco OpenCode
on 4/2/13, 8:54 AM

I managed to get it working. Thank you.

patrick
on 4/23/13, 12:50 PM

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 4/2/13, 8:20 AM
Seen: 1489 times
Last updated: 3/16/15, 8:10 AM