添加功能

This commit is contained in:
zhou
2025-08-05 10:06:37 +08:00
parent 0bf3e67b1f
commit 1882db9bed
8 changed files with 31 additions and 24 deletions
@@ -72,15 +72,15 @@ class HrContract(models.Model):
}
}
def pub_retired_employee(self):
def pub_leaving_employee(self):
record_id = self.env["hr.contract"].browse(self._context.get('active_ids', self._context.get('active_id')))
if len(record_id) != 1:
raise UserError("请选择一个合同")
form_id = self.env.ref('yuthon_hr_employee_approval.view_retired_approval_form').id
form_id = self.env.ref('yuthon_hr_employee_approval.view_yuthon_leaving_approval_form').id
return {
"type": "ir.actions.act_window",
"name": "退休申请",
"res_model": "yuthon.retired.approval",
"name": "离职申请",
"res_model": "yuthon.leaving.approval",
"views": [[form_id, "form"]],
"context": {
'default_employee_id': self.employee_id.id,
@@ -8,7 +8,7 @@
<xpath expr="//tree" position="inside">
<header>
<button name="renew" string="续签" type="object" class="btn btn-primary"/>
<button name="pub_retired_employee" string="退休" type="object" class="btn btn-primary"/>
<button name="pub_leaving_employee" string="离职" type="object" class="btn btn-primary"/>
</header>
</xpath>
<xpath expr="//field[@name='date_end']" position="after">
@@ -116,10 +116,10 @@ class Planning(models.Model):
for slot in self:
planning_name = slot.template_id.planning_name if slot.template_id and slot.template_id.planning_name else ""
new_start_datetime = slot.start_datetime + timedelta(hours=8)
start_time_str = new_start_datetime.strftime("%Y-%m-%d %H:%M:%S")
new_end_datetime = slot.end_datetime + timedelta(hours=8)
end_time_str = new_end_datetime.strftime("%H:%M:%S")
slot.display_name = f"{planning_name + '/' + start_time_str + '/' + end_time_str}"
start_time_str = new_start_datetime.strftime("%Y-%m-%d")
# new_end_datetime = slot.end_datetime + timedelta(hours=8)
# end_time_str = new_end_datetime.strftime("%H:%M:%S")
slot.display_name = f"{planning_name + '/' + start_time_str}"
@api.depends('template_id.color')
def _compute_color(self):
@@ -121,7 +121,7 @@ class YuthonShiftContext(models.Model):
_description = 'Shift Context'
_order = 'start_datetime desc'
start_datetime = fields.Datetime(string='Start Datetime')
end_datetime = fields.Datetime(string='End Datetime')
start_datetime = fields.Datetime(string='开始日期')
end_datetime = fields.Datetime(string='结束日期')
planning_name = fields.Char(string='Planning Name')
@@ -67,15 +67,23 @@
<group col="2">
<group>
<field name="shift_id" domain="[('resource_id', '=', resource_id)]" context="{'tree_view_ref': 'yuthon_hr_attendance.view_yuthon_shift_context',
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context'}"/>
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
'order': 'start_datetime asc',
'search_default_group_by_month': True,}"/>
<field name="return_id" domain="[('resource_id', '=', transferees_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'}"/>
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
'order': 'start_datetime asc',
'search_default_group_by_month': True,}"/>
</group>
<group>
<field name="shift_two_id" domain="[('resource_id', '=', resource_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'}"/>
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
'order': 'start_datetime asc',
'search_default_group_by_month': True,}"/>
<field name="return_two_id" domain="[('resource_id', '=', transferees_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'}"/>
'search_view_ref': 'yuthon_hr_attendance.search_yuthon_shift_context',
'order': 'start_datetime asc',
'search_default_group_by_month': True,}"/>
</group>
</group>
</sheet>
@@ -119,7 +119,6 @@ class PropertyLeaseContract(models.Model):
breach = fields.Integer(string="违约计算时点", default=1)
is_split = fields.Boolean(string="是否合同拆分")
split_context = fields.Char(string="拆分内容", default="该合同已拆分")
def _get_percentage_liquidated_damages(self):
default_rate = self.env['yuthon.penalty.setting'].search(
@@ -1193,6 +1192,7 @@ class PropertyLeaseContract(models.Model):
raise UserError("只能选择一个拆分")
record.is_contract = True
record.is_child_contract = False
record.is_split = True
record.number += 1
contract_id = self.env['property.lease.contract'].create({
'name': record.name,
@@ -1210,7 +1210,7 @@ class PropertyLeaseContract(models.Model):
'lessor_id':record.lessor_id.id,
'rental_purposes': record.rental_purposes.id,
'address_for_delivery': record.address_for_delivery,
'lease_term': record.lease_term,
# 'lease_term': record.lease_term,
'lease_term_year': record.lease_term_year,
'lease_term_month': record.lease_term_month,
'term_end_time': record.term_end_time,
@@ -41,9 +41,7 @@
<field name="code" string="流水号:"/>
</group>
<group>
<field name="is_split" invisible="1"/>
<field name="number" invisible="1"/>
<field name="split_context" invisible="not is_split" readonly="1"/>
</group>
</group>
<div class="col-12 text-center">
@@ -67,6 +65,7 @@
</group>
<group>
<group>
<field name="is_split" string="拆分"/>
<field name="work_end" invisible="1"/>
<field name="rent_company" string="出租方" readonly="0"/>
<field name="lessor_id" invisible="1"/>
@@ -79,7 +78,7 @@
<field name="title_address"/>
<field name="handling_opinions"/>
<field name="tenure_type" invisible="1"/>
<field name="is_child_contract" string="已拆分"/>
<field name="is_child_contract" invisible="1"/>
<field name="is_contract" invisible="1"/>
<field name="contract_source_id" invisible="not is_child_contract"/>
<field name="condition" readonly="1" invisible="1"/>
@@ -426,9 +425,7 @@
<field name="code" readonly="1" string="流水号:"/>
</group>
<group>
<field name="is_split" invisible="1"/>
<field name="number" invisible="1"/>
<field name="split_context" invisible="not is_split" readonly="1"/>
</group>
</group>
<div class="col-12 text-center">
@@ -452,6 +449,7 @@
</group>
<group>
<group>
<field name="is_split" string="拆分"/>
<field name="rent_company" string="出租方" readonly="0"/>
<field name="company_id" invisible="1"/>
<field name="lessee_id" readonly="0"/>
@@ -460,7 +458,7 @@
<field name="department_id" invisible="1"/>
<field name="name" readonly="0"/>
<field name="use_address" readonly="0"/>
<field name="is_child_contract" string="已拆分"/>
<field name="is_child_contract" invisible="1"/>
<field name="is_contract" invisible="1"/>
<field name="contract_source_id" invisible="not is_child_contract"/>
<field name="contact_state" invisible="1"/>
@@ -118,7 +118,8 @@ class PropertyReconciliationWizard(models.Model):
first_line = bank_lines[0]
for line in rec.reconciliation_line_ids:
# 跳过金额为0的行
if line.amount == 0 and line.collection_type != 'penalty':
if (line.amount == 0 and line.collection_type != 'penalty') or \
(line.contract_id and line.contract_id.is_split):
continue
if line.amount != line.rent:
if not line.remake: