!2860 添加功能

Merge pull request !2860 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-05-24 09:43:47 +00:00
committed by Gitee
6 changed files with 16 additions and 92 deletions
+6 -6
View File
@@ -35,12 +35,12 @@ class IssueApproval(models.Model):
name_title = fields.Char(default=_get_default_name_title)
@api.onchange('issue_approval_ids')
def _onchange_issue_approval_ids(self):
if self.issue_approval_ids:
self.issue_display = '\n'.join([issue_library.name for issue_library in self.issue_approval_ids])
self.decision_display = '\n'.join([issue_library.approval_decision_sequence for issue_library in self.issue_approval_ids])
@api.constrains("issue_approval_ids")
def _check_issue_approval_ids(self):
for rec in self:
if rec.issue_approval_ids:
self.issue_display ='\n'.join([issue_library.issue_library_id.name for issue_library in self.issue_approval_ids])
self.decision_display ='\n'.join([issue_library.approval_decision_sequence for issue_library in self.issue_approval_ids])
class IssueApprovalLine(models.Model):
_name = 'issue.approval.line'
-23
View File
@@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies (<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions (<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
################################################################################
from . import excel_report_designer
@@ -1,60 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2024-TODAY Cybrosys Technologies (<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions (<https://www.cybrosys.com>)
#
# This program is free software: you can modify
# it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
################################################################################
import json
from odoo import http
from odoo.http import content_disposition, request
from odoo.tools import html_escape
class ReportPrintController(http.Controller):
@http.route('/print_notice_report', type='http', auth='user')
def print_notice_report(self):
"""
控制器方法,用于触发打印通知公告报表
"""
# 获取 report.generator 模型的对象(假设存在该模型)
report_generator = request.env['report.generator'].sudo().create({})
# 调用 print_fixed_report 方法
action = report_generator.print_fixed_report()
# 提取报表数据
report_data = action.get('data', {})
options = json.loads(report_data.get('options', '{}'))
report_model_name = report_data.get('model')
output_format = report_data.get('output_format')
report_name = report_data.get('report_name')
# 获取报表模型
report_model = request.env[report_model_name]
# 创建响应对象
response = request.make_response(
None,
headers=[
('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' if output_format == 'xlsx' else 'application/pdf'),
('Content-Disposition', f'attachment; filename="{report_name}.{output_format}"')
]
)
# 调用报表模型的生成报表方法
if hasattr(report_model, 'get_xlsx_report'):
report_model.get_xlsx_report(options, response)
return response
+3 -3
View File
@@ -26,9 +26,9 @@ class YuthonTaskApproval(models.Model):
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
duration = fields.Float(string="时长", store=True, compute='_compute_duration')
concentration = fields.Float(string="浓度")
warning_value = fields.Float(string="警戒值")
number = fields.Integer(string="数量")
concentration = fields.Float(related="task_id.concentration", string="浓度")
warning_value = fields.Float(related="task_id.warning_value", string="警戒值")
number = fields.Integer(related="task_id.number", string="数量")
def _get_default_name_title(self):
@@ -11,6 +11,10 @@ class YuthonTaskSetting(models.Model):
standard = fields.Text(string='标准')
inspector = fields.Text(string='工作要求')
scope = fields.Char(string='发放范围')
concentration = fields.Float(string="浓度")
warning_value = fields.Float(string="警戒值")
number = fields.Integer(string="数量")
class YuthonStackPosition(models.Model):
_name = 'yuthon.stack.position'
@@ -9,6 +9,9 @@
<field name="standard"/>
<field name="inspector"/>
<field name="scope"/>
<field name="concentration"/>
<field name="warning_value"/>
<field name="number"/>
</tree>
</field>
</record>