mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] runbot_merge: add cron trigger button
"Run manually" is a bit meh, as it runs the cron synchronously (so you have to wait for it, and hope it doesn't run for longer than the request timeout which may be smaller than the cron timeout) and it can run in a subtly different environment than normal, which can lead to different behaviour. Instead add a button to enqueue a cron trigger, now that they exist that's much closer to what we actually want, and it does run the cron in a normal / expected environment.
This commit is contained in:
parent
e19a9fad8f
commit
d8c2782d1f
@ -21,6 +21,7 @@
|
||||
'models/project_freeze/views.xml',
|
||||
'models/staging_cancel/views.xml',
|
||||
'models/backport/views.xml',
|
||||
'models/ir_cron/views.xml',
|
||||
],
|
||||
'assets': {
|
||||
'web._assets_primary_variables': [
|
||||
|
@ -1,7 +1,9 @@
|
||||
from . import mail_thread
|
||||
from . import ir_actions
|
||||
from . import ir_cron
|
||||
from . import ir_ui_view
|
||||
from . import mail_thread
|
||||
from . import res_partner
|
||||
|
||||
from . import project
|
||||
from . import pull_requests
|
||||
from . import batch
|
||||
|
10
runbot_merge/models/ir_cron/__init__.py
Normal file
10
runbot_merge/models/ir_cron/__init__.py
Normal file
@ -0,0 +1,10 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class IrCron(models.Model):
|
||||
_inherit = 'ir.cron'
|
||||
|
||||
def trigger(self):
|
||||
self.check_access_rights('write')
|
||||
self._trigger()
|
||||
return True
|
15
runbot_merge/models/ir_cron/views.xml
Normal file
15
runbot_merge/models/ir_cron/views.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<odoo>
|
||||
<record id="ir_cron_view_form" model="ir.ui.view">
|
||||
<field name="name">replace "run manually" by "trigger"</field>
|
||||
<field name="model">ir.cron</field>
|
||||
<field name="inherit_id" ref="base.ir_cron_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='method_direct_trigger']" position="after">
|
||||
<button name="trigger" type="object" string="Trigger" class="oe_highlight" invisible="state != 'code'"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='method_direct_trigger']" position="attributes">
|
||||
<attribute name="class"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user