Merge pull request !4289 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-08-04 10:20:35 +00:00
committed by Gitee
5 changed files with 76 additions and 24 deletions
@@ -10,11 +10,14 @@ class YuthonVacationReports(models.Model):
_rec_name = "employee_id"
employee_id = fields.Many2one('hr.employee', string='员工')
department_id = fields.Many2one(related='employee_id.department_id', string="部门")
company_id = fields.Many2one(related="employee_id.company_id", string="公司")
leave_ids = fields.One2many('vacation.leave.line', 'vacation_id', string='年假明细')
overtime_ids = fields.One2many('vacation.over.line', 'vacation_id', string='加班明细')
meal_fee_ids = fields.One2many('vacation.meal.line', 'vacation_id', string='误餐明细')
medical_fee_ids = fields.One2many('vacation.medical.line', 'vacation_id', string='体检费明细')
other_fee_ids = fields.One2many('vacation.other.line', 'vacation_id', string='其他明细')
vacation_date = fields.Date(string='日期', default=lambda self: fields.Date.today())
leave = fields.Char(string='年假', compute='_compute_leave', store=True)
working_overtime = fields.Char(string='加班时', compute='_compute_working_overtime', store=True)
@@ -35,22 +38,6 @@ class YuthonVacationReports(models.Model):
record.medical_fee = max(total, 0.0)
def action_open_my_form(self):
employee = self.env.user.employee_id
vacation_report = self.env['yuthon.vacation.reports'].search(
[('employee_id', '=', employee.id)], limit=1)
return {
'name': '我的假期额度',
'type': 'ir.actions.act_window',
'res_model': 'yuthon.vacation.reports',
'view_mode': 'form',
'res_id': vacation_report.id,
'view_id': self.env.ref('yuthon_holiday.view_yuthon_vacation_reports_form1').id,
'context': {
'default_employee_id': employee.id,
},
}
def overtime_allocation(self):
form_id = self.env.ref('hr_holidays.hr_leave_allocation_view_form_manager').id
holiday_status_id = self.env['hr.leave.type'].search([('name', '=', '补休')])
@@ -426,7 +413,19 @@ class VacationMedicalLine(models.Model):
return record
class VacationOtherLine(models.Model):
_name = 'vacation.other.line'
_description = '其他'
vacation_id = fields.Many2one('yuthon.vacation.reports', string='关联假期额度记录')
holiday_type = fields.Many2one('hr.leave.type', string="假期类型")
employee_id = fields.Many2one('hr.employee', string='员工')
workflow_record_id = fields.Many2one('soong.workflow.record', string='流程')
update_date = fields.Date(string='更新时间')
update_type = fields.Selection([('add', '增加'), ('reduce', '减少')], string='更新类型')
is_void = fields.Boolean(string='是否作废', default=False)
lines = fields.Float(string='天数')
text = fields.Text(string='备注')
class DetailsTree(models.Model):
_name = 'details.tree'
@@ -12,3 +12,4 @@ access_vacation_meal_line,vacation_meal_line,model_vacation_meal_line,base.group
access_vacation_over_line,vacation_over_line,model_vacation_over_line,base.group_user,1,1,1,1
access_details_tree, details_tree,model_details_tree,base.group_user,1,1,1,1
access_vacation_medical_line,vacation_medical_line,model_vacation_medical_line,base.group_user,1,1,1,1
access_vacation_other_line,vacation_other_line,model_vacation_other_line,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
12 access_vacation_over_line vacation_over_line model_vacation_over_line base.group_user 1 1 1 1
13 access_details_tree details_tree model_details_tree base.group_user 1 1 1 1
14 access_vacation_medical_line vacation_medical_line model_vacation_medical_line base.group_user 1 1 1 1
15 access_vacation_other_line vacation_other_line model_vacation_other_line base.group_user 1 1 1 1
@@ -15,6 +15,21 @@
</tree>
</field>
</record>
<record id="view_yuthon_vacation_my_reports_tree" model="ir.ui.view">
<field name="name">yuthon.vacation.my.reports.tree</field>
<field name="model">yuthon.vacation.reports</field>
<field name="arch" type="xml">
<tree string="我的假期额度日志" editable="bottom" edit="0">
<field name="employee_id" options="{'no_create': True}"/>
<field name="department_id"/>
<field name="leave"/>
<field name="working_overtime"/>
<field name="meal_fee"/>
<field name="vacation_date"/>
<field name="company_id" optional="hide"/>
</tree>
</field>
</record>
<record id="view_yuthon_vacation_reports_form" model="ir.ui.view">
<field name="name">yuthon.vacation.reports.form</field>
<field name="model">yuthon.vacation.reports</field>
@@ -110,6 +125,22 @@
</tree>
</field>
</page>
<page string="其他">
<field name="other_fee_ids" context="{'default_employee_id': employee_id}">
<tree editable="bottom" delete="false" decoration-muted="is_void">
<field name="employee_id" column_invisible="1"/>
<field name="vacation_id" column_invisible="1"/>
<field name="workflow_record_id" domain="[('workflow_id.name', '=', '请假'), ('create_uid.employee_id', '=', employee_id)]"/>
<field name="holiday_type"/>
<field name="update_type" readonly="1"/>
<field name="update_date" readonly="1"/>
<field name="lines"/>
<field name="is_void"/>
<field name="text"/>
<button name="unlink" string="删除" invisible="workflow_record_id" type="object" class="btn-primary" groups="yuthon_holiday.group_yuthon_holiday_admin"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
@@ -208,6 +239,21 @@
</tree>
</field>
</page>
<page string="其他">
<field name="other_fee_ids" context="{'default_employee_id': employee_id}">
<tree editable="bottom" delete="false" decoration-muted="is_void" edit="false" create="false">
<field name="employee_id" column_invisible="1"/>
<field name="vacation_id" column_invisible="1"/>
<field name="workflow_record_id" domain="[('workflow_id.name', '=', '请假'), ('create_uid.employee_id', '=', employee_id)]"/>
<field name="holiday_type"/>
<field name="update_type" readonly="1"/>
<field name="update_date" readonly="1"/>
<field name="lines"/>
<field name="is_void"/>
<field name="text"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
@@ -221,13 +267,14 @@
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_form')})]"/>
</record>
<record id="action_server_open_my_vacation_form" model="ir.actions.server">
<record id="action_server_open_my_vacation_form1" model="ir.actions.act_window">
<field name="name">我的假期额度表单</field>
<field name="model_id" ref="model_yuthon_vacation_reports"/>
<field name="state">code</field>
<field name="code">
action = model.action_open_my_form()
</field>
<field name="res_model">yuthon.vacation.reports</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_my_reports_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('yuthon_holiday.view_yuthon_vacation_reports_form1')})]"/>
</record>
<record id="all_update_employee" model="ir.actions.server">
<field name="name">更新报表</field>
@@ -1,6 +1,7 @@
from odoo import models, fields, api, _, SUPERUSER_ID
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from odoo.exceptions import UserError, ValidationError
class PropertyReconciliationWizard(models.Model):
@@ -114,12 +115,16 @@ class PropertyReconciliationWizard(models.Model):
rec.bank_id.bank_state = 'reconciled'
rec.bank_id.yes_amount = rec.amount_been_reconciled
rec.bank_id.no_amount = rec.amount_reconciled
# 假设取第一条匹配的记录
first_line = bank_lines[0]
for line in rec.reconciliation_line_ids:
# 跳过金额为0的行
if line.amount == 0 and line.collection_type != 'penalty':
continue
if line.amount != line.rent:
if not line.remake:
raise UserError(_(
"错误:物业 '%s' 的对账明细行金额与租金不符,备注信息为必填项,请填写备注后再试。"
) % line.property_id.name)
first_day = line.due_date.replace(day=1)
last_day = (first_day + relativedelta(months=1)) - relativedelta(days=1)
domain = [
+1 -1
View File
@@ -630,7 +630,7 @@
<menuitem id="yuthon_vacation_reports_my"
name="我的假期额度"
parent="holiday_manage_menu_root_board"
action="yuthon_holiday.action_server_open_my_vacation_form"
action="yuthon_holiday.action_server_open_my_vacation_form1"
sequence="7"/>
<menuitem id="menu_hr_attendance_month_my_detail"
name="考勤确认"