添加功能
This commit is contained in:
@@ -11,15 +11,16 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<menuitem id="financial_sheet_collection_report_menu"
|
<!-- <menuitem id="financial_sheet_collection_report_menu"-->
|
||||||
name="财务数据表报表"
|
<!-- name="财务数据表报表"-->
|
||||||
action="yuthon_account_report.financial_data_action"
|
<!-- -->
|
||||||
sequence="10"/>
|
<!-- action="yuthon_account_report.financial_data_action"-->
|
||||||
|
<!-- sequence="10"/>-->
|
||||||
|
|
||||||
<menuitem id="information_summary_table_report_menu"
|
<!-- <menuitem id="information_summary_table_report_menu"-->
|
||||||
name="信息汇总报表"
|
<!-- name="信息汇总报表"-->
|
||||||
action="yuthon_account_report.information_aggregation_action"
|
<!-- action="yuthon_account_report.information_aggregation_action"-->
|
||||||
sequence="10"/>
|
<!-- sequence="10"/>-->
|
||||||
|
|
||||||
<record id="financial_sheet_line_tree" model="ir.ui.view">
|
<record id="financial_sheet_line_tree" model="ir.ui.view">
|
||||||
<field name="name">financial.sheet.line.tree</field>
|
<field name="name">financial.sheet.line.tree</field>
|
||||||
|
|||||||
@@ -887,18 +887,25 @@ class AppletAttendance(Controller):
|
|||||||
|
|
||||||
first_day_str = first_day.strftime('%Y-%m-%d')
|
first_day_str = first_day.strftime('%Y-%m-%d')
|
||||||
last_day_str = last_day.strftime('%Y-%m-%d')
|
last_day_str = last_day.strftime('%Y-%m-%d')
|
||||||
|
two_months_ago = datetime.now().date() - relativedelta(months=2)
|
||||||
# 去掉 数据为 0 的数据.
|
# 去掉 数据为 0 的数据.
|
||||||
electric_records = request.env(user=SUPERUSER_ID)['meter.archives.line'].search([
|
electric_records = request.env(user=SUPERUSER_ID)['meter.archives.line'].search([
|
||||||
('archives_state', '!=', 'stop'),
|
('archives_state', '!=', 'stop'),
|
||||||
|
('is_virtual_meter', '!=', True),
|
||||||
('meter_date', '>=', first_day_str),
|
('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_records = request.env(user=SUPERUSER_ID)['meter.water.line'].search([
|
||||||
('water_state', '!=', 'stop'),
|
('water_state', '!=', 'stop'),
|
||||||
('meter_date', '>=', first_day_str),
|
('meter_date', '>=', first_day_str),
|
||||||
('meter_date', '<=', last_day_str)
|
('meter_date', '<=', last_day_str),
|
||||||
|
'|',
|
||||||
|
('end_time', '=', False),
|
||||||
|
('end_time', '<=', two_months_ago)
|
||||||
])
|
])
|
||||||
|
|
||||||
# 接口调整, 电表,水表数据拆分.
|
# 接口调整, 电表,水表数据拆分.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
from odoo import api, fields, models, tools, _
|
from odoo import api, fields, models, tools, _
|
||||||
from odoo.exceptions import ValidationError, UserError
|
from odoo.exceptions import ValidationError, UserError
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import datetime, timedelta, date
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -58,6 +59,12 @@ class YuthonNotice(models.Model):
|
|||||||
default=lambda self: [(6, 0, [self.env.user.id])]
|
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
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
for i in vals_list:
|
for i in vals_list:
|
||||||
|
|||||||
@@ -385,23 +385,23 @@ class InheritHrPayslip(models.Model):
|
|||||||
res = super(InheritHrPayslip, self).create(vals_list)
|
res = super(InheritHrPayslip, self).create(vals_list)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.model
|
# @api.model
|
||||||
def create(self, vals):
|
# def create(self, vals):
|
||||||
"""
|
# """
|
||||||
为了解决部分薪资生成未生效,单独处理计算公式
|
# 为了解决部分薪资生成未生效,单独处理计算公式
|
||||||
工会会费:round(abs(payslip.base_salary * 0.005) * -1, 2) --union_dues
|
# 工会会费:round(abs(payslip.base_salary * 0.005) * -1, 2) --union_dues
|
||||||
:param vals:
|
# :param vals:
|
||||||
:return:
|
# :return:
|
||||||
"""
|
# """
|
||||||
record = super().create(vals)
|
# record = super().create(vals)
|
||||||
employee_id = self.env['hr.employee'].search([('id', '=', vals['employee_id'])])
|
# 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
|
# 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)]):
|
# if payroll.rule_ids.search([('name', '=', '基本工资'), ('struct_id', '=', payroll.id)]):
|
||||||
base_salary = payroll.rule_ids.search([('name', '=', '基本工资'), ('struct_id', '=', payroll.id)])[-1].amount_fix
|
# base_salary = payroll.rule_ids.search([('name', '=', '基本工资'), ('struct_id', '=', payroll.id)])[-1].amount_fix
|
||||||
# if record.worked_days_line_ids.search([('name', '=', '工会会费')]):
|
# # if record.worked_days_line_ids.search([('name', '=', '工会会费')]):
|
||||||
# record.line_ids.search([('name', '=', '工会会费')]).total = round(abs(base_salary * 0.005) * -1, 2)
|
# # 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)})
|
# record.write({'union_dues': round(abs(base_salary * 0.005) * -1, 2)})
|
||||||
return record
|
# return record
|
||||||
|
|
||||||
@api.ondelete(at_uninstall=False)
|
@api.ondelete(at_uninstall=False)
|
||||||
def _unlink_if_draft_or_cancel(self):
|
def _unlink_if_draft_or_cancel(self):
|
||||||
|
|||||||
@@ -20,9 +20,55 @@ class SalaryImportWizard(models.TransientModel):
|
|||||||
raise ValidationError('请上传文件。')
|
raise ValidationError('请上传文件。')
|
||||||
book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file))
|
book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file))
|
||||||
sh = book.sheet_by_index(0)
|
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):
|
for rx in range(1, sh.nrows):
|
||||||
row = sh.row(rx)
|
row = sh.row(rx)
|
||||||
self.salary_party_data(row)
|
self.salary_party_data(row, excel_headers)
|
||||||
|
|
||||||
def salary_party_data(self, row):
|
def salary_party_data(self, row, excel_headers):
|
||||||
pass
|
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]
|
||||||
Reference in New Issue
Block a user