diff --git a/yuthon_account_report/views/custom.xml b/yuthon_account_report/views/custom.xml
index 741ab03bd..629769444 100644
--- a/yuthon_account_report/views/custom.xml
+++ b/yuthon_account_report/views/custom.xml
@@ -11,15 +11,16 @@
-
+
+
+
+
+
-
+
+
+
+
financial.sheet.line.tree
diff --git a/yuthon_hr_attendance/controllers/applet_attendance.py b/yuthon_hr_attendance/controllers/applet_attendance.py
index da3103d48..59d835cdf 100644
--- a/yuthon_hr_attendance/controllers/applet_attendance.py
+++ b/yuthon_hr_attendance/controllers/applet_attendance.py
@@ -887,18 +887,25 @@ class AppletAttendance(Controller):
first_day_str = first_day.strftime('%Y-%m-%d')
last_day_str = last_day.strftime('%Y-%m-%d')
-
+ two_months_ago = datetime.now().date() - relativedelta(months=2)
# 去掉 数据为 0 的数据.
electric_records = request.env(user=SUPERUSER_ID)['meter.archives.line'].search([
('archives_state', '!=', 'stop'),
+ ('is_virtual_meter', '!=', True),
('meter_date', '>=', first_day_str),
- ('meter_date', '<=', last_day_str)
+ ('meter_date', '<=', last_day_str),
+ '|',
+ ('end_time', '=', False),
+ ('end_time', '<=', two_months_ago)
])
water_records = request.env(user=SUPERUSER_ID)['meter.water.line'].search([
('water_state', '!=', 'stop'),
('meter_date', '>=', first_day_str),
- ('meter_date', '<=', last_day_str)
+ ('meter_date', '<=', last_day_str),
+ '|',
+ ('end_time', '=', False),
+ ('end_time', '<=', two_months_ago)
])
# 接口调整, 电表,水表数据拆分.
diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py
index 5c8637673..896697530 100644
--- a/yuthon_notice/models/yuthon_notice.py
+++ b/yuthon_notice/models/yuthon_notice.py
@@ -2,6 +2,7 @@
from odoo import api, fields, models, tools, _
from odoo.exceptions import ValidationError, UserError
import logging
+from datetime import datetime, timedelta, date
_logger = logging.getLogger(__name__)
@@ -58,6 +59,12 @@ class YuthonNotice(models.Model):
default=lambda self: [(6, 0, [self.env.user.id])]
)
+ # @api.onchange('users_ids')
+ # def _onchange_users_ids(self):
+ # today = date.today()
+ # self.start_date = today
+ # self.create_date1 = today
+
@api.model_create_multi
def create(self, vals_list):
for i in vals_list:
diff --git a/yuthon_salary/models/inherit_hr_payslip.py b/yuthon_salary/models/inherit_hr_payslip.py
index 474afc099..2361a99c1 100644
--- a/yuthon_salary/models/inherit_hr_payslip.py
+++ b/yuthon_salary/models/inherit_hr_payslip.py
@@ -385,23 +385,23 @@ class InheritHrPayslip(models.Model):
res = super(InheritHrPayslip, self).create(vals_list)
return res
- @api.model
- def create(self, vals):
- """
- 为了解决部分薪资生成未生效,单独处理计算公式
- 工会会费:round(abs(payslip.base_salary * 0.005) * -1, 2) --union_dues
- :param vals:
- :return:
- """
- record = super().create(vals)
- employee_id = self.env['hr.employee'].search([('id', '=', vals['employee_id'])])
- payroll = self.env['hr.contract'].search([('employee_id', '=', employee_id.id), ('state', '=', 'open')])[-1].structure_type_id.default_struct_id
- if payroll.rule_ids.search([('name', '=', '基本工资'), ('struct_id', '=', payroll.id)]):
- base_salary = payroll.rule_ids.search([('name', '=', '基本工资'), ('struct_id', '=', payroll.id)])[-1].amount_fix
- # if record.worked_days_line_ids.search([('name', '=', '工会会费')]):
- # record.line_ids.search([('name', '=', '工会会费')]).total = round(abs(base_salary * 0.005) * -1, 2)
- record.write({'union_dues': round(abs(base_salary * 0.005) * -1, 2)})
- return record
+ # @api.model
+ # def create(self, vals):
+ # """
+ # 为了解决部分薪资生成未生效,单独处理计算公式
+ # 工会会费:round(abs(payslip.base_salary * 0.005) * -1, 2) --union_dues
+ # :param vals:
+ # :return:
+ # """
+ # record = super().create(vals)
+ # employee_id = self.env['hr.employee'].search([('id', '=', vals['employee_id'])])
+ # payroll = self.env['hr.contract'].search([('employee_id', '=', employee_id.id), ('state', '=', 'open')])[-1].structure_type_id.default_struct_id
+ # if payroll.rule_ids.search([('name', '=', '基本工资'), ('struct_id', '=', payroll.id)]):
+ # base_salary = payroll.rule_ids.search([('name', '=', '基本工资'), ('struct_id', '=', payroll.id)])[-1].amount_fix
+ # # if record.worked_days_line_ids.search([('name', '=', '工会会费')]):
+ # # record.line_ids.search([('name', '=', '工会会费')]).total = round(abs(base_salary * 0.005) * -1, 2)
+ # record.write({'union_dues': round(abs(base_salary * 0.005) * -1, 2)})
+ # return record
@api.ondelete(at_uninstall=False)
def _unlink_if_draft_or_cancel(self):
diff --git a/yuthon_salary/wizard/salary_import_wizard.py b/yuthon_salary/wizard/salary_import_wizard.py
index e70877064..3bc17bea4 100644
--- a/yuthon_salary/wizard/salary_import_wizard.py
+++ b/yuthon_salary/wizard/salary_import_wizard.py
@@ -20,9 +20,55 @@ class SalaryImportWizard(models.TransientModel):
raise ValidationError('请上传文件。')
book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file))
sh = book.sheet_by_index(0)
+ header_row = sh.row(0)
+ excel_headers = [str(cell.value).strip() for cell in header_row if cell.value]
+ invalid_headers = [header for header in excel_headers]
for rx in range(1, sh.nrows):
row = sh.row(rx)
- self.salary_party_data(row)
+ self.salary_party_data(row, excel_headers)
- def salary_party_data(self, row):
- pass
+ def salary_party_data(self, row, excel_headers):
+ 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_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([
+ ('payslip_run_id', '=', payslip_run_id.id),
+ ('employee_id', '=', employee.id),
+ ], limit=1)
+ if not payslip:
+ payslip_vals = {
+ 'name': employee.name,
+ 'employee_id': employee.id,
+ 'contract_id': employee.contract_id.id,
+ 'payslip_run_id': payslip_run_id.id,
+ 'date_from': datetime(2025, 8, 1).date() ,
+ 'date_to': datetime(2025, 8, 31).date(),
+ 'is_salary_push': True,
+ 'is_salary_release': False
+ }
+ payslip = self.env['hr.payslip'].create(payslip_vals)
+ payslip.compute_sheet()
+ else:
+ payslip.is_salary_push = True
+ payslip.is_salary_release = False
+
+ for line in payslip.line_ids:
+ line_name = line.name
+ if line_name not in excel_headers:
+ continue
+ header_idx = excel_headers.index(line_name) + 1
+ amount = row[header_idx].value
+ if amount == 0.0:
+ continue
+ line.write({
+ 'amount': amount,
+ 'total': amount,
+ })
+
+ def _get_chinese_month(self, month):
+ chinese_months = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月',
+ '十二月']
+ return chinese_months[month - 1]
\ No newline at end of file