Files
gzth/yuthon_hr_attendance/wizard/yuthon_duty_summary_wizard.py
T
2024-11-23 18:24:19 +08:00

36 lines
1.4 KiB
Python

from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, tools, _
from datetime import date, timedelta, datetime
class YuthonDutySummaryWizard(models.TransientModel):
_name = 'yuthon.duty.summary.wizard'
_description = '值班汇总计算'
select_the_month = fields.Selection([('one', '一月'), ('two', '二月'), ('three', '三月'),
('four', '四月'), ('five', '五月'), ('six', '六月'),
('seven', '七月'), ('eight', '八月'), ('nine', '九月'), ('ten', '十月'),
('eleven', '十一月'), ('twelve', '十二月')], string='选择月份', default=lambda self: self._get_current_month())
@api.model
def _get_current_month(self):
current_month = datetime.now().month
month_mapping = {
1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five',
6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten',
11: 'eleven', 12: 'twelve'
}
return month_mapping.get(current_month, 'one')
@api.model
def action_duty_summary_wizard(self):
return {
'type': 'ir.actions.act_window',
'name': '值班总汇计算',
'res_model': self._name,
'view_mode': 'form',
'target': 'new',
}
def confirm(self):
pass