Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I have many crons that call the same method at different time and the method needs to find that which cron called it to find other record based on that cron.
Python Method that call by cron:
#id is needed to find global channel in which this cron is set.
global_channel = self.global_channel_id.search([('cron_id','=',id)])
for rule in global_channel.email_rule_ids:
<record id="ir_cron_send_customer_feedback_email_job" model="ir.cron">
<field name="name">Send Feedback Email to customer</field>
<field eval="False" name="active"/>
<field name="user_id" ref="base.user_root"/>
<field eval="False" name="doall"/>
<field eval="ref('customer_review_global_channel_ept.model_email_global_channel_rule_ept')" name="model_id" />
You could set a context value available to the method send_feedback_email_cron like:
And check against that context value inside the method like:
if self.env.context.get('from_cron1', False):
# do your stuff
About This Community
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/21/18, 2:21 AM|
|Seen: 413 times|
|Last updated: 6/21/18, 5:41 AM|