26 lines
960 B
Python
26 lines
960 B
Python
from odoo import api, fields, models, tools, _
|
|
from datetime import datetime, time, timedelta
|
|
from odoo.exceptions import UserError
|
|
|
|
|
|
class YuthonAbnormalSetting(models.Model):
|
|
_name = 'yuthon.abnormal.setting'
|
|
_description = '值班补卡配置'
|
|
|
|
monthly_clearing_time = fields.Datetime('每月清零时间', default=lambda self: fields.Datetime.now())
|
|
number = fields.Integer('每月补卡次数')
|
|
|
|
def button_is_enable(self):
|
|
for rec in self:
|
|
available_people = self.env['hr.employee'].search([('department_id.name', '=', '仓储组')])
|
|
for person in available_people:
|
|
person.write({'duty_replacement_card': rec.number})
|
|
return {
|
|
'type': 'ir.actions.client',
|
|
'tag': 'display_notification',
|
|
'params': {
|
|
'type': 'success',
|
|
'message': '已发布补卡次数',
|
|
'sticky': False,
|
|
}
|
|
} |