Odoo Help


OpenERP Cron with field increment?

Assim Al-Marhuby
on 10/6/13, 4:55 PM 1,924 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



IBS Group

--IBS Group--
| 4 6 8
Tetouan, Morocco
--IBS Group--

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 Group
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 Group
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 Group
on 10/6/13, 5:50 PM

The relevant functions are browse() and write()

IBS Group
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

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


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