From 8150facf12087f7f976f12b374938b3633737574 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Thu, 22 May 2025 13:29:44 +0800 Subject: [PATCH] =?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_record.py | 4 ++ .../templates/soong_workflow_templates.xml | 8 ++-- .../views/soong_workflow_record.xml | 1 - yuthon_holiday/models/inherit_hr_leave.py | 2 +- yuthon_holiday/views/hr_leave_batch.xml | 2 +- yuthon_trade/__manifest__.py | 1 + yuthon_trade/models/__init__.py | 1 + .../models/inherit_workflow_record.py | 34 +++++++++++++++ yuthon_trade/models/yuthon_seals_approval.py | 8 ++-- yuthon_trade/models/yuthon_trade_setting.py | 20 ++++++++- yuthon_trade/security/ir.model.access.csv | 4 ++ .../views/inherit_workflow_record_viwes.xml | 17 ++++++++ .../views/yuthon_seals_approval_views.xml | 4 +- yuthon_trade/views/yuthon_trade_menu.xml | 15 +++++++ .../views/yuthon_trade_setting_views.xml | 42 +++++++++++++++++++ 15 files changed, 148 insertions(+), 15 deletions(-) create mode 100644 yuthon_trade/models/inherit_workflow_record.py create mode 100644 yuthon_trade/views/inherit_workflow_record_viwes.xml diff --git a/soong_workflow/models/soong_workflow_record.py b/soong_workflow/models/soong_workflow_record.py index d17e09e69..b4e073bfe 100644 --- a/soong_workflow/models/soong_workflow_record.py +++ b/soong_workflow/models/soong_workflow_record.py @@ -195,3 +195,7 @@ class SoongWorkflowRecord(models.Model): for record in self: record.active = False + + + + diff --git a/soong_workflow/templates/soong_workflow_templates.xml b/soong_workflow/templates/soong_workflow_templates.xml index 6f911da3d..774376f3d 100644 --- a/soong_workflow/templates/soong_workflow_templates.xml +++ b/soong_workflow/templates/soong_workflow_templates.xml @@ -26,7 +26,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -75,7 +75,7 @@ - + @@ -86,7 +86,7 @@ - + diff --git a/soong_workflow/views/soong_workflow_record.xml b/soong_workflow/views/soong_workflow_record.xml index 4347dc4c6..5417ceae2 100644 --- a/soong_workflow/views/soong_workflow_record.xml +++ b/soong_workflow/views/soong_workflow_record.xml @@ -15,7 +15,6 @@ - soong.workflow.record.tree soong.workflow.record diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 0a0345412..15e1bf99f 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -337,7 +337,7 @@ class HolidaysRequestBatch(models.Model): default='normal') start_date = fields.Date(string="开始时间") end_date = fields.Date(string="结束时间") - custom_document_ids = fields.Many2many( + document_ids = fields.Many2many( string='文件', comodel_name='ir.attachment', relation='leave_custom_doc_rel', diff --git a/yuthon_holiday/views/hr_leave_batch.xml b/yuthon_holiday/views/hr_leave_batch.xml index c7ba50c8b..019e13e27 100644 --- a/yuthon_holiday/views/hr_leave_batch.xml +++ b/yuthon_holiday/views/hr_leave_batch.xml @@ -52,7 +52,7 @@ - + diff --git a/yuthon_trade/__manifest__.py b/yuthon_trade/__manifest__.py index 5e1cd3223..54982857e 100644 --- a/yuthon_trade/__manifest__.py +++ b/yuthon_trade/__manifest__.py @@ -24,6 +24,7 @@ 'views/yuthon_trade_reimbursed.xml', 'views/yuthon_message_approval_views.xml', 'views/yuthon_trade_supportive.xml', + 'views/inherit_workflow_record_viwes.xml', 'views/yuthon_none_views.xml', 'views/yuthon_mutual_approval_views.xml', 'views/yuthon_care_condolences_views.xml', diff --git a/yuthon_trade/models/__init__.py b/yuthon_trade/models/__init__.py index 0c3d4224e..6d2460466 100644 --- a/yuthon_trade/models/__init__.py +++ b/yuthon_trade/models/__init__.py @@ -22,3 +22,4 @@ from . import yuthon_task_setting from . import trade_reward_approval from . import yuthon_seals_approval from . import yuthon_business_approval +from . import inherit_workflow_record diff --git a/yuthon_trade/models/inherit_workflow_record.py b/yuthon_trade/models/inherit_workflow_record.py new file mode 100644 index 000000000..634ad7ae0 --- /dev/null +++ b/yuthon_trade/models/inherit_workflow_record.py @@ -0,0 +1,34 @@ +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError, UserError +import logging +from datetime import datetime, date, time, timedelta + +class InheritWorkflowRecord(models.Model): + _inherit = "soong.workflow.record" + + def put_seals(self): + form_id = self.env.ref('yuthon_trade.view_yuthon_seals_approval_form').id + document_list = [] + soong_workflow_list = [] + record_ids = self.env["soong.workflow.record"].browse \ + (self._context.get('active_ids', self._context.get('active_id'))) + for record in record_ids: + # if record.approve_state != "end": + # raise UserError("当前流程未结束,不可盖章") + related_record = self.env[record.res_model].browse(record.res_id) + soong_workflow_list.append((0, 0, { + 'workflow_record_id': record.id, + })) + if related_record.document_ids: + document_list.extend(related_record.document_ids.ids) + + return { + "name": _("盖章审批"), + "type": "ir.actions.act_window", + "res_model": "yuthon.seals.approval", + "views": [(form_id, "form")], + "context": { + 'default_document_ids': [(6, 0, document_list)], + 'default_soong_record_ids': soong_workflow_list, + } ,} + diff --git a/yuthon_trade/models/yuthon_seals_approval.py b/yuthon_trade/models/yuthon_seals_approval.py index 1847178b6..7c294faec 100644 --- a/yuthon_trade/models/yuthon_seals_approval.py +++ b/yuthon_trade/models/yuthon_seals_approval.py @@ -17,11 +17,9 @@ class YuthonSealsApproval(models.Model): document_ids = fields.Many2many('ir.attachment', string="附件") urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度', default='normal') - type_stamp = fields.Selection([('official', '公章'), ('contract', '合同章'), ('seal', '法人章'), - ('salary', '财务章'), ('other', '其他')], string='用章类型', default='official') - scope_chapter = fields.Selection([('thtz', '天河投资'), ('ttcj', '天投城建'), - ('thwg', '天河物管'), ('thlc', '天河粮储')], string='用章范围', default='thtz') - approval_id = fields.Many2one('hr.department', string="发送单位") + type_stamp_ids = fields.Many2many('seals.type.setting', string='用章类型') + scope_chapter_id = fields.Many2one('seals.scope.setting', string='用章范围') + approval_id = fields.Many2one('sending.unit.setting', string="发送单位") remake = fields.Text(string="用章意见") active = fields.Boolean('Active', default=True, tracking=True) work_end = fields.Boolean(string="结束") diff --git a/yuthon_trade/models/yuthon_trade_setting.py b/yuthon_trade/models/yuthon_trade_setting.py index c560c6b4e..b488119ed 100644 --- a/yuthon_trade/models/yuthon_trade_setting.py +++ b/yuthon_trade/models/yuthon_trade_setting.py @@ -12,4 +12,22 @@ class YuthonWorkSetting(models.Model): _name = 'yuthon.work.setting' _description = '节日类型配置' - name = fields.Char(string='名称') \ No newline at end of file + 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='名称') diff --git a/yuthon_trade/security/ir.model.access.csv b/yuthon_trade/security/ir.model.access.csv index c3261b36b..9c82093bf 100644 --- a/yuthon_trade/security/ir.model.access.csv +++ b/yuthon_trade/security/ir.model.access.csv @@ -28,5 +28,9 @@ access_yuthon_task_setting,yuthon_task_setting,model_yuthon_task_setting,base.gr access_yuthon_stack_position,yuthon_stack_position,model_yuthon_stack_position,base.group_user,1,1,1,1 access_trade_reward_approval,trade_reward_approval,model_trade_reward_approval,base.group_user,1,1,1,1 access_yuthon_reward_line,yuthon_reward_line,model_yuthon_reward_line,base.group_user,1,1,1,1 +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 + diff --git a/yuthon_trade/views/inherit_workflow_record_viwes.xml b/yuthon_trade/views/inherit_workflow_record_viwes.xml new file mode 100644 index 000000000..7b59816b0 --- /dev/null +++ b/yuthon_trade/views/inherit_workflow_record_viwes.xml @@ -0,0 +1,17 @@ + + + + + inherit.workflow.record.tree + soong.workflow.record + + + +
+
+
+
+
+
+
diff --git a/yuthon_trade/views/yuthon_seals_approval_views.xml b/yuthon_trade/views/yuthon_seals_approval_views.xml index e9c757bca..42763f387 100644 --- a/yuthon_trade/views/yuthon_seals_approval_views.xml +++ b/yuthon_trade/views/yuthon_seals_approval_views.xml @@ -39,8 +39,8 @@ - - + + diff --git a/yuthon_trade/views/yuthon_trade_menu.xml b/yuthon_trade/views/yuthon_trade_menu.xml index a80d0bdb2..195caaef3 100644 --- a/yuthon_trade/views/yuthon_trade_menu.xml +++ b/yuthon_trade/views/yuthon_trade_menu.xml @@ -137,4 +137,19 @@ parent="executive_trade_setting" action="view_yuthon_stack_position_action" sequence="40"/> + + + \ 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 6a535b845..1b73b014e 100644 --- a/yuthon_trade/views/yuthon_trade_setting_views.xml +++ b/yuthon_trade/views/yuthon_trade_setting_views.xml @@ -28,4 +28,46 @@ yuthon.work.setting tree
+ + seals.type.setting.tree + seals.type.setting + + + + + + + + 用章类型 + seals.type.setting + tree + + + seals.scope.setting.tree + seals.scope.setting + + + + + + + + 用章范围 + seals.scope.setting + tree + + + sending.unit.setting.tree + sending.unit.setting + + + + + + + + 发送单位 + sending.unit.setting + tree + \ No newline at end of file