检测报告发布流程
This commit is contained in:
@@ -17,10 +17,14 @@
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/check_standards.xml',
|
||||
'data/documents_data.xml',
|
||||
'data/insepection_report_template.xml',
|
||||
'data/report_actions.xml',
|
||||
'views/view.xml',
|
||||
'views/quality_cnc_test_view.xml',
|
||||
'views/mrp_workorder.xml',
|
||||
'views/quality_check_view.xml'
|
||||
'views/quality_check_view.xml',
|
||||
'views/quality_company.xml'
|
||||
],
|
||||
|
||||
'assets': {
|
||||
|
||||
11
sf_quality/data/documents_data.xml
Normal file
11
sf_quality/data/documents_data.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<!-- 创建采购合同文件夹 -->
|
||||
<record id="documents_purchase_contracts_folder" model="documents.folder">
|
||||
<field name="name">出厂检验报告</field>
|
||||
<field name="description">存放出厂检验报告相关文件</field>
|
||||
<field name="sequence">11</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
146
sf_quality/data/insepection_report_template.xml
Normal file
146
sf_quality/data/insepection_report_template.xml
Normal file
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- 定义页眉模板 -->
|
||||
<template id="report_quality_header">
|
||||
<div class="header">
|
||||
<div class="pdf-viewer-toolbar">
|
||||
<img t-if="o.company_id.favicon" t-att-src="image_data_uri(o.company_id.favicon)" style="max-height: 70px;" alt="Logo"/>
|
||||
<div class="float-right" style="text-align: right;">
|
||||
<!-- 使用完整URL的二维码生成方式 -->
|
||||
<t t-set="base_url" t-value="request.env['ir.config_parameter'].sudo().get_param('web.base.url')"/>
|
||||
<t t-set="report_url" t-value="'%s/web#id=%s&model=quality.check&view_type=form' % (base_url, o.id)"/>
|
||||
<img t-att-src="'/report/barcode/QR/%s' % report_url" style="width:80px;height:80px"/>
|
||||
<div style="font-size: 20px;">
|
||||
<strong>报告编号: </strong><span t-field="o.name"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 定义页脚模板 -->
|
||||
<template id="report_quality_footer">
|
||||
<div class="footer">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<p>售后服务: <span t-field="o.company_id.phone"/></p>
|
||||
<p>公司名称: <span t-field="o.company_id.name"/></p>
|
||||
<p>公司网址: <span t-field="o.company_id.website"/></p>
|
||||
<p>公司邮箱: <span t-field="o.company_id.email"/></p>
|
||||
<p>加工工厂: <span t-field="o.company_id.factory_name"/></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<span>第<span class="page"/> 页/共 <span class="topage"/>页</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template id="report_quality_inspection">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t t-call="web.basic_layout">
|
||||
<!-- 调用自定义页眉 -->
|
||||
<t t-call="sf_quality.report_quality_header"/>
|
||||
|
||||
|
||||
<div class="page">
|
||||
<div class="text-center">
|
||||
<h2>出厂检验报告</h2>
|
||||
</div>
|
||||
<!-- <div class="col-6">
|
||||
<div t-if="o.company_id.favicon" class="float-right">
|
||||
<img t-att-src="image_data_uri(o.company_id.favicon)" style="max-height: 45px;" alt="Logo"/>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<table class="table table-sm o_main_table mt-4" style="border: 1px solid black;">
|
||||
<tr>
|
||||
<td style="width: 15%; border: 1px solid black;"><strong>产品名称:</strong></td>
|
||||
<td style="width: 35%; border: 1px solid black;"><span t-field="o.product_id.name"/></td>
|
||||
<td style="width: 15%; border: 1px solid black;"><strong>材料:</strong></td>
|
||||
<td style="width: 35%; border: 1px solid black;"><span t-field="o.material_name"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;"><strong>图号:</strong></td>
|
||||
<td style="border: 1px solid black;"><span t-field="o.part_number"/></td>
|
||||
<td style="border: 1px solid black;"><strong>日期:</strong></td>
|
||||
<td style="border: 1px solid black;"><span t-field="o.write_date"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;"><strong>总数量:</strong></td>
|
||||
<td style="border: 1px solid black;"><span t-field="o.total_qty"/></td>
|
||||
<td style="border: 1px solid black;"><strong>检验数量:</strong></td>
|
||||
<td style="border: 1px solid black;"><span t-field="o.check_qty"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4 class="text-center mt-4">检验结果</h4>
|
||||
<table class="table table-sm mt-2" style="border: 1px solid black;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="border: 1px solid black;">检测项目</th>
|
||||
<th style="border: 1px solid black;" colspan="5">测量值</th>
|
||||
<th style="border: 1px solid black;">判定</th>
|
||||
<th style="border: 1px solid black;">备注</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="border: 1px solid black;"></th>
|
||||
<th style="border: 1px solid black;">1</th>
|
||||
<th style="border: 1px solid black;">2</th>
|
||||
<th style="border: 1px solid black;">3</th>
|
||||
<th style="border: 1px solid black;">4</th>
|
||||
<th style="border: 1px solid black;">5</th>
|
||||
<th style="border: 1px solid black;"></th>
|
||||
<th style="border: 1px solid black;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="o.measure_line_ids" t-as="line">
|
||||
<td style="border: 1px solid black;"><span t-field="line.measure_item"/></td>
|
||||
<td style="border: 1px solid black;"><span t-field="line.measure_value1"/></td>
|
||||
<td style="border: 1px solid black;"><span t-field="line.measure_value2"/></td>
|
||||
<td style="border: 1px solid black;"><span t-field="line.measure_value3"/></td>
|
||||
<td style="border: 1px solid black;"><span t-field="line.measure_value4"/></td>
|
||||
<td style="border: 1px solid black;"><span t-field="line.measure_value5"/></td>
|
||||
<td style="border: 1px solid black;"><span t-field="line.measure_result"/></td>
|
||||
<td style="border: 1px solid black;"><span t-field="line.remark"/></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<h5>检验结论:
|
||||
<span t-if="o.report_result == 'OK'" style="margin-left: 20px;">☑ 合格</span>
|
||||
<span t-else="" style="margin-left: 20px;">□ 合格</span>
|
||||
<span t-if="o.report_result == 'NG'" style="margin-left: 40px;">☑ 不合格</span>
|
||||
<span t-else="" style="margin-left: 40px;">□ 不合格</span>
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-6">
|
||||
<p><strong>操作员: </strong> <span t-field="o.measure_operator"/></p>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<p><strong>质检员: </strong> <span t-field="o.quality_manager"/></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-5">
|
||||
<div class="col-12 text-center">
|
||||
<p>(以下空白)</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 调用自定义页脚 -->
|
||||
<t t-call="sf_quality.report_quality_footer"/>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
22
sf_quality/data/report_actions.xml
Normal file
22
sf_quality/data/report_actions.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="action_report_quality_inspection" model="ir.actions.report">
|
||||
<field name="name">出厂检验报告</field>
|
||||
<field name="model">quality.check</field> <!-- 请替换为实际的模型名称 -->
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">sf_quality.report_quality_inspection</field>
|
||||
<field name="report_file">sf_quality.report_quality_inspection</field>
|
||||
<field name="print_report_name">'QC-' + object.name + '.pdf'</field>
|
||||
<field name="binding_model_id" ref="model_quality_check"/> <!-- 请替换为实际的模型ID引用 -->
|
||||
<field name="binding_type">report</field>
|
||||
</record>
|
||||
|
||||
<!-- 定义HTML预览报告动作 -->
|
||||
<record id="action_report_quality_inspection_preview" model="ir.actions.report">
|
||||
<field name="name">预览检验报告</field>
|
||||
<field name="model">quality.inspection</field>
|
||||
<field name="report_type">qweb-html</field>
|
||||
<field name="report_name">sf_quality.report_quality_inspection</field>
|
||||
<field name="binding_type">report</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -6,3 +6,4 @@ from . import quality
|
||||
from . import quality_cnc_test
|
||||
from . import mrp_workorder
|
||||
# from . import stock
|
||||
from . import quality_company
|
||||
|
||||
8
sf_quality/models/quality_company.py
Normal file
8
sf_quality/models/quality_company.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
# 为公司增加字段
|
||||
class Company(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
factory_name = fields.Char('加工工厂')
|
||||
@@ -70,6 +70,14 @@
|
||||
|
||||
<xpath expr="//header" position="inside">
|
||||
<field name="is_out_check" invisible="1"/>
|
||||
<button name="%(sf_quality.action_report_quality_inspection_preview)d"
|
||||
string="预览报告"
|
||||
type="action"
|
||||
class="oe_highlight"/>
|
||||
<!-- 如果还需要打印按钮 -->
|
||||
<button name="%(sf_quality.action_report_quality_inspection)d"
|
||||
string="打印报告"
|
||||
type="action"/>
|
||||
<button name="do_preview" string="预览" type="object" class="btn-primary" attrs="{'invisible': [('is_out_check', '=', False)]}"/>
|
||||
<button name="do_publish" string="发布" type="object" class="btn-primary" attrs="{'invisible': [('is_out_check', '=', False)]}"/>
|
||||
<button name="do_cancel_publish" string="取消发布" type="object" class="btn-primary" attrs="{'invisible': [('is_out_check', '=', False)]}"/>
|
||||
|
||||
13
sf_quality/views/quality_company.xml
Normal file
13
sf_quality/views/quality_company.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
<odoo>
|
||||
<record id="sf_quality_company_view" model="ir.ui.view">
|
||||
<field name="name">sf.quality.company.view</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="factory_name"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user