Files
gzth/yuthon_base/models/ir_cron_act.py
T
2025-11-15 19:50:52 +08:00

27 lines
796 B
Python

from odoo import fields, models, api
class InheritCronAct(models.Model):
_inherit = 'ir.cron'
_description = '定时任务'
is_corn_customer = fields.Boolean(string='是否用户', default=False)
cron_type_id = fields.Many2one('ir.cron.type', string='类型')
def update_cron(self):
cron_ids = self.env["ir.cron"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for cron in cron_ids:
cron_type_id = self.env['ir.cron.type'].search([('name', '=', '出勤')], limit=1)
if cron_type_id:
cron.write({'cron_type_id': cron_type_id.id})
class InheritCronType(models.Model):
_name = 'ir.cron.type'
_description = '定时任务类型'
name = fields.Char(string='名称')