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.
Hi you can create a function in your py file and call the function in _data.xml which will run your scheduler.
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
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
|Asked: 4/15/14, 4:37 AM|
|Seen: 1611 times|
|Last updated: 3/16/15, 8:10 AM|