Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/commercially_launched

This commit is contained in:
mgw
2025-03-24 13:41:39 +08:00
4 changed files with 63 additions and 49 deletions

View File

@@ -4,15 +4,15 @@ from odoo import fields, models, api, _
class StatusChange(models.Model):
_inherit = 'sale.order'
def action_confirm(self):
res = super(StatusChange, self).action_confirm()
# 采购申请自动确认
pr_ids = self.env["purchase.request"].sudo().search(
[('origin', 'like', self.name), ('rule_new_add', '=', True)])
if pr_ids:
pr_ids.write({'need_validation': False})
pr_ids.write({"state": "approved"})
return res
# def action_confirm(self):
# res = super(StatusChange, self).action_confirm()
# # 采购申请自动确认
# pr_ids = self.env["purchase.request"].sudo().search(
# [('origin', 'like', self.name), ('rule_new_add', '=', True)])
# if pr_ids:
# pr_ids.write({'need_validation': False})
# pr_ids.write({"state": "approved"})
# return res
purchase_request_purchase_order_count = fields.Integer('采购申请单数量', compute='_compute_purchase_request_count',
store=True)

View File

@@ -42,3 +42,15 @@ class StockRule(models.Model):
request_line_data = rule._prepare_purchase_request_line(pr, procurement)
request_line_data.update({'origin': procurement.origin})
purchase_request_line_model.create(request_line_data)
def _run_buy(self, procurements):
res = super(StockRule, self)._run_buy(procurements)
# 判断是否根据规则生成新的采购申请单据,如果生成则修改状态为 approved
origins = list(set([procurement[0].origin for procurement in procurements]))
for origin in origins:
pr_ids = self.env["purchase.request"].sudo().search(
[('origin', 'like', origin), ('rule_new_add', '=', True), ('state', '=', 'draft')])
if pr_ids:
pr_ids.write({'need_validation': False})
pr_ids.write({"state": "approved", 'need_validation': True, 'rule_new_add': False})
return res

View File

@@ -332,12 +332,12 @@
<!-- 测量page内有一个添加测量值按钮点击可以新增一行测量值新增的行在tree视图中显示显示的列有序号、检测项目、测量值1、测量值2、测量值3、测量值4、测量值5、判定、备注。其中检测项目、测量值1、测量值2、测量值3、测量值4、测量值5为必填项判定为下拉框默认选中合格备注为文本框。 -->
<page string="测量" name="measure" attrs="{'invisible': [('is_out_check', '=', False)]}">
<div class="o_row">
<button name="add_measure_line" type="object" class="btn-primary" string="添加测量值"/>
<button name="remove_measure_line" type="object" class="btn-primary" string="删除测量值"/>
<button name="add_measure_line" type="object" class="btn-primary" string="添加测量值" attrs="{'invisible': [('publish_status', '=', 'published')]}"/>
<button name="remove_measure_line" type="object" class="btn-primary" string="删除测量值" attrs="{'invisible': [('publish_status', '=', 'published')]}"/>
<button name="%(quality_control.import_complex_model_wizard)d" string="上传"
type="action"
class="btn-primary"
attrs="{'force_show':1}"
attrs="{'force_show':1, 'invisible': [('publish_status', '=', 'published')]}"
context="{'default_model_name': 'quality.check.measure.line', 'default_check_id': id}"/>
</div>
<br/>

View File

