添加功能
This commit is contained in:
@@ -15,6 +15,13 @@ class SalaryImportWizard(models.TransientModel):
|
||||
file = fields.Binary(string='File', required=True)
|
||||
excel_file = fields.Binary(string="上传Excel表")
|
||||
excel_name = fields.Char(string="文件名")
|
||||
select_month = fields.Selection([('1', '一月'), ('2', '二月'), ('3', '三月'), ('4', '四月'),
|
||||
('5', '五月'), ('6', '六月'), ('7', '七月'), ('8', '八月'),
|
||||
('9', '九月'), ('10', '十月'), ('11', '十一月'),
|
||||
('12', '十二月')], string='选择月份',
|
||||
default=lambda self: str(datetime.now().month))
|
||||
select_year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2060)], string='选择年份',
|
||||
default=lambda self: str(datetime.now().year))
|
||||
|
||||
def confirm(self):
|
||||
if not self.excel_file:
|
||||
@@ -51,7 +58,7 @@ class SalaryImportWizard(models.TransientModel):
|
||||
employee_name = row[0].value
|
||||
employee = self.env['hr.employee'].search([('name', '=', employee_name)], limit=1)
|
||||
if employee:
|
||||
payslip_run_name = f"{2025}年-八月"
|
||||
payslip_run_name = f"{self.select_year}年-{self.select_month}月"
|
||||
payslip_run_id = self.env['hr.payslip.run'].search(
|
||||
[('name', '=', payslip_run_name), ('company_id', '=', employee.company_id.id)], limit=1)
|
||||
payslip = self.env['hr.payslip'].search([
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
</header>
|
||||
<group>
|
||||
<group>
|
||||
<field name="select_year" required="1"/>
|
||||
<field name="select_month" required="1"/>
|
||||
<field name="excel_file" filename="excel_name"/>
|
||||
<field name="excel_name" invisible="1"/>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user