From 38cbbf1e2bd2b241f98df67c334f2d5bd4f53e23 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Thu, 22 May 2025 14:56:16 +0800
Subject: [PATCH 01/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../models/soong_workflow_inspector.py | 2 +-
.../wizard/soong_workflow_comment_wizard.py | 33 +++++++++++++++----
.../soong_workflow_comment_wizard_view.xml | 3 +-
.../models/yuthon_fixes_approval.py | 2 +-
yuthon_hr_attendance/models/card_approval.py | 2 +-
.../models/remove_holiday_approval.py | 2 +-
.../models/yuthon_abnormal_approval.py | 2 +-
.../models/yuthon_adjustments_approval.py | 2 +-
.../models/yuthon_customer_approval.py | 2 +-
.../models/yuthon_shift_approval.py | 2 +-
.../models/yuthon_special_approval.py | 2 +-
.../models/yuthon_onboard_approval.py | 2 +-
.../models/yuthon_prepare_approval.py | 2 +-
.../models/yuthon_recruitment_approval.py | 2 +-
.../models/yuthon_transfer_approval.py | 2 +-
.../models/yuthon_employee_approval.py | 2 +-
.../models/yuthon_index_approval.py | 2 +-
.../models/yuthon_plan_approval.py | 2 +-
.../models/yuthon_tissue_duty_approval.py | 2 +-
.../models/perperty_claim_approval.py | 2 +-
.../models/property_borrowing_approval.py | 2 +-
.../models/property_construction_approval.py | 2 +-
.../models/property_eligibility.py | 2 +-
.../models/property_intention_approval.py | 2 +-
.../models/property_lease_extension.py | 2 +-
.../models/property_merge_approval.py | 2 +-
.../models/property_penalty_relief.py | 2 +-
.../models/property_rent_relief.py | 2 +-
.../models/property_rental_form.py | 2 +-
.../models/property_split_approval.py | 2 +-
.../models/property_transaction_confirmed.py | 2 +-
.../models/property_transfer_approval.py | 2 +-
.../models/yuthon_office_supplies.py | 2 +-
.../models/yuthon_business_approval.py | 2 +-
.../models/yuthon_care_condolences.py | 2 +-
.../models/yuthon_work_condolences.py | 2 +-
.../views/yuthon_business_approval_viwes.xml | 2 +-
.../views/yuthon_seals_approval_views.xml | 8 ++---
yuthon_will_task/models/yuthon_will_task.py | 2 +-
39 files changed, 68 insertions(+), 48 deletions(-)
diff --git a/soong_workflow/models/soong_workflow_inspector.py b/soong_workflow/models/soong_workflow_inspector.py
index d6a607b9d..31f60f08e 100644
--- a/soong_workflow/models/soong_workflow_inspector.py
+++ b/soong_workflow/models/soong_workflow_inspector.py
@@ -12,7 +12,7 @@ class SoongWorkflowInspector(models.Model):
name = fields.Char(string="标题")
start_data = fields.Date(string="督办日期")
end_data = fields.Date(string="完成日期")
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
user_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
department_id = fields.Many2one(related='user_id.department_id', string="部门")
code = fields.Char(string="督办编号", default=lambda self: self.env['ir.sequence'].next_by_code('inspector_code'))
diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py
index 9dd784b8d..ff17e6b54 100644
--- a/soong_workflow/wizard/soong_workflow_comment_wizard.py
+++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py
@@ -45,6 +45,25 @@ class SoongWorkflowCommentWizard(models.TransientModel):
string="督办人员", store=True)
is_automatic = fields.Boolean('是否自动匹配')
+ employee_ids1 = fields.Many2many(
+ 'hr.employee',
+ 'employee_ids1_rel',
+ 'custom_id1',
+ 'employee_id1',
+ string="转交人员",
+ store=True
+ )
+
+ @api.onchange('employee_ids')
+ def _onchange_employee_ids(self):
+ if len(self.employee_ids) == 1:
+ self.employee_ids1 = self.employee_ids
+
+ @api.constrains('employee_ids1')
+ def _check_employee_ids1(self):
+ if not self.employee_ids1:
+ raise ValidationError("必须有转交人员")
+
@api.depends('comment_note_id', 'comment_note')
def _compute_comment(self):
for record in self:
@@ -85,15 +104,15 @@ class SoongWorkflowCommentWizard(models.TransientModel):
if '转交' not in next_list:
raise UserError('配置错误,请配置当前{}的转交按钮'.format(btn.name))
else:
- if btn.is_automatic:
- employee_user_role_id = self.env['hr.employee'].search(
- [('user_role_id', '=', btn.users_role_id.id),
- ('department_id', '=', record_id.department_id.id)])
+ employee_user_role_id = self.env['hr.employee'].search(
+ [('user_role_id', '=', btn.users_role_id.id),
+ ('department_id', '=', record_id.department_id.id)])
+ if employee_user_role_id:
self.employee_ids = employee_user_role_id
else:
- employee_user_role_ids = self.env['hr.employee'].search(
- [('user_role_id', '=', btn.users_role_id.id)])
- self.employee_ids = employee_user_role_ids
+ raise UserError('下一个流程节点没有匹配的人员,请联系管理员配置')
+ if btn.is_automatic:
+ self.employee_ids1 = employee_user_role_id
@api.onchange('trans_link_id')
def onchange_trans_employee_ids(self):
diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml
index cf6e0e92b..2cf82bc7c 100644
--- a/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml
+++ b/soong_workflow/wizard/soong_workflow_comment_wizard_view.xml
@@ -48,7 +48,8 @@
-
+
+
当前流程是否结束,请确认
diff --git a/yuthon_holiday/models/yuthon_fixes_approval.py b/yuthon_holiday/models/yuthon_fixes_approval.py
index 86d5d5c1b..694fb15d0 100644
--- a/yuthon_holiday/models/yuthon_fixes_approval.py
+++ b/yuthon_holiday/models/yuthon_fixes_approval.py
@@ -20,7 +20,7 @@ class YuthonFixesApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason_application = fields.Html(string="申请事由")
+ reason_application = fields.Text(string="申请事由")
documents_ids = fields.Many2many('ir.attachment', string="附件")
leave_id = fields.Many2one('hr.leave.allocation')
active = fields.Boolean('Active', default=True, tracking=True)
diff --git a/yuthon_hr_attendance/models/card_approval.py b/yuthon_hr_attendance/models/card_approval.py
index 9cd257597..390a3b6cc 100644
--- a/yuthon_hr_attendance/models/card_approval.py
+++ b/yuthon_hr_attendance/models/card_approval.py
@@ -22,7 +22,7 @@ class CardApprovals(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason_application = fields.Html(string="申请事由")
+ reason_application = fields.Text(string="申请事由")
documents_ids = fields.Many2many('ir.attachment', string="附件")
attendance_id = fields.Many2one('hr.attendance', string="补卡日期")
attendance = fields.Char(string="补卡日期")
diff --git a/yuthon_hr_attendance/models/remove_holiday_approval.py b/yuthon_hr_attendance/models/remove_holiday_approval.py
index c8dec8da4..7174dbc65 100644
--- a/yuthon_hr_attendance/models/remove_holiday_approval.py
+++ b/yuthon_hr_attendance/models/remove_holiday_approval.py
@@ -18,7 +18,7 @@ class RemoveHolidayApprovals(models.Model):
statu = fields.Selection([('drft', '草稿'), ('going', '执行中'), ('cancel', '已取消'), ('done', '已完成')], string="状态",
default='drft')
role_id = fields.Many2one('yuthon.user.role', string="岗位")
- reason_application = fields.Html(string="申请事由")
+ reason_application = fields.Text(string="申请事由")
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
diff --git a/yuthon_hr_attendance/models/yuthon_abnormal_approval.py b/yuthon_hr_attendance/models/yuthon_abnormal_approval.py
index 8ef62a839..e53235d73 100644
--- a/yuthon_hr_attendance/models/yuthon_abnormal_approval.py
+++ b/yuthon_hr_attendance/models/yuthon_abnormal_approval.py
@@ -16,7 +16,7 @@ class YuthonAbnormalApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason_application = fields.Html(string="申请事由")
+ reason_application = fields.Text(string="申请事由")
documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
diff --git a/yuthon_hr_attendance/models/yuthon_adjustments_approval.py b/yuthon_hr_attendance/models/yuthon_adjustments_approval.py
index d5a93ed81..553a2fb85 100644
--- a/yuthon_hr_attendance/models/yuthon_adjustments_approval.py
+++ b/yuthon_hr_attendance/models/yuthon_adjustments_approval.py
@@ -16,7 +16,7 @@ class YuthonAdjustmentsApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason_application = fields.Html(string="申请事由")
+ reason_application = fields.Text(string="申请事由")
replacement_data = fields.Date(string="值班时间")
documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
diff --git a/yuthon_hr_attendance/models/yuthon_customer_approval.py b/yuthon_hr_attendance/models/yuthon_customer_approval.py
index f97094033..aa7935283 100644
--- a/yuthon_hr_attendance/models/yuthon_customer_approval.py
+++ b/yuthon_hr_attendance/models/yuthon_customer_approval.py
@@ -17,7 +17,7 @@ class YuthonCustomerApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason_application = fields.Html(string="申请事由")
+ reason_application = fields.Text(string="申请事由")
documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
diff --git a/yuthon_hr_attendance/models/yuthon_shift_approval.py b/yuthon_hr_attendance/models/yuthon_shift_approval.py
index dad9fdc49..7364c248f 100644
--- a/yuthon_hr_attendance/models/yuthon_shift_approval.py
+++ b/yuthon_hr_attendance/models/yuthon_shift_approval.py
@@ -25,7 +25,7 @@ class YuthonShiftApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason_application = fields.Html(string="申请事由")
+ reason_application = fields.Text(string="申请事由")
documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
diff --git a/yuthon_hr_attendance/models/yuthon_special_approval.py b/yuthon_hr_attendance/models/yuthon_special_approval.py
index c62eb1605..bde5691de 100644
--- a/yuthon_hr_attendance/models/yuthon_special_approval.py
+++ b/yuthon_hr_attendance/models/yuthon_special_approval.py
@@ -10,7 +10,7 @@ class YuthonSpecialApproval(models.Model):
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
name = fields.Char(string="标题", readonly=False, default=lambda self: self.env.user.employee_id.resource_id.name)
- reason_application = fields.Html(string="申请事由")
+ reason_application = fields.Text(string="申请事由")
company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.user.company_id.id)
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('special_approval'))
resource_id = fields.Many2one('resource.resource', string="发起人",
diff --git a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py
index d7b92af3e..ac7696cb8 100644
--- a/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_onboard_approval.py
@@ -27,7 +27,7 @@ class YuthonOnboardApproval(models.Model):
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
account = fields.Char(string='账号')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
work_end = fields.Boolean(string="结束")
employee_id = fields.Many2one('hr.employee', string="员工姓名")
bank = fields.Char(string='开户行')
diff --git a/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py b/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py
index 8cc655b77..eed44ba41 100644
--- a/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_prepare_approval.py
@@ -11,7 +11,7 @@ class YuthonPrepareApproval(models.Model):
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_prepare_approval_code'))
name = fields.Char(string='标题')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
diff --git a/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py b/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
index 70deba906..ad7132439 100644
--- a/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py
@@ -12,7 +12,7 @@ class YuthonRecruitmentApproval(models.Model):
name = fields.Char(string='标题')
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_recruitment_approval_code'))
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
recruitment_ids = fields.One2many('hr.job', 'recruitment_approval_id', string="招聘申请")
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
diff --git a/yuthon_hr_employee_approval/models/yuthon_transfer_approval.py b/yuthon_hr_employee_approval/models/yuthon_transfer_approval.py
index 4f67a758c..e758af965 100644
--- a/yuthon_hr_employee_approval/models/yuthon_transfer_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_transfer_approval.py
@@ -27,7 +27,7 @@ class YutransferApproval(models.Model):
notification_change_id = fields.Many2one("hr.employee", string="告知人员")
handover_reason = fields.Text(string="移交原因")
notice_documents_id = fields.Many2one('ir.attachment', string="附件")
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
diff --git a/yuthon_performance/models/yuthon_employee_approval.py b/yuthon_performance/models/yuthon_employee_approval.py
index a4916b278..c518fb5ac 100644
--- a/yuthon_performance/models/yuthon_employee_approval.py
+++ b/yuthon_performance/models/yuthon_employee_approval.py
@@ -13,7 +13,7 @@ class YuthonEmployeeApproval(models.Model):
dimension = fields.Char('评价维度', required=True)
creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now())
job_id = fields.Many2one('hr.job', string="岗位")
- reason_text = fields.Html(string='申请事由')
+ reason_text = fields.Text(string='申请事由')
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('library_changes_personal_code'))
change_employee_library_ids = fields.One2many("yuthon.index.employee",'change_employee_library_id',string="员工指标库库变更明细")
diff --git a/yuthon_performance/models/yuthon_index_approval.py b/yuthon_performance/models/yuthon_index_approval.py
index ae9a4706d..aad04c9c6 100644
--- a/yuthon_performance/models/yuthon_index_approval.py
+++ b/yuthon_performance/models/yuthon_index_approval.py
@@ -10,7 +10,7 @@ class YuthonIndexApproval(models.Model):
name = fields.Char('标题')
creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now())
job_id = fields.Many2one('hr.job', string="岗位")
- reason_text = fields.Html(string='申请事由')
+ reason_text = fields.Text(string='申请事由')
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('library_changes_organize_code'))
change_index_library_ids = fields.One2many("yuthon.index.management",'change_index_library_id',string="组织指标库变更明细")
diff --git a/yuthon_performance/models/yuthon_plan_approval.py b/yuthon_performance/models/yuthon_plan_approval.py
index ee6a76ac5..2713a9914 100644
--- a/yuthon_performance/models/yuthon_plan_approval.py
+++ b/yuthon_performance/models/yuthon_plan_approval.py
@@ -7,6 +7,6 @@ class YuthonPlanApproval(models.Model):
name = fields.Char('标题')
creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now())
job_id = fields.Many2one('hr.job', string="岗位")
- reason_text = fields.Html(string='申请事由')
+ reason_text = fields.Text(string='申请事由')
# change_plan_ids = fields.One2many("yuthon.plan.management.line",'change_plan_id',string="个人计划变更明细")
diff --git a/yuthon_performance/models/yuthon_tissue_duty_approval.py b/yuthon_performance/models/yuthon_tissue_duty_approval.py
index 0465313ad..f2389577a 100644
--- a/yuthon_performance/models/yuthon_tissue_duty_approval.py
+++ b/yuthon_performance/models/yuthon_tissue_duty_approval.py
@@ -13,7 +13,7 @@ class YuthonTissueDutyApproval(models.Model):
creation_time = fields.Datetime(string='申请日期', default=lambda self: fields.Datetime.now())
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('duty_approval_code'))
job_id = fields.Many2one('hr.job', string="岗位")
- reason_text = fields.Html(string='申请事由')
+ reason_text = fields.Text(string='申请事由')
# 指标变更
change_duty_kpi_ids = fields.One2many('yuthon.kpi.line', 'change_duty_kpi_id', string="原KPI明细")
diff --git a/yuthon_property_approval/models/perperty_claim_approval.py b/yuthon_property_approval/models/perperty_claim_approval.py
index 197334181..7dcef8d22 100644
--- a/yuthon_property_approval/models/perperty_claim_approval.py
+++ b/yuthon_property_approval/models/perperty_claim_approval.py
@@ -14,7 +14,7 @@ class PropertyClaimApproval(models.Model):
department_id = fields.Many2one('hr.department', string="部门")
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
- reason = fields.Html(string="事由")
+ reason = fields.Text(string="事由")
total_received = fields.Float(string='总额')
work_fee = fields.Float(string='办公费')
manage_fee = fields.Float(string='管理费')
diff --git a/yuthon_property_approval/models/property_borrowing_approval.py b/yuthon_property_approval/models/property_borrowing_approval.py
index b71aaec77..cd43f99a8 100644
--- a/yuthon_property_approval/models/property_borrowing_approval.py
+++ b/yuthon_property_approval/models/property_borrowing_approval.py
@@ -13,7 +13,7 @@ class PropertyBorrowingApproval(models.Model):
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one('hr.department', string="部门")
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度', default='normal')
- reason = fields.Html(string="事由")
+ reason = fields.Text(string="事由")
pay_tissue = fields.Char(string="付款组织")
collection_account = fields.Char(string="收款账号")
total_received = fields.Float(string='总额')
diff --git a/yuthon_property_approval/models/property_construction_approval.py b/yuthon_property_approval/models/property_construction_approval.py
index c46148b39..8a82345cb 100644
--- a/yuthon_property_approval/models/property_construction_approval.py
+++ b/yuthon_property_approval/models/property_construction_approval.py
@@ -19,7 +19,7 @@ class PropertyConstructionApproval(models.Model):
project_content = fields.Char(string="工程内容")
company_b_id = fields.Many2one('property.construction.unit', string="乙方")
property_id = fields.Many2one('yuthon.property', string='物业')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
image = fields.Binary(string="开工前图片")
contract_id = fields.Many2one('ir.attachment', string="合同")
start_date = fields.Date(string="开始日期")
diff --git a/yuthon_property_approval/models/property_eligibility.py b/yuthon_property_approval/models/property_eligibility.py
index e5d6f42cd..8b39c260e 100644
--- a/yuthon_property_approval/models/property_eligibility.py
+++ b/yuthon_property_approval/models/property_eligibility.py
@@ -21,7 +21,7 @@ class PropertyEligibility(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason = fields.Html(string="事由")
+ reason = fields.Text(string="事由")
notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
diff --git a/yuthon_property_approval/models/property_intention_approval.py b/yuthon_property_approval/models/property_intention_approval.py
index 1d154e4eb..12942e906 100644
--- a/yuthon_property_approval/models/property_intention_approval.py
+++ b/yuthon_property_approval/models/property_intention_approval.py
@@ -16,7 +16,7 @@ class PropertyIntentionApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason = fields.Html(string="事由")
+ reason = fields.Text(string="事由")
notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
intention_customer_ids = fields.One2many('property.intention.customer.line', 'property_intention_id', string="关联意向客户明细行")
diff --git a/yuthon_property_approval/models/property_lease_extension.py b/yuthon_property_approval/models/property_lease_extension.py
index 16b624db9..bf46cacaa 100644
--- a/yuthon_property_approval/models/property_lease_extension.py
+++ b/yuthon_property_approval/models/property_lease_extension.py
@@ -12,7 +12,7 @@ class PropertyLeaseExtension(models.Model):
_rec_name = 'name'
name = fields.Char(string='标题')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
code = fields.Char(string="编号",
diff --git a/yuthon_property_approval/models/property_merge_approval.py b/yuthon_property_approval/models/property_merge_approval.py
index b32e3dd6d..957ba1c6f 100644
--- a/yuthon_property_approval/models/property_merge_approval.py
+++ b/yuthon_property_approval/models/property_merge_approval.py
@@ -8,7 +8,7 @@ class PropertyMergeApproval(models.Model):
_description = '物业合并审批'
name = fields.Char(string='标题')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
diff --git a/yuthon_property_approval/models/property_penalty_relief.py b/yuthon_property_approval/models/property_penalty_relief.py
index 58764e25f..62c1ca85b 100644
--- a/yuthon_property_approval/models/property_penalty_relief.py
+++ b/yuthon_property_approval/models/property_penalty_relief.py
@@ -12,7 +12,7 @@ class PropertyPenaltyRelief(models.Model):
_rec_name = 'name'
name = fields.Char(string='标题')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one('hr.department', string="部门", related='users_id.employee_id.department_id')
code = fields.Char(string="编号",
diff --git a/yuthon_property_approval/models/property_rent_relief.py b/yuthon_property_approval/models/property_rent_relief.py
index b35edb500..5fbb56e08 100644
--- a/yuthon_property_approval/models/property_rent_relief.py
+++ b/yuthon_property_approval/models/property_rent_relief.py
@@ -11,7 +11,7 @@ class PropertyRentRelief(models.Model):
_rec_name = 'name'
name = fields.Char(string='标题')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('property_penalty_relief_code'))
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
diff --git a/yuthon_property_approval/models/property_rental_form.py b/yuthon_property_approval/models/property_rental_form.py
index 49f6598a9..3ae26b273 100644
--- a/yuthon_property_approval/models/property_rental_form.py
+++ b/yuthon_property_approval/models/property_rental_form.py
@@ -8,7 +8,7 @@ class PropertyRentalForm(models.Model):
_inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin']
name = fields.Char(string="名称", required=True)
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
documents_ids = fields.Many2many('ir.attachment', string="附件")
listing_method = fields.Selection([('enterprise', '企业自挂牌'), ('makeup', '广交所挂牌')], string="挂牌方式")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
diff --git a/yuthon_property_approval/models/property_split_approval.py b/yuthon_property_approval/models/property_split_approval.py
index 3d137ddeb..433245222 100644
--- a/yuthon_property_approval/models/property_split_approval.py
+++ b/yuthon_property_approval/models/property_split_approval.py
@@ -21,7 +21,7 @@ class PropertySplitApproval(models.Model):
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
name = fields.Char(string='标题')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
property_split_approval_line_ids = fields.One2many('property.split.approval.line', 'property_split_approval_id', string='关联物业拆分明细行')
split_quantity = fields.Integer(string='拆分数量', default=2)
diff --git a/yuthon_property_approval/models/property_transaction_confirmed.py b/yuthon_property_approval/models/property_transaction_confirmed.py
index ae846abfc..4fc70f963 100644
--- a/yuthon_property_approval/models/property_transaction_confirmed.py
+++ b/yuthon_property_approval/models/property_transaction_confirmed.py
@@ -15,7 +15,7 @@ class PropertyTransactionConfirmed(models.Model):
lessee_id = fields.Many2one('property.tenant.information', string='承租方')
entity_type = fields.Selection([('person', '个人'), ('enterprise', '企业')], string='实体类型')
details = fields.Text(string='详情') #这里可以完善承租方信息,为租赁合同服务
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
documents_ids = fields.Many2many('ir.attachment', string="附件")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
diff --git a/yuthon_property_approval/models/property_transfer_approval.py b/yuthon_property_approval/models/property_transfer_approval.py
index 01ddbe38a..d6310ee93 100644
--- a/yuthon_property_approval/models/property_transfer_approval.py
+++ b/yuthon_property_approval/models/property_transfer_approval.py
@@ -17,7 +17,7 @@ class PropertyTransferApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason = fields.Html(string="事由")
+ reason = fields.Text(string="事由")
notice_documents_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
rental_address = fields.Char(string="租赁地址")
diff --git a/yuthon_sps_approval/models/yuthon_office_supplies.py b/yuthon_sps_approval/models/yuthon_office_supplies.py
index 831805f47..fd8d0f2f5 100644
--- a/yuthon_sps_approval/models/yuthon_office_supplies.py
+++ b/yuthon_sps_approval/models/yuthon_office_supplies.py
@@ -13,7 +13,7 @@ class YuthonOfficeSupplies(models.Model):
issues_result = fields.Html(string="会议结果")
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one('hr.department', string="部门", related='users_id.employee_id.department_id')
- reason_application = fields.Html(string="事由")
+ reason_application = fields.Text(string="事由")
date = fields.Date(string="申请日期", default=fields.Date.today())
related_issues_id = fields.Many2one('issue.library', string="关联议题")
office_supplies_ids = fields.One2many('yuthon.office.supplies.line', 'supplies_id', string="关联办公用品申请明细")
diff --git a/yuthon_trade/models/yuthon_business_approval.py b/yuthon_trade/models/yuthon_business_approval.py
index 482cfe0a7..463783ef2 100644
--- a/yuthon_trade/models/yuthon_business_approval.py
+++ b/yuthon_trade/models/yuthon_business_approval.py
@@ -18,7 +18,7 @@ class YuthonBusinessApproval(models.Model):
is_issues = fields.Boolean(string='是否上会')
issues_result = fields.Html(string="会议结果")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
document_ids = fields.Many2many('ir.attachment', string="附件")
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
diff --git a/yuthon_trade/models/yuthon_care_condolences.py b/yuthon_trade/models/yuthon_care_condolences.py
index 3a2f06e9b..93830faf1 100644
--- a/yuthon_trade/models/yuthon_care_condolences.py
+++ b/yuthon_trade/models/yuthon_care_condolences.py
@@ -14,7 +14,7 @@ class YuthonCareCondolences(models.Model):
default=lambda self: self.env['ir.sequence'].next_by_code('property_care_reward_code_sequence'))
date = fields.Date(string='日期')
fees = fields.Float(string='费用')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
marriage_cate_id = fields.Many2one('ir.attachment', string="结婚证明")
marriage_date = fields.Date(string="结婚时间")
born_cate_id = fields.Many2one('ir.attachment', string="出生证明")
diff --git a/yuthon_trade/models/yuthon_work_condolences.py b/yuthon_trade/models/yuthon_work_condolences.py
index dbee1d540..acf6a61f8 100644
--- a/yuthon_trade/models/yuthon_work_condolences.py
+++ b/yuthon_trade/models/yuthon_work_condolences.py
@@ -14,7 +14,7 @@ class YuthonWorkCondolences(models.Model):
default=lambda self: self.env['ir.sequence'].next_by_code('property_work_condolences_code_sequence'))
date = fields.Date(string='日期')
fees = fields.Float(string='费用')
- reason = fields.Html(string="正文")
+ reason = fields.Text(string="正文")
scheme_id = fields.Many2one('ir.attachment', string="方案")
meeting_id = fields.Many2one('ir.attachment', string="会议纪要")
work_end = fields.Boolean(string="结束")
diff --git a/yuthon_trade/views/yuthon_business_approval_viwes.xml b/yuthon_trade/views/yuthon_business_approval_viwes.xml
index 5a3c784a8..3aad4f120 100644
--- a/yuthon_trade/views/yuthon_business_approval_viwes.xml
+++ b/yuthon_trade/views/yuthon_business_approval_viwes.xml
@@ -45,7 +45,7 @@
-
+
d
diff --git a/yuthon_trade/views/yuthon_seals_approval_views.xml b/yuthon_trade/views/yuthon_seals_approval_views.xml
index 42763f387..a2ebb5c2d 100644
--- a/yuthon_trade/views/yuthon_seals_approval_views.xml
+++ b/yuthon_trade/views/yuthon_seals_approval_views.xml
@@ -38,10 +38,10 @@
-
-
-
-
+
+
+
+
diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py
index 771c3499b..6d193a4a3 100644
--- a/yuthon_will_task/models/yuthon_will_task.py
+++ b/yuthon_will_task/models/yuthon_will_task.py
@@ -28,7 +28,7 @@ class YuthonWillTask(models.Model):
user_role_ids = fields.Many2many('soong.user.role', string='角色', store=True, index=True)
task_time_ids = fields.Many2many('yuthon.task.time', string='提醒')
address = fields.Char(string='地点')
- start_time = fields.Datetime(string='开始时间',default=lambda self: datetime.combine(datetime.now().date(), time(1, 0, 0)))
+ start_time = fields.Datetime(string='开始时间', default=fields.Datetime.now)
end_time = fields.Datetime(string='结束时间')
task_state = fields.Selection([('will', '待办'), ('done', '已办'), ('cancel', '取消')], default='will', string='状态', store=True)
From 3f90cc1e2e9d99b22340d55cdc0103cca2bc4ac3 Mon Sep 17 00:00:00 2001
From: zhou <123@>
Date: Thu, 22 May 2025 21:18:22 +0800
Subject: [PATCH 02/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yuthon_hr_attendance/models/go_approval.py | 6 +-
yuthon_property/models/yuthon_property.py | 58 +++++++++-
.../models/property_management.py | 52 +++++----
.../security/ir.model.access.csv | 1 -
.../views/property_management.xml | 30 +++--
yuthon_trade/__manifest__.py | 3 +-
yuthon_trade/data/sale_renting_code_data.xml | 7 ++
yuthon_trade/models/__init__.py | 1 +
yuthon_trade/models/trade_project_approval.py | 52 +++++++++
yuthon_trade/models/trade_reward_approval.py | 2 +-
yuthon_trade/models/yuthon_trade_setting.py | 17 +++
yuthon_trade/security/ir.model.access.csv | 3 +
.../views/trade_project_approval_views.xml | 103 ++++++++++++++++++
yuthon_trade/views/yuthon_trade_menu.xml | 16 +++
.../views/yuthon_trade_setting_views.xml | 28 +++++
yuthon_work_brand/views/executive_manage.xml | 1 -
16 files changed, 336 insertions(+), 44 deletions(-)
create mode 100644 yuthon_trade/models/trade_project_approval.py
create mode 100644 yuthon_trade/views/trade_project_approval_views.xml
diff --git a/yuthon_hr_attendance/models/go_approval.py b/yuthon_hr_attendance/models/go_approval.py
index c4c6896e9..38c28fc77 100644
--- a/yuthon_hr_attendance/models/go_approval.py
+++ b/yuthon_hr_attendance/models/go_approval.py
@@ -27,7 +27,7 @@ class GoApprovals(models.Model):
details = fields.Text(string="外出说明", default="1.可通过填写天数和小时,直接获得结束时间\n 2.一份外出单,可同时选择多人一次审批")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
date_start = fields.Datetime(string="开始时间", default=fields.Datetime.now)
- date_end = fields.Datetime(string="结束时间")
+ date_end = fields.Datetime(string="结束时间", default=fields.Datetime.now)
meal = fields.Selection([('yes', '是'), ('no', '否')], string="误餐费", default=None)
days = fields.Integer(string="天数")
hours = fields.Integer(string="小时")
@@ -39,8 +39,8 @@ class GoApprovals(models.Model):
is_hour = fields.Boolean(string="按小时")
start_day_selection = fields.Selection([('half', '上半天'),('afternoon', '下半天')], string="天")
end_day_selection = fields.Selection([('half', '上半天'), ('afternoon', '下半天')], string="天")
- statr_date = fields.Date(string="开始日期")
- end_date = fields.Date(string="结束日期")
+ statr_date = fields.Date(string="开始日期", default=fields.Date.today)
+ end_date = fields.Date(string="结束日期", default=fields.Date.today)
def _get_default_name_title(self):
return self._description if self._description else self._name
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 3d2857008..89de97c0d 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -230,8 +230,59 @@ class YuthonProperty(models.Model):
self._context.get('active_ids', self._context.get('active_id')))
form_id = self.env.ref('yuthon_property_approval.view_property_management_form').id
property_list = []
+ today = fields.Date.today()
+ first_record = property_ids[0]
+ # 获取第一条记录的有效purpose_id
+ valid_manage = first_record.manage_information_ids.filtered(
+ lambda m: m.start_time and m.start_time <= today and
+ (not m.end_date or m.end_date >= today)
+ )
+
+ if not valid_manage:
+ raise UserError(f"{first_record.name}该物业没有找到有效的管理信息!")
+ reference_purpose_id = valid_manage[0].purpose_id.id
+ # 参考值集合(tenure_type, company_id, admin_id, precinct_id, purpose_id)
+ reference_values = (
+ first_record.tenure_type,
+ first_record.company_id.id,
+ first_record.admin_id.id,
+ first_record.precinct_id.id,
+ reference_purpose_id
+ )
+ # 检查所有记录的属性是否与第一条记录一致
+ for record in property_ids[1:]:
+ # 获取当前记录的有效purpose_id
+ current_valid_manage = record.manage_information_ids.filtered(
+ lambda m: m.start_time and m.start_time <= today and
+ (not m.end_date or m.end_date >= today)
+ )
+
+ if not current_valid_manage:
+ raise UserError(f"{first_record.name}该物业没有找到有效的管理信息!")
+ current_purpose_id = current_valid_manage[0].purpose_id.id
+ # 当前记录的值集合
+ current_values = (
+ record.tenure_type,
+ record.company_id.id,
+ record.admin_id.id,
+ record.precinct_id.id,
+ current_purpose_id
+ )
+ # 如果有任何属性不一致,抛出统一错误
+ if current_values != reference_values:
+ raise UserError("所选记录的公司、管理类型、权属类型、管理员和所属片区必须完全一样!")
for record in property_ids:
- property_list.append([0, 0, {'property_id': record.id}])
+ for manage in record.manage_information_ids:
+ # 判断记录是否有效:start_time ≤ today ≤ end_date(或end_date为空)
+ if manage.start_time and manage.start_time <= today:
+ if not manage.end_date or manage.end_date >= today:
+ manage_id = manage
+ else:
+ manage_id = False
+ else:
+ manage_id = False
+ property_list.append([0, 0, {'property_id': record.id,
+ 'information_line_id': manage_id.id}])
return {
'name': '提交物业变更',
'view_mode': 'form',
@@ -239,6 +290,11 @@ class YuthonProperty(models.Model):
'type': 'ir.actions.act_window',
'views': [(form_id, 'form')],
"context": {
+ 'default_company_id': first_record.company_id.id,
+ 'default_purpose_id': reference_purpose_id,
+ 'default_admin_id_all': first_record.admin_id.id,
+ 'default_precinct_id': first_record.precinct_id.id,
+ 'default_tenure_type': first_record.tenure_type,
'default_management_line2_ids': property_list
}
}
diff --git a/yuthon_property_approval/models/property_management.py b/yuthon_property_approval/models/property_management.py
index f4b22f4d6..5921a5f2c 100644
--- a/yuthon_property_approval/models/property_management.py
+++ b/yuthon_property_approval/models/property_management.py
@@ -18,7 +18,6 @@ class PropertyManagement(models.Model):
department_id = fields.Many2one('hr.department', related='user_id.employee_id.department_id',string="申请人部门")
handling_opinions = fields.Text(string="经办意见")
management_line2_ids = fields.One2many('property.management.line2', 'property_management_id', string="原物业信息")
- new_property_ids = fields.One2many('property.information.detail.lines', 'new_property_id', string="新物业信息")
management_line_ids = fields.One2many('property.management.line', 'property_management_id', string="物业信息")
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
@@ -29,6 +28,12 @@ class PropertyManagement(models.Model):
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
+ company_id = fields.Many2one('yuthon.property.company', string="公司")
+ purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
+ admin_id_all = fields.Many2one('res.users', string="管理员")
+ precinct_id = fields.Many2one('yuthon.precinct.message', string="所属片区")
+ tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型')
+
def _get_default_name_title(self):
return self._description if self._description else self._name
@@ -53,7 +58,6 @@ class PropertyManagement(models.Model):
@api.onchange('management_line2_ids')
def _onchange_management_line2_ids(self):
self.management_line_ids = [(5, 0, 0)]
- self.new_property_ids = [(5, 0, 0)]
for line in self.management_line2_ids:
if line.property_id:
self.management_line_ids = [(0, 0, {
@@ -64,33 +68,29 @@ class PropertyManagement(models.Model):
'admin_id_all': line.admin_id_all.id,
'tenure_type': line.tenure_type
})]
- self.new_property_ids = [(0, 0, {
- 'property_id': line.property_id.id,
- })]
def approval_end(self):
for record in self:
- for line in record.new_property_ids:
+ for line in record.management_line2_ids:
line.property_id.write({
- 'company_id': line.company_id.id,
- 'purpose_id': line.purpose_id.id,
- 'precinct_id': line.precincts_id.id,
- 'admin_id': line.admin_id_all.id,
- 'tenure_type': line.tenure_type
+ 'company_id': record.company_id.id,
+ 'precinct_id': record.precinct_id.id,
+ 'admin_id': record.admin_id_all.id,
+ 'tenure_type': record.tenure_type
})
- record.write({'is_line': True})
-
-class PropertyInformationDetailLines(models.Model):
- _name = 'property.information.detail.lines'
- _description = '新物业信息'
-
- new_property_id = fields.Many2one('property.management', string="关联物业分配申请表")
- property_id = fields.Many2one('yuthon.property', string="物业名称")
- company_id = fields.Many2one('yuthon.property.company', string="公司")
- purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
- admin_id_all = fields.Many2one('res.users', string="管理员")
- precincts_id = fields.Many2one('yuthon.precinct.message', string="新片区")
- tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型')
+ line.information_line_id.write({'end_date': fields.Date.today()})
+ self.env['manage.information.line'].create({
+ 'yuthon_property_id': line.property_id.id,
+ 'purpose_id' : record.purpose_id.id,
+ 'precinct_id': record.precinct_id.id,
+ 'tenure_type': record.tenure_type,
+ 'management_area': line.information_line_id.management_area,
+ 'rent_area': line.information_line_id.rent_area,
+ 'admin_id' : record.admin_id_all.id,
+ 'company_id': record.company_id.id,
+ 'start_time': fields.Date.today(),
+ })
+ record.write({'is_line': True})
# 结果保留明细行
class PropertyManagementLine(models.Model):
@@ -99,6 +99,7 @@ class PropertyManagementLine(models.Model):
property_id = fields.Many2one('yuthon.property', string="物业名称")
property_management_id = fields.Many2one('property.management', string="关联物业分配申请表")
+ information_line_id = fields.Many2one('manage.information.line')
company_id = fields.Many2one('yuthon.property.company', string="公司")
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
admin_id_all = fields.Many2one('res.users', string="管理员")
@@ -113,9 +114,12 @@ class PropertyManagementLine2(models.Model):
property_management_id = fields.Many2one('property.management', string="关联物业分配申请表")
property_id = fields.Many2one('yuthon.property', string="物业名称")
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
+ information_line_id = fields.Many2one('manage.information.line')
tenure_type = fields.Selection(related='property_id.tenure_type', string='权属类型')
company_id = fields.Many2one(related='property_id.company_id', string="公司")
admin_id_all = fields.Many2one(related='property_id.admin_id', string="管理员")
precinct_id = fields.Many2one(related='property_id.precinct_id', string="所属片区")
+class PropertyInformationDetailLines(models.Model):
+ _name = 'property.information.detail.lines'
\ No newline at end of file
diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv
index a1efa2d8c..e373b451a 100644
--- a/yuthon_property_approval/security/ir.model.access.csv
+++ b/yuthon_property_approval/security/ir.model.access.csv
@@ -24,7 +24,6 @@ access_property_confirm,property_confirm,model_property_confirm,base.group_user,
access_property_move,property_move,model_property_move,base.group_user,1,1,1,1
access_property_record,property_record,model_property_record,base.group_user,1,1,1,1
access_property_equity,property_equity,model_property_equity,base.group_user,1,1,1,1
-access_property_information_detail_lines,property_information_detail_lines,model_property_information_detail_lines,base.group_user,1,1,1,1
access_property_lease_contract_line,property_lease_contract_line,model_property_lease_contract_line,base.group_user,1,1,1,1
access_property_rent_breakdown_line,property_rent_breakdown_line,model_property_rent_breakdown_line,base.group_user,1,1,1,1
access_property_water_fee_line,property_water_fee_line,model_property_water_fee_line,base.group_user,1,1,1,1
diff --git a/yuthon_property_approval/views/property_management.xml b/yuthon_property_approval/views/property_management.xml
index 1fd37c7e2..bd94b259d 100644
--- a/yuthon_property_approval/views/property_management.xml
+++ b/yuthon_property_approval/views/property_management.xml
@@ -71,6 +71,7 @@
+
@@ -84,21 +85,26 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_trade/__manifest__.py b/yuthon_trade/__manifest__.py
index 54982857e..8fd069cf4 100644
--- a/yuthon_trade/__manifest__.py
+++ b/yuthon_trade/__manifest__.py
@@ -28,6 +28,7 @@
'views/yuthon_none_views.xml',
'views/yuthon_mutual_approval_views.xml',
'views/yuthon_care_condolences_views.xml',
+ 'views/trade_project_approval_views.xml',
'views/yuthon_trade_setting_views.xml',
'views/yuthon_work_condolences_views.xml',
'views/yuthon_task_approval_views.xml',
@@ -36,7 +37,7 @@
'views/yuthon_trade_menu.xml',
],
'demo': [],
- 'depends': ['mail', 'documents', 'soong_workflow', 'yuthon_work_brand', 'hr', 'yuthon_hr_employee', 'yuthon_issue'],
+ 'depends': ['mail', 'documents', 'soong_workflow', 'yuthon_work_brand', 'hr', 'yuthon_hr_employee', 'yuthon_issue', 'project'],
'installable': True,
'application': True,
}
diff --git a/yuthon_trade/data/sale_renting_code_data.xml b/yuthon_trade/data/sale_renting_code_data.xml
index a38b56a33..1da61e2b7 100644
--- a/yuthon_trade/data/sale_renting_code_data.xml
+++ b/yuthon_trade/data/sale_renting_code_data.xml
@@ -1,5 +1,12 @@
+
+ 立项申请编号
+ trade_project_approval_code
+ LX%(y)s%(month)s%(day)s
+ 3
+
+
节日慰问编号
property_work_condolences_code
diff --git a/yuthon_trade/models/__init__.py b/yuthon_trade/models/__init__.py
index 6d2460466..1a70c1e69 100644
--- a/yuthon_trade/models/__init__.py
+++ b/yuthon_trade/models/__init__.py
@@ -23,3 +23,4 @@ from . import trade_reward_approval
from . import yuthon_seals_approval
from . import yuthon_business_approval
from . import inherit_workflow_record
+from . import trade_project_approval
diff --git a/yuthon_trade/models/trade_project_approval.py b/yuthon_trade/models/trade_project_approval.py
new file mode 100644
index 000000000..c9f747b03
--- /dev/null
+++ b/yuthon_trade/models/trade_project_approval.py
@@ -0,0 +1,52 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import models, fields, api, exceptions, _
+
+
+class TradeProjectApproval(models.Model):
+ _name = 'trade.project.approval'
+ _description = '立项申请'
+ _inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
+
+ code = fields.Char(string="流水号",
+ default=lambda self: self.env['ir.sequence'].next_by_code('trade_project_approval_code'))
+ users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
+ department_id = fields.Many2one(related='users_id.employee_id.department_id', string="申请部门")
+
+ urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
+ default='normal')
+ date_application = fields.Date(string="申请日期")
+ text = fields.Text(string='正文')
+ name = fields.Char(string="项目名称")
+ project_classify_id = fields.Many2one('project.classify.setting', string="项目分类")
+ start_date = fields.Date(string="计划开始")
+ end_date = fields.Date(string="计划完成")
+ plan_duration = fields.Integer(string="计划工期")
+ funding_id = fields.Many2one('project.funding.setting', string="资金来源")
+ employee_id = fields.Many2one('hr.employee', string="分管领导")
+ project_invest = fields.Float(string="项目总投资")
+ projected_earnings = fields.Float(string="预计投资收益")
+ project_content = fields.Text(string="项目概括")
+ project_goal = fields.Text(string="项目目标")
+ expected_results = fields.Text(string="预期成果")
+ document_ids = fields.Many2many('ir.attachment', string="立项文件")
+ work_end = fields.Boolean(string="结束")
+ active = fields.Boolean('Active', default=True, tracking=True)
+
+ def _get_default_name_title(self):
+ return self._description if self._description else self._name
+
+ name_title = fields.Char(default=_get_default_name_title)
+
+ # 项目归属
+ project_belong_id = fields.Many2one('res.users', string="项目负责人")
+ project_department_id = fields.Many2one('hr.department', string="项目部门")
+
+ def approval_end(self):
+ for rec in self:
+ self.env['project.project'].create({
+ 'name' : rec.name,
+ 'user_id' : rec.project_belong_id.id,
+ 'company_id': rec.user_id.employee_id.company_id.id,
+ })
+
+
diff --git a/yuthon_trade/models/trade_reward_approval.py b/yuthon_trade/models/trade_reward_approval.py
index fcd1d2df7..9ef435541 100644
--- a/yuthon_trade/models/trade_reward_approval.py
+++ b/yuthon_trade/models/trade_reward_approval.py
@@ -1,7 +1,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
from odoo import models, fields, api, exceptions, _
+
class TradeRewardApproval(models.Model):
_name = 'trade.reward.approval'
_description = '奖励申报呈批表'
diff --git a/yuthon_trade/models/yuthon_trade_setting.py b/yuthon_trade/models/yuthon_trade_setting.py
index b488119ed..726df3234 100644
--- a/yuthon_trade/models/yuthon_trade_setting.py
+++ b/yuthon_trade/models/yuthon_trade_setting.py
@@ -14,20 +14,37 @@ class YuthonWorkSetting(models.Model):
name = fields.Char(string='名称')
+
class SealsTypeSetting(models.Model):
_name = 'seals.type.setting'
_description = '用章类型'
name = fields.Char(string='名称')
+
class SealsScopeSetting(models.Model):
_name = 'seals.scope.setting'
_description = '用章范围'
name = fields.Char(string='名称')
+
class SendingUnitSetting(models.Model):
_name = 'sending.unit.setting'
_description = '发送单位'
name = fields.Char(string='名称')
+
+
+class ProjectClassifySetting(models.Model):
+ _name = 'project.classify.setting'
+ _description = '项目分类'
+
+ name = fields.Char(string='名称')
+
+
+class ProjectFundingSetting(models.Model):
+ _name = 'project.funding.setting'
+ _description = '资金来源'
+
+ name = fields.Char(string='名称')
diff --git a/yuthon_trade/security/ir.model.access.csv b/yuthon_trade/security/ir.model.access.csv
index 9c82093bf..ac03a64b4 100644
--- a/yuthon_trade/security/ir.model.access.csv
+++ b/yuthon_trade/security/ir.model.access.csv
@@ -31,6 +31,9 @@ access_yuthon_reward_line,yuthon_reward_line,model_yuthon_reward_line,base.group
access_seals_type_setting,seals_type_setting,model_seals_type_setting,base.group_user,1,1,1,1
access_seals_scope_setting,seals_scope_setting,model_seals_scope_setting,base.group_user,1,1,1,1
access_sending_unit_setting,sending_unit_setting,model_sending_unit_setting,base.group_user,1,1,1,1
+access_trade_project_approval,trade_project_approval,model_trade_project_approval,base.group_user,1,1,1,1
+access_project_funding_setting,project_funding_setting,model_project_funding_setting,base.group_user,1,1,1,1
+access_project_classify_setting,project_classify_setting,model_project_classify_setting,base.group_user,1,1,1,1
diff --git a/yuthon_trade/views/trade_project_approval_views.xml b/yuthon_trade/views/trade_project_approval_views.xml
new file mode 100644
index 000000000..7bfd3f660
--- /dev/null
+++ b/yuthon_trade/views/trade_project_approval_views.xml
@@ -0,0 +1,103 @@
+
+
+
+ trade.project.approval.tree
+ trade.project.approval
+
+
+
+
+
+
+
+
+
+
+ trade.project.approval.form
+ trade.project.approval
+
+
+
+
+
+ 立项申请
+ trade.project.approval
+ tree,form
+
+
+
+
+
+
diff --git a/yuthon_trade/views/yuthon_trade_menu.xml b/yuthon_trade/views/yuthon_trade_menu.xml
index 195caaef3..ba734d7fc 100644
--- a/yuthon_trade/views/yuthon_trade_menu.xml
+++ b/yuthon_trade/views/yuthon_trade_menu.xml
@@ -108,6 +108,12 @@
parent="executive_trade_process_ment"
action="view_business_approval_action"
sequence="80"/>
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_trade/views/yuthon_trade_setting_views.xml b/yuthon_trade/views/yuthon_trade_setting_views.xml
index 1b73b014e..23aa3561d 100644
--- a/yuthon_trade/views/yuthon_trade_setting_views.xml
+++ b/yuthon_trade/views/yuthon_trade_setting_views.xml
@@ -70,4 +70,32 @@
sending.unit.setting
tree
+
+ 项目分类
+ project.classify.setting
+
+
+
+
+
+
+
+ 项目分类
+ project.classify.setting
+ tree
+
+
+ 资金来源
+ project.funding.setting
+
+
+
+
+
+
+
+ 资金来源
+ project.funding.setting
+ tree
+
\ No newline at end of file
diff --git a/yuthon_work_brand/views/executive_manage.xml b/yuthon_work_brand/views/executive_manage.xml
index 06dc3816d..2fabd11fe 100644
--- a/yuthon_work_brand/views/executive_manage.xml
+++ b/yuthon_work_brand/views/executive_manage.xml
@@ -3,7 +3,6 @@
Create Rooms
diff --git a/yuthon_hr_employee/models/inherit_res_groups.py b/yuthon_hr_employee/models/inherit_res_groups.py
index bfc51497f..54ada644e 100644
--- a/yuthon_hr_employee/models/inherit_res_groups.py
+++ b/yuthon_hr_employee/models/inherit_res_groups.py
@@ -19,15 +19,23 @@ class ResGroups(models.Model):
self.write({'users': [(3, user.id) for user in users_to_unlink2]})
self.write({'users_ids': [(5, 0, 0)]})
self.write({'employee_ids': [(5, 0, 0)]})
+ self.write({'department_ids': [(5, 0, 0)]})
+ self.write({'user_role_ids': [(5, 0, 0)]})
+ self.write({'users_role_group_ids': [(5, 0, 0)]})
def rule_unlink(self):
self.rule_groups.unlink()
self.model_access.unlink()
- def users_add(self):
- for user in self.employee_ids:
- if user.user_id:
- self.write({'users': [(4, user.user_id.id)]})
+ @api.onchange('employee_ids', 'department_ids', 'user_role_ids', 'users_role_group_ids')
+ def _onchange_update_users(self):
+ """动态更新 users 字段,基于员工、部门和角色的选择"""
+ all_user_ids = set()
+ # 1. 添加选中员工对应的用户
+ for employee in self.employee_ids:
+ if employee.user_id:
+ all_user_ids.add(employee.user_id.id)
+ # 2. 添加选中部门及其子部门的所有员工对应的用户
def get_department_employees(department_id):
valid_user_ids = set()
employee_ids = self.env['hr.employee'].search([('department_id', '=', department_id.id)])
@@ -37,16 +45,22 @@ class ResGroups(models.Model):
valid_user_ids.update(get_department_employees(child))
return valid_user_ids
for department_id in self.department_ids:
- valid_user_ids = get_department_employees(department_id)
- if valid_user_ids:
- self.write({'users': [(4, user_id) for user_id in valid_user_ids]})
+ all_user_ids.update(get_department_employees(department_id))
+ # 3. 添加选中角色对应的用户
for user_role in self.user_role_ids:
- user_employee_ids = self.env['hr.employee'].search(['|', ('user_role_id', '=', user_role.id), ('user_role_ids', 'in', [user_role.id])])
- self.write({'users': [(4, user.user_id.id) for user in user_employee_ids]})
-
+ user_employee_ids = self.env['hr.employee'].search(
+ ['|', ('user_role_id', '=', user_role.id.origin), ('user_role_ids', 'in', [user_role.id.origin])]
+ )
+ all_user_ids.update([user.user_id.id for user in user_employee_ids if user.user_id])
+ # 4. 添加角色组对应的用户
for record in self:
group_role_ids = record.users_role_group_ids.user_role_ids
for user_role in group_role_ids:
- user_employee_ids = self.env['hr.employee'].search(['|', ('user_role_id', '=', user_role.id), ('user_role_ids', 'in', [user_role.id])])
- self.write({'users': [(4, user.user_id.id) for user in user_employee_ids]})
+ user_employee_ids = self.env['hr.employee'].search(
+ ['|', ('user_role_id', '=', user_role.id.origin), ('user_role_ids', 'in', [user_role.id.origin])]
+ )
+ all_user_ids.update([user.user_id.id for user in user_employee_ids if user.user_id])
+
+ # 更新 users 字段(使用 replace 操作)
+ self.users = [(6, 0, list(all_user_ids))]
diff --git a/yuthon_hr_employee/views/inherit_res_groups_views.xml b/yuthon_hr_employee/views/inherit_res_groups_views.xml
index ae752a2d1..d6cad4b79 100644
--- a/yuthon_hr_employee/views/inherit_res_groups_views.xml
+++ b/yuthon_hr_employee/views/inherit_res_groups_views.xml
@@ -10,7 +10,6 @@
diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
index b3c6d9ed3..039a7c437 100644
--- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
+++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml
@@ -20,7 +20,7 @@
1
-
+
ztree_select
@@ -101,7 +101,13 @@
-
+
+
+
+ 1
+
+
+ 1