Skip to Content
Menu
This question has been flagged
3 Replies
3423 Views

Hello,

I have tried to realise an automated action which update the data every 2 minutes.  So i have used this simple example :

https://www.odoo.yenthevg.com/creating-automated-actions-in-odoo/

But when i execute the module, the value didn't change. Any help please ?

Thank you so much :)

Avatar
Discard
Best Answer

Hi Zak,

you can add a scheduled action like this, this may already defined in the link.

In the XML,

<record id="ir_cron_scheduler_demo_action" model="ir.cron">
<field name="name">SMS Reminder</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">2</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<field eval="'sale.order'" name="model"/>
<field eval="'rental_sms_reminder'" name="function"/>
</record>

Then in the Python,

class SendSMS(models.Model):
_inherit = 'sale.order'

@api.multi
def rental_sms_reminder(self):
#write Function body here

Settings -> Technical -> Automation -> Scheduled Action,  select the new scheduled action , here 'sms reminder' , open it in the form view, then click on Run Manually to check its working

Add a print in the function and make sure that the function get called. Thanks


Avatar
Discard
Author Best Answer

@Niyas can you send me a link for a small automated Action project, to run it and see how i should define my automated action. thanks 

Avatar
Discard

If you can mail me @ niyasraphyk@gmail.com , i can provide you some sample codes.

thanks

Author Best Answer

Thank you Niyas you helped me so much :) 


Avatar
Discard