添加功能

This commit is contained in:
李鹏宇
2025-10-17 18:50:37 +08:00
parent 98782ee2ba
commit 2b4fac6780
5 changed files with 54 additions and 33 deletions
@@ -179,7 +179,7 @@ class HrLeaveAllocation(models.Model):
def update_vacation(self):
leave_ids = self.env["hr.leave.allocation"].browse(
self._context.get('active_ids', self._context.get('active_id')))
date = datetime(2025, 9, 1) # 修改为你的日期
date = datetime(2025, 10, 1) # 修改为你的日期
for leave in leave_ids:
leave_list = []
compensatory_list = []
@@ -16,18 +16,14 @@ class YuthonShiftApproval(models.Model):
transferees_id = fields.Many2one('resource.resource', string="调班对象", domain="[('id', 'in', resource_ids)]")
alternate_id = fields.Many2one('resource.resource', string="替班对象", domain="[('id', 'in', resource_ids)]")
alternate_shifts = fields.Selection([('transferees', '调班'), ('alternate', '替班')], string="调替班" , default='transferees')
shift_start = fields.Datetime(string="开始日期")
shift_end = fields.Datetime(string="结束日期")
shift_id = fields.Many2one('planning.slot', string="申请人1")
shift_two_start = fields.Datetime(string="开始时间")
shift_two_end = fields.Datetime(string="结束时间")
shift_two_id = fields.Many2one('planning.slot', string="申请人2")
return_start = fields.Datetime(string="开始时间")
return_end = fields.Datetime(string="结束时间")
return_id = fields.Many2one('planning.slot', string="调班人1")
return_two_start = fields.Datetime(string="开始时间")
return_two_end = fields.Datetime(string="结束时间")
return_two_id = fields.Many2one('planning.slot', string="调班人2")
shift_date = fields.Date(string="日期")
shift_id = fields.Many2one('planning.slot', string="我的班次1")
shift_two_date = fields.Date(string="日期")
shift_two_id = fields.Many2one('planning.slot', string="我的班次2")
return_date = fields.Date(string="日期")
return_id = fields.Many2one('planning.slot', string="对方班次")
return_two_date = fields.Date(string="日期")
return_two_id = fields.Many2one('planning.slot', string="对方班次2")
department_id = fields.Many2one('hr.department', string="部门", related='resource_id.employee_id.department_id')
resource_ids = fields.Many2many('resource.resource', string="资源用户列表")
is_issues = fields.Boolean(string='是否上会')
@@ -64,45 +64,66 @@
<field name="transferees_id" invisible="alternate_shifts != 'transferees'"/>
<field name="department_id" invisible="1"/>
</group>
<group col="3" string="班次1">
<group col="4" string="班次1">
<group>
<field name="shift_start"/>
<field name="return_start"/>
<field name="shift_date"/>
<field name="return_date"/>
</group>
<group>
<field name="shift_end"/>
<field name="return_end"/>
</group>
<group>
<field name="shift_id" domain="[('resource_id', '=', resource_id), ('start_datetime', '&gt;', shift_start), ('end_datetime', '&lt;', shift_end)]" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
<field name="shift_id" domain="[
('resource_id', '=', resource_id),
('start_datetime', '&gt;', shift_date + ' 00:00:00'),
('end_datetime', '&lt;', shift_date + ' 23:59:59')
]"
context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
'order': 'start_datetime desc',
'search_default_group_by_month': True,}"/>
<field name="return_id" domain="[('resource_id', '=', transferees_id), ('start_datetime', '&gt;', shift_start), ('end_datetime', '&lt;', shift_end)]" invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
<field name="return_id" invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
'order': 'start_datetime desc',
'search_default_group_by_month': True,}"/>
'search_default_group_by_month': True,}"
domain="[
('resource_id', '=', resource_id),
('start_datetime', '&gt;', return_date + ' 00:00:00'),
('end_datetime', '&lt;', return_date + ' 23:59:59')
]"
/>
</group>
<group/>
<group/>
</group>
<group string="班次2" col="3">
<group string="班次2" col="4">
<group>
<field name="shift_two_start"/>
<field name="return_two_start"/>
<field name="shift_two_date"/>
<field name="return_two_date"/>
</group>
<group>
<field name="shift_two_end"/>
<field name="return_two_end"/>
</group>
<group>
<field name="shift_two_id" domain="[('resource_id', '=', resource_id), ('start_datetime', '&gt;', shift_start), ('end_datetime', '&lt;', shift_end)]" invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
<field name="shift_two_id"
domain="[
('resource_id', '=', resource_id),
('start_datetime', '&gt;', shift_two_date + ' 00:00:00'),
('end_datetime', '&lt;', shift_two_date + ' 23:59:59')
]"
invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
'order': 'start_datetime desc',
'search_default_group_by_month': True,}"/>
<field name="return_two_id" domain="[('resource_id', '=', transferees_id), ('start_datetime', '&gt;', shift_start), ('end_datetime', '&lt;', shift_end)]" invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
<field name="return_two_id" invisible="alternate_shifts != 'transferees'" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
'order': 'start_datetime desc',
'search_default_group_by_month': True,}"/>
'search_default_group_by_month': True,}"
domain="[
('resource_id', '=', resource_id),
('start_datetime', '&gt;', return_two_date + ' 00:00:00'),
('end_datetime', '&lt;', return_two_date + ' 23:59:59')
]"
/>
</group>
<group/>
<group/>
</group>
</sheet>
</form>
@@ -527,6 +527,7 @@ class PropertyAccountsReceivable(models.Model):
# company_id1 = fields.Many2one(related='contract_id.admin_id.company_id', string="管理员公司", store=True)
company_id2 = fields.Many2one("res.company", string="公司", compute='_compute_company_id2', store=True)
contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
contract_sort = fields.Selection(related='contract_id.contract_sort', string="资产类型", store=True)
admin_id = fields.Many2one(related='contract_id.admin_id', string="片区管理员", store=True)
tenure_type = fields.Selection(related='contract_id.tenure_type', string="权属类型", store=True)
precinct_id = fields.Many2one(related='contract_id.precinct_id', string="所属片区", store=True)
@@ -844,6 +845,7 @@ class PropertyRentList(models.Model):
contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
tenure_type = fields.Selection(related='contract_id.tenure_type', string="权属类型", store=True)
property_address = fields.Text(string="物业信息", compute='get_property_address')
contract_sort = fields.Selection(related='contract_id.contract_sort', string="资产类型", store=True)
company_id = fields.Many2one(related='contract_id.lessor_id', string="出租方公司", store=True)
@api.depends('contract_id')
@@ -83,6 +83,7 @@
<field name="tenure_type"/>
<field name="contract_id"/>
<group expand="0" string="group_by">
<filter name="contract_sort" string="资产类型" context="{'group_by':'contract_sort'}"/>
<filter name="group_company_id" string="公司" context="{'group_by':'company_id'}"/>
<filter name="group_tenure_type" string="权属类型" context="{'group_by':'tenure_type'}"/>
<filter name="group_admin_id" string="管理员" context="{'group_by':'admin_id'}"/>
@@ -388,6 +389,7 @@
<filter name="group_property_ids" string="物业" context="{'group_by':'property_ids'}"/>
<filter name="group_lessee_id" string="承租方" context="{'group_by':'lessee_id'}"/>
<filter name='group_by_contract_id' string="合同" context="{'group_by':'contract_id'}"/>
<filter name="contract_sort" string="资产类型" context="{'group_by':'contract_sort'}"/>
<filter name="group_management_type_id" string="应收类型" context="{'group_by':'management_type_id'}"/>
</group>
<header_search>