[IMP] base : Add a button to trigger the related method of a cron

This commit is contained in:
Yannick Tivisse
2015-08-21 10:25:29 +02:00
parent 72796355a5
commit bfdb20b45d
2 changed files with 11 additions and 0 deletions
+8
View File
@@ -82,6 +82,14 @@ class ir_cron(osv.osv):
(_check_args, 'Invalid arguments', ['args']),
]
def method_direct_trigger(self, cr, uid, ids, context=None):
if context is None:
context={}
cron_obj = self.browse(cr, uid, ids, context=context)
for cron in cron_obj:
self._callback(cr, uid, cron_obj.model, cron_obj.function, cron_obj.args, cron_obj.id)
return True
def _handle_callback_exception(self, cr, uid, model_name, method_name, args, job_id, job_exception):
""" Method called when an exception is raised by a job.
+3
View File
@@ -6,6 +6,9 @@
<field name="model">ir.cron</field>
<field name="arch" type="xml">
<form string="Scheduled Actions">
<header>
<button name="method_direct_trigger" type="object" string="Run Manually" class="oe_highlight"/>
</header>
<sheet>
<group col="4">
<field name="name"/>