@@ -31,7 +31,7 @@
<!-- 定义页脚模板 -->
<template id="report_quality_footer">
<div class="footer">
<div style="border-top: 2px solid black;"></div>
<div style="border-top: 3px solid black;"></div>
<div class="row">
<div class="col-6">
@@ -44,10 +44,10 @@
<p>加工工厂: <span t-field="o.company_id.factory_name"/></p>
</div>
</div>
<div style="border-top: 2px solid black;"></div>
<!-- <div class="text-center">
<!-- <div style="border-top: 2px solid black;"></div> -->
<div class="text-center">
<span><span class="page"/> 页/共 <span class="topage"/></span>
</div> -->
</div>
</div>
</template>
<template id="report_quality_inspection">
@@ -57,7 +57,7 @@
<t t-call="sf_quality.report_quality_header"/>
<div class="page">
<div class="page" style="min-height: 800px; position: relative; padding-bottom: 150px;">
<table class="table table-sm o_main_table mt-4" style="border: 1px solid black;">
<tr>
@@ -117,36 +117,35 @@
<img src="/sf_quality/static/img/pass.png" style="width: 200px; height: 200px;position: absolute; bottom: 20px; right: 20%;"/>
</div>
<div class="row mt-4">
<div class="col-12">
<h5 style="font-size: 18px;">检验结论:
<span t-if="o.report_result == 'OK'" style="margin-left: 30px;">
<svg width="20" height="20" style="vertical-align: -3px;">
<rect x="1" y="1" width="18" height="18" fill="none" stroke="black" stroke-width="1.5"/>
<path d="M4 10 L9 15 L16 6" stroke="black" stroke-width="2" fill="none"/>
</svg>
<span style="margin-left: 5px;">合格</span>
</span>
<span t-else="" style="margin-left: 30px;">
<svg width="20" height="20" style="vertical-align: -3px;">
<rect x="1" y="1" width="18" height="18" fill="none" stroke="black" stroke-width="1.5"/>
</svg>
<span style="margin-left: 5px;">合格</span>
</span>
<span t-if="o.report_result == 'NG'" style="margin-left: 50px;">
<svg width="20" height="20" style="vertical-align: -3px;">
<rect x="1" y="1" width="18" height="18" fill="none" stroke="black" stroke-width="1.5"/>
<path d="M4 10 L9 15 L16 6" stroke="black" stroke-width="2" fill="none"/>
</svg>
<span style="margin-left: 5px;">不合格</span>
</span>
<span t-else="" style="margin-left: 50px;">
<svg width="20" height="20" style="vertical-align: -3px;">
<rect x="1" y="1" width="18" height="18" fill="none" stroke="black" stroke-width="1.5"/>
</svg>
<span style="margin-left: 5px;">不合格</span>
</span>
</h5>
<div style="clear: both; margin-top: 30px; padding-top: 10px;">
<div style="display: inline-block;">
<span style="font-size: 18px; font-weight: bold;">检验结论: </span>
<span t-if="o.report_result == 'OK'" style="margin-left: 30px; display: inline-block;">
<svg width="20" height="20" style="vertical-align: middle;">
<rect x="1" y="1" width="18" height="18" fill="none" stroke="black" stroke-width="1.5"/>
<path d="M4 10 L9 15 L16 6" stroke="black" stroke-width="2" fill="none"/>
</svg>
<span style="margin-left: 5px;">合格</span>
</span>
<span t-else="" style="margin-left: 30px; display: inline-block;">
<svg width="20" height="20" style="vertical-align: middle;">
<rect x="1" y="1" width="18" height="18" fill="none" stroke="black" stroke-width="1.5"/>
</svg>
<span style="margin-left: 5px;">合格</span>
</span>
<span t-if="o.report_result == 'NG'" style="margin-left: 50px; display: inline-block;">
<svg width="20" height="20" style="vertical-align: middle;">
<rect x="1" y="1" width="18" height="18" fill="none" stroke="black" stroke-width="1.5"/>
<path d="M4 10 L9 15 L16 6" stroke="black" stroke-width="2" fill="none"/>
</svg>
<span style="margin-left: 5px;">不合格</span>
</span>
<span t-else="" style="margin-left: 50px; display: inline-block;">
<svg width="20" height="20" style="vertical-align: middle;">
<rect x="1" y="1" width="18" height="18" fill="none" stroke="black" stroke-width="1.5"/>
</svg>
<span style="margin-left: 5px;">不合格</span>
</span>
</div>
</div>
@@ -158,17 +157,20 @@
<p><strong>质检员: </strong> <span t-field="o.quality_manager"/></p>
</div>
</div>
<div style="border-top: 3px solid black;"></div>
<!-- 添加合格标签 -->
<!-- <div class="row mt-5">
<div class="col-12 text-center">
<p>(以下空白)</p>
<p></p>
</div>
</div> -->
<!-- 调用自定义页脚 -->
<!-- 页脚固定在底部 -->
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<t t-call="sf_quality.report_quality_footer"/>
<!-- </div> -->
</div>
</t>
</t>