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

OpenERP Cron with field increment?

By
Assim Al-Marhuby
on 10/6/13, 4:55 PM 1,226 views

How can I create a cron job that is executed every end of the year, and all it does is increment a field by 1. That's all

Thanks.

0

IBS

--IBS--
1302
| 4 5 8
Tétouan, Morocco
--IBS--

For more informations about IBS, please visit our website at www.ibs-na.com.

For a specific questions, collaboration or help, please send us an email to support@ibs-na.com

IBS
On 10/6/13, 5:36 PM

You can do this by creating a scheduler, go to Settings > Technical > Scheduler > Scheduled Actions

Check the existing scheduled actions to get an idea how it works.

To increment either do it by code with a read/increment/write operation, or use a sequence.

I did that, but how do I do the increment? Could you please give me an example code that shows you getting a value from a column and incrementing it.

Assim Al-Marhuby
on 10/6/13, 5:43 PM

Get the value, increment it with python and then save it again.

IBS
on 10/6/13, 5:48 PM

You can find the functions to read and write in this page https://doc.openerp.com/v6.1/developer/03_modules_2/

IBS
on 10/6/13, 5:50 PM

The relevant functions are browse() and write()

IBS
on 10/6/13, 5:51 PM

A good example is the currency_rate_update module, which runs the "run_currency_update" function once a day. Download that module and look at the code. You'll have to 1. write a python module 2. install your module 3. create a new Scheduled Action referencing your new module and the Increment function (method) you want to run. You should be 90% of the way there by referencing the currency_rate_update module (I think you really only need to reference the class Currency_rate_update, you can probably ignore the rest)

Michael Watchorn
on 11/12/13, 1:45 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

0 follower(s)

Stats

Asked: 10/6/13, 4:55 PM
Seen: 1226 times
Last updated: 3/16/15, 8:10 AM