pengyuthon

This commit is contained in:
李鹏宇
2024-11-04 09:08:55 +08:00
parent 2845d1449a
commit 980afe683d
8 changed files with 165 additions and 145 deletions
+1
View File
@@ -9,6 +9,7 @@
'security/ir.model.access.csv',
'views/inherit_hr_type_views.xml',
'views/inherit_hr_leave_allocation_views.xml',
'views/inherit_hr_leave_accrual_plan_views.xml',
'views/hr_leave_batch.xml',
],
'demo': [],
+1
View File
@@ -1,4 +1,5 @@
from . import inherit_hr_leave_allocation
from . import inherit_hr_leave_type
from . import inherit_hr_leave
from . import inherit_hr_leave_accrual_plan
+14 -17
View File
@@ -4,9 +4,9 @@ from odoo.exceptions import ValidationError
class HrLeave(models.Model):
_inherit = 'hr.leave'
_inherit = 'hr.leave'
batch_id = fields.Many2one(string='批量', comodel_name='hr.leave.batch', required=True, ondelete='cascade')
batch_id = fields.Many2one(string='批量', comodel_name='hr.leave.batch', required=True, ondelete='cascade')
class HolidaysRequestBatch(models.Model):
@@ -21,18 +21,14 @@ class HolidaysRequestBatch(models.Model):
return emp
name = fields.Char(string='标题')
employee_id = fields.Many2one(string='员工', comodel_name='hr.employee', required=True, default=_get_default_emp, index=True)
employee_id = fields.Many2one(string='员工', comodel_name='hr.employee', required=True, default=_get_default_emp,
index=True)
leave_ids = fields.One2many(string='详情', comodel_name='hr.leave', inverse_name='batch_id')
state = fields.Selection(string='状态', selection=[
('draft', '撤回'),
('confirm', '转交'),
('refuse', '拒绝'),
('validate', '审批')
], default='draft', tracking=True, copy=False)
company_page = fields.Selection([('tz', '天河投资'), ('wg', '天河物管'), ('lc', '天河粮储')], string="公司")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
leave_id = fields.Many2one('res.users', string="请假人")
department_id = fields.Many2one('hr.department', string="部门")
state = fields.Selection(string='状态', selection=[('draft', '撤回'), ('confirm', '转交'),
('refuse', '拒绝'), ('validate', '审批')
], default='draft', tracking=True, copy=False)
leave_id = fields.Many2one('res.users', string="请假人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='leave_id.employee_id.department_id', string="部门")
days = fields.Float(string='天数')
hours = fields.Float(string='小时')
text = fields.Html(string='申请事由')
@@ -65,14 +61,15 @@ class HolidaysRequestBatch(models.Model):
self.state = 'draft'
self.leave_ids.action_draft()
class HrLeaveLine(models.Model):
_name = 'hr.leave.line'
leave_batch_id = fields.Many2one('hr.leave.batch', string="关联请假审批")
leave_type_id = fields.Many2one('hr.leave.type',string="请假类型")
available_days = fields.Integer(related='leave_type_id.available_days',string="可用天数")
applicants = fields.Selection(related='leave_type_id.request_unit',string="申请单位")
leave_documents_ids = fields.Many2many(related='leave_type_id.leave_documents_id',string="假期详情说明")
leave_type_id = fields.Many2one('hr.leave.type', string="请假类型")
available_days = fields.Integer(related='leave_type_id.available_days', string="可用天数")
applicants = fields.Selection(related='leave_type_id.request_unit', string="申请单位")
leave_documents_ids = fields.Many2many(related='leave_type_id.leave_documents_id', string="假期详情说明")
start_time = fields.Date(string="开始时间")
end_time = fields.Date(string="结束时间")
days = fields.Float(string="天数")
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class HrLeaveAccrualPlan(models.Model):
_inherit = 'hr.leave.accrual.plan'
documents_id = fields.Many2many('ir.attachment', string="假期详细说明")
+121 -122
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!-- Tree View -->
<record id="view_hr_leave_batch_tree" model="ir.ui.view">
<data>
<!-- Tree View -->
<record id="view_hr_leave_batch_tree" model="ir.ui.view">
<field name="name">hr.leave.batch.tree</field>
<field name="model">hr.leave.batch</field>
<field name="arch" type="xml">
@@ -10,150 +10,149 @@
<field name="employee_id" column_invisible="1"/>
<field name="name"/>
<field name="state" column_invisible="1"/>
<field name="company_page"/>
<field name="leave_id"/>
<field name="days"/>
<field name="hours"/>
<!-- <field name="holiday_status_id" string="Leave Type" column_invisible="1"/>-->
<field name="leave_id"/>
<!-- <field name="days"/>-->
<!-- <field name="hours"/>-->
<!-- <field name="holiday_status_id" string="Leave Type" column_invisible="1"/>-->
<!-- <field name="leave_ids"/> -->
<button name="action_validate" type="object" class="oe_highlight" string="Validate" invisible="1"/>
<button name="action_refuse" type="object" class="oe_highlight" string="Refuse" invisible="1"/>
<button name="action_draft" type="object" class="oe_highlight" string="Retract" invisible="1"/>
<button name="action_validate" type="object" class="oe_highlight" string="Validate" invisible="1"/>
<button name="action_refuse" type="object" class="oe_highlight" string="Refuse" invisible="1"/>
<button name="action_draft" type="object" class="oe_highlight" string="Retract" invisible="1"/>
</tree>
</field>
</record>
<!-- Form View -->
<record id="view_hr_leave_batch_form" model="ir.ui.view">
<!-- Form View -->
<record id="view_hr_leave_batch_form" model="ir.ui.view">
<field name="name">hr.leave.batch.form</field>
<field name="model">hr.leave.batch</field>
<field name="arch" type="xml">
<form>
<header>
<field name="state" widget="statusbar" invisible="1"/>
<button name="action_submit" type="object" class="oe_highlight" string="Submit" invisible="1"/>
<button name="action_validate" type="object" class="oe_highlight" string="Validate" invisible="1"/>
<button name="action_refuse" type="object" class="oe_highlight" string="Refuse" invisible="1"/>
<button name="action_draft" type="object" class="oe_highlight" string="Retract" invisible="1"/>
<field name="state" widget="statusbar" invisible="1"/>
<button name="action_submit" type="object" class="oe_highlight" string="Submit" invisible="1"/>
<button name="action_validate" type="object" class="oe_highlight" string="Validate"
invisible="1"/>
<button name="action_refuse" type="object" class="oe_highlight" string="Refuse" invisible="1"/>
<button name="action_draft" type="object" class="oe_highlight" string="Retract" invisible="1"/>
</header>
<sheet>
<!-- <group>-->
<!-- <field name="employee_id" readonly="1" forcesave="1"/>-->
<!-- <field name="name"/>-->
<!-- </group>-->
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name"/>
</h1>
</div>
<group>
<!-- <group>-->
<!-- <field name="employee_id" readonly="1" forcesave="1"/>-->
<!-- <field name="name"/>-->
<!-- </group>-->
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name"/>
</h1>
</div>
<group>
<field name="company_page"/>
<field name="leave_id"/>
<field name="text"/>
<group>
<field name="leave_id"/>
<field name="text"/>
</group>
<group>
<field name="department_id"/>
</group>
<group>
<!-- <field name="days"/>-->
<!-- <field name="hours"/>-->
<field name="is_issues" invisible="1"/>
</group>
</group>
<group>
<field name="department_id"/>
<field name="users_id"/>
</group>
<group>
<field name="days"/>
<field name="hours"/>
<field name="is_issues" invisible="1"/>
</group>
</group>
<notebook>
<notebook>
<page string="详情" invisible="1">
<field name="leave_ids" mode="tree" context="{'form_view_ref': 'hr_holidays.hr_leave_view_form_dashboard_new_time_off'}">
<tree>
<field name="state" column_invisible="True"/>
<field name="holiday_type"/>
<!-- <field name="holiday_status_id" class="fw-bold" readonly="state in ['cancel', 'refuse', 'validate', 'validate1']"/>-->
<field name="name"/>
<field name="date_from" readonly="state in ['cancel', 'refuse', 'validate', 'validate1']"/>
<field name="date_to" readonly="state in ['cancel', 'refuse', 'validate', 'validate1']"/>
<field name="duration_display"/>
</tree>
</field>
</page>
<page string="请假详情">
<field name="leave_line_ids">
<tree editable="bottom">
<field name="leave_batch_id" column_invisible="1"/>
<field name="leave_type_id"/>
<field name="available_days"/>
<field name="applicants"/>
<field name="start_time"/>
<field name="end_time"/>
<field name="days"/>
<field name="residual"/>
<field name="leave_documents_ids" widget="preview_many2many"/>
</tree>
</field>
</page>
<field name="leave_ids" mode="tree"
context="{'form_view_ref': 'hr_holidays.hr_leave_view_form_dashboard_new_time_off'}">
<tree>
<field name="state" column_invisible="True"/>
<field name="holiday_type"/>
<!-- <field name="holiday_status_id" class="fw-bold" readonly="state in ['cancel', 'refuse', 'validate', 'validate1']"/>-->
<field name="name"/>
<field name="date_from"
readonly="state in ['cancel', 'refuse', 'validate', 'validate1']"/>
<field name="date_to"
readonly="state in ['cancel', 'refuse', 'validate', 'validate1']"/>
<field name="duration_display"/>
</tree>
</field>
</page>
<page string="请假详情">
<field name="leave_line_ids">
<tree editable="bottom">
<field name="leave_batch_id" column_invisible="1"/>
<field name="leave_type_id"/>
<field name="available_days"/>
<field name="applicants"/>
<field name="start_time"/>
<field name="end_time"/>
<field name="days" sum="Total"/>
<field name="residual"/>
<field name="leave_documents_ids" widget="preview_many2many"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<!-- <div class="oe_chatter">-->
<!-- <field name="message_follower_ids" options="{'open_attachments': True}"/>-->
<!-- <field name="message_ids"/>-->
<!-- </div>-->
</form>
</field>
</record>
<!-- Search View -->
<record id="hr_leave_batch_search_view" model="ir.ui.view">
<field name="model">hr.leave.batch</field>
<field name="arch" type="xml">
<search string="Time Off Batches Search">
<field name="name" string="Batch" filter_domain="['|',('name', 'ilike', self), ('employee_id', 'ilike', self)"/>
<filter string="To Submit" name="filter_by_draft" domain="[('state', '=', 'draft')]"/>
<filter string="To Approve" name="filter_by_confirm" domain="[('state', '=', 'confirm')]"/>
<filter string="Refused" name="filter_by_refuse" domain="[('state', '=', 'refuse')]"/>
<filter string="Approved" name="filter_by_validate" domain="[('state', '=', 'validate')]"/>
<group expand="0" string="Group By">
<filter string="Employee" name="group_by_employee_id" domain="[]" context="{'group_by': 'employee_id'}"/>
<filter string="State" name="group_by_state" domain="[]" context="{'group_by': 'state'}"/>
</group>
</search>
</field>
</record>
<!-- Search View -->
<record id="hr_leave_batch_search_view" model="ir.ui.view">
<field name="model">hr.leave.batch</field>
<field name="arch" type="xml">
<search string="Time Off Batches Search">
<field name="name" string="Batch"
filter_domain="['|',('name', 'ilike', self), ('employee_id', 'ilike', self)"/>
<filter string="To Submit" name="filter_by_draft" domain="[('state', '=', 'draft')]"/>
<filter string="To Approve" name="filter_by_confirm" domain="[('state', '=', 'confirm')]"/>
<filter string="Refused" name="filter_by_refuse" domain="[('state', '=', 'refuse')]"/>
<filter string="Approved" name="filter_by_validate" domain="[('state', '=', 'validate')]"/>
<group expand="0" string="Group By">
<filter string="Employee" name="group_by_employee_id" domain="[]"
context="{'group_by': 'employee_id'}"/>
<filter string="State" name="group_by_state" domain="[]" context="{'group_by': 'state'}"/>
</group>
</search>
</field>
</record>
<!-- Action My Time Off -->
<record id="hr_leave_batch_action_my" model="ir.actions.act_window">
<field name="name">我的休假</field>
<field name="res_model">hr.leave.batch</field>
<field name="view_mode">tree,form</field>
<field name="context">{}</field>
<field name="search_view_id" ref="hr_leave_batch_search_view"/>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
</record>
<!-- Action My Time Off -->
<record id="hr_leave_batch_action_my" model="ir.actions.act_window">
<field name="name">我的休假</field>
<field name="res_model">hr.leave.batch</field>
<field name="view_mode">tree,form</field>
<field name="context">{}</field>
<field name="search_view_id" ref="hr_leave_batch_search_view"/>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
</record>
<menuitem
id="hr_holidays.hr_leave_menu_my"
parent="hr_holidays.menu_hr_holidays_my_leaves"
action="hr_leave_batch_action_my"
sequence="2"
/>
<menuitem
id="hr_holidays.hr_leave_menu_my"
parent="hr_holidays.menu_hr_holidays_my_leaves"
action="hr_leave_batch_action_my"
sequence="2"
/>
<!-- Action My Time Off -->
<record id="hr_leave_batch_action_all" model="ir.actions.act_window">
<field name="name">所有休息时间</field>
<field name="res_model">hr.leave.batch</field>
<field name="view_mode">tree,form</field>
<field name="context">{}</field>
<field name="search_view_id" ref="hr_leave_batch_search_view"/>
<field name="domain">[]</field>
</record>
<!-- Action My Time Off -->
<record id="hr_leave_batch_action_all" model="ir.actions.act_window">
<field name="name">所有休息时间</field>
<field name="res_model">hr.leave.batch</field>
<field name="view_mode">tree,form</field>
<field name="context">{}</field>
<field name="search_view_id" ref="hr_leave_batch_search_view"/>
<field name="domain">[]</field>
</record>
<menuitem
id="hr_holidays.menu_open_department_leave_approve"
parent="hr_holidays.menu_hr_holidays_management"
action="hr_leave_batch_action_all"
sequence="1"
/>
<menuitem
id="hr_holidays.menu_open_department_leave_approve"
parent="hr_holidays.menu_hr_holidays_management"
action="hr_leave_batch_action_all"
sequence="1"
/>
</data>
</data>
</odoo>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="inherit_hr_leave_accrual_plan_form" model="ir.ui.view">
<field name="name">inherit.hr.leave.accrual.plan.form</field>
<field name="model">hr.leave.accrual.plan</field>
<field name="inherit_id" ref="hr_holidays.hr_accrual_plan_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='is_based_on_worked_time']" position="after">
<field name="documents_id" widget="preview_many2many"/>
</xpath>
</field>
</record>
</odoo>
@@ -13,16 +13,17 @@ class PropertyRentalForm(models.Model):
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('property_rental_form_code'))
class PropertyRentalFormLine(models.Model):
_name = 'property.rental.form.line'
_description = '出租申报表明细行'
property_rental_form_id = fields.Many2one('property.rental.form', string="关联出租申报表")
property_id = fields.Many2one('yuthon.property',string='物业名称',required=True)
property_address = fields.Text(related='property_id.address',string='物业地址')
registered_use = fields.Char(related='property_id.registered_use',string='证载用途')
evaluation_area = fields.Float(related='property_id.evaluation_area',string='出租面积(m²)')
current_status = fields.Date(related='property_id.current_status',string='租聘到期日')
property_id = fields.Many2one('yuthon.property', string='物业名称', required=True)
property_address = fields.Text(related='property_id.address', string='物业地址')
registered_use = fields.Char(related='property_id.registered_use', string='证载用途')
evaluation_area = fields.Float(related='property_id.evaluation_area', string='出租面积(m²)')
current_status = fields.Date(related='property_id.current_status', string='租聘到期日')
owner_id = fields.Many2one(related='property_id.owner_id',string='原租户')
now_rent_price = fields.Float(related='property_id.rental_unit_price',string='现租价(元/m² •月)')
evaluate_rent_price = fields.Float(string='评估租(元/m² •月)')
+1 -1
View File
@@ -400,7 +400,7 @@
action="hr_holidays.open_view_holiday_status"
sequence="1"/>
<menuitem id="holiday_set_scheme_board"
name="应计方案"
name="年假配置"
parent="holiday_set_menu_board"
action="hr_holidays.open_view_accrual_plans"
sequence="3"/>