Accept Merge Request #1939: (feature/制造功能优化 -> develop)
Merge Request: Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1939?initial=true
This commit is contained in:
@@ -477,8 +477,8 @@ class QualityCheck(models.Model):
|
||||
if not self.report_content:
|
||||
raise UserError(_('当前质检单没有出厂检验报告,请先发布报告'))
|
||||
|
||||
if not self.part_number:
|
||||
raise UserError(_('零件图号不能为空'))
|
||||
if not self.product_id.model_name:
|
||||
raise UserError(_('产品模型名称为空'))
|
||||
|
||||
if not self.picking_id or not self.picking_id.origin:
|
||||
raise UserError(_('无法找到相关的调拨单或来源单据'))
|
||||
@@ -490,7 +490,7 @@ class QualityCheck(models.Model):
|
||||
# 准备请求数据
|
||||
payload = {
|
||||
"order_ref": order_ref,
|
||||
"part_number": self.part_number,
|
||||
"model_name": self.product_id.model_name,
|
||||
"report_file": self.report_content.decode('utf-8') if isinstance(self.report_content, bytes) else self.report_content
|
||||
}
|
||||
|
||||
@@ -541,12 +541,18 @@ class QualityCheck(models.Model):
|
||||
"""
|
||||
# 获取订单号(从调拨单的来源字段获取)
|
||||
order_ref = self.picking_id.retrospect_ref
|
||||
|
||||
if not order_ref:
|
||||
raise UserError(_('无法找到相关的调拨单或来源单据'))
|
||||
|
||||
if not self.product_id.model_name:
|
||||
raise UserError(_('产品模型名称为空'))
|
||||
|
||||
try:
|
||||
# 准备请求数据
|
||||
payload = {
|
||||
"order_ref": order_ref,
|
||||
"part_number": self.part_number
|
||||
"model_name": self.product_id.model_name
|
||||
}
|
||||
|
||||
# 将Python字典转换为JSON字符串
|
||||
|
||||
Binary file not shown.
@@ -26,4 +26,12 @@ class SfQualityPoint(models.Model):
|
||||
if self.test_type_id.name == '出厂检验报告':
|
||||
if self.measure_on != 'product':
|
||||
raise ValidationError('出厂检验报告的测量对象必须为产品')
|
||||
|
||||
@api.onchange('measure_on')
|
||||
def _onchange_measure_on(self):
|
||||
"""
|
||||
如果measure_on的值变了,则清空test_type_id的值
|
||||
"""
|
||||
if self.measure_on != 'product':
|
||||
self.test_type_id = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user