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 enable scheduler in openerp 7?

By
arsalan
on 4/15/14, 4:37 AM 1,611 views

I have been working to enable scheduler to call a particular function which will send alerts to the users of current forms. I am enabling this feature through settings->Technical->Scheduler->Scheduled Actions , but still my function is not called . I tried this to another simple function but no success. I am not sure where I am doing wrong. Please help me to fix this.

Regards

5

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3577
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 4/15/14, 5:14 AM

Hi you can create a function in your py file and call the function in _data.xml which will run your scheduler.

Example:

Import the following in your py file:

import logging
from datetime import datetime
 _logger = logging.getLogger(__name__)

Create a function

def test_scheduler(self,cr,uid,ids=None,context=None):
    _logger.info("Scheduler Testing"+str(datetime.today()))
    return True

Create a yourmodule_data.xml file

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">
        <record id="ir_cron_scheduler" model="ir.cron">
            <field name="name">Test Scheduler</field>
            <field name="interval_number">2</field>
            <field name="interval_type">minutes</field>
            <field name="numbercall">-1</field>
            <field eval="False" name="doall"/>
            <field eval="'yourmodelname'" name="model"/>
            <field eval="'test_scheduler'" name="function"/>
            <field eval="'()'" name="args"/>
        </record>
    </data>
</openerp>

Dont forget to import the xml file in __openerp__.py

Thanks

is this mandatory to use _logger = logging.getLogger(__name__) because I will no longer be using it

arsalan
on 4/15/14, 5:39 AM

No. For this example i want the output to be printed on console log. So i imported tht. It depends on your need.

Dhinesh - Technical Consultant, Sodexis Inc
on 4/15/14, 6:06 AM

no its still not working . have u tried it at your application ? because I m not getting anything on console

arsalan
on 4/15/14, 6:15 AM

Ya its working fine with me. Did u get the scheduler name in web client?? U can verify that by Settings->Technical->Scheduler->Scheduled Actions, where u can find the scheduler name which was given in xml file.

Dhinesh - Technical Consultant, Sodexis Inc
on 4/15/14, 7:35 AM

yes it worked . thanks I was making a big mistake

arsalan
on 4/15/14, 8:08 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)

Stats

Asked: 4/15/14, 4:37 AM
Seen: 1611 times
Last updated: 3/16/15, 8:10 AM