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

How to set or update fields.function value of existing data ?

By
Jeudy Nicolas
on 4/5/13, 12:09 PM 9,419 views

Hello,

I just add a fields.function(_myfunc, .... , store=True) on one OpenERP V7 model. This instance allready has some value in database.

How can I force openERP to compute the value for this field ? New data are ok (set when write method is launch) but for existing one nothing ...!

Note:

If a change store=True with store=False, my data are ok, but I need to add this field on search filters.

thanks for your help,

2

I recently came across this kind of problem (needed to update computed values) and I created a module to add 2 methods to the ORM (compute and compute_all).

You can find it here if you want, and if you ever get a chance to test if on Odoo 8+, let me know (I'm using OpenERP 7.0)

https://github.com/H-Max/odoo-orm-recompute

Hope this helps.

Thanks Henri! It works for v8 in my case!

BISSTECH SRL
on 10/30/15, 10:01 AM
1
Antonio Antiun
On 6/2/15, 6:24 PM

You could remove the column from database, for example, for field 'margin' at sale.order model you could execute next SQL with psql:

your_database=> alter table sale_order drop column if exists margin;

Then update the addon in Configuration > Local modules

If you look at Odoo log file you will see one line like:

openerp.models: Storing computed values of sale.order fields margin

0

Ray Carnes

--Ray Carnes--
15677
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 4/5/13, 9:42 PM

Export the model records, then import them.

This will trigger the write and the values for the functional field will be computed and stored.

If I trigger a write method all my value will be updated ?

Tuxservices, Jeudy Nicolas
on 4/6/13, 5:42 AM

Hy, is this the only way to do this? Isn't it possible to generate a write trigger during installation process?

Mind & Go, Mind And Go
on 6/11/13, 7:05 PM

The best answer I found is here : http://forum.openerp.com/forum/topic30196.html

Mind & Go, Mind And Go
on 6/11/13, 7:46 PM

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

2 follower(s)

Stats

Asked: 4/5/13, 12:09 PM
Seen: 9419 times
Last updated: 6/2/15, 6:24 PM