diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 2a1bfdd2..8e81d076 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError
from odoo.modules import get_resource_path
-# from OCC.Extend.DataExchange import read_step_file
-# from OCC.Extend.DataExchange import write_stl_file
+from OCC.Extend.DataExchange import read_step_file
+from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model):
diff --git a/sf_quality/models/quality_cnc_test.py b/sf_quality/models/quality_cnc_test.py
index 9d8e7ce6..0905eb05 100644
--- a/sf_quality/models/quality_cnc_test.py
+++ b/sf_quality/models/quality_cnc_test.py
@@ -30,22 +30,32 @@ class SfQualityCncTest(models.Model):
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因")
detailed_reason = fields.Text('详细原因')
+
# machining_drawings = fields.Binary(related='workorder_id.machining_drawings', string='2D加工图纸', readonly=True)
# quality_standard = fields.Binary(related='workorder_id.quality_standard', string='质检标准', readonly=True)
def submit_pass(self):
+ if self.test_results in ['返工', '报废']:
+ raise UserError(_('请重新选择【判定结果】-【检测结果】'))
self.write({'result': 'pass', 'test_results': '合格', 'state': 'done'})
self.workorder_id.write({'test_results': self.test_results})
self.workorder_id.button_finish()
def submit_fail(self):
- if not self.reason and not self.detailed_reason and not self.test_results:
+ if not self.test_results:
raise UserError(_('请填写【判定结果】里的信息'))
- else:
- self.write({'result': 'fail', 'test_results': self.test_results, 'state': 'done'})
- self.workorder_id.write(
- {'test_results': self.test_results, 'reason': self.reason, 'detailed_reason': self.detailed_reason})
- self.workorder_id.button_finish()
+ if self.test_results == '合格':
+ raise UserError(_('请重新选择【判定结果】-【检测结果】'))
+ self.write({'result': 'fail', 'test_results': self.test_results, 'state': 'done'})
+ self.workorder_id.write(
+ {'test_results': self.test_results, 'reason': self.reason, 'detailed_reason': self.detailed_reason})
+ self.workorder_id.button_finish()
+
+ @api.onchange('test_results')
+ def _onchange_test_results(self):
+ if self.test_results == '合格':
+ self.reason = False
+ self.detailed_reason = False
class SfQualityWorkOrder(models.Model):
diff --git a/sf_quality/views/quality_cnc_test_view.xml b/sf_quality/views/quality_cnc_test_view.xml
index b0aad55d..967ef585 100644
--- a/sf_quality/views/quality_cnc_test_view.xml
+++ b/sf_quality/views/quality_cnc_test_view.xml
@@ -20,8 +20,12 @@
-
-
+
+
@@ -99,9 +103,9 @@
+ attrs="{'readonly': [('state','=', 'done')],'required': [('test_results','in', ['返工','报废'])],'invisible': [('test_results','in', ['合格',False])]}"/>
+ attrs="{'readonly': [('state','=', 'done')],'required': [('reason','!=', False)],'invisible': [('test_results','in', ['合格',False])]}"/>
@@ -110,7 +114,7 @@
-
+
@@ -172,7 +176,7 @@
驾驶舱
ir.actions.act_window
quality.cnc.test
- kanban,form
+ kanban,tree,form
[]
diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py
index cb1886a1..081807a4 100644
--- a/sf_sale/models/quick_easy_order.py
+++ b/sf_sale/models/quick_easy_order.py
@@ -8,8 +8,8 @@ from datetime import datetime
import requests
from odoo import http
from odoo.http import request
-# from OCC.Extend.DataExchange import read_step_file
-# from OCC.Extend.DataExchange import write_stl_file
+from OCC.Extend.DataExchange import read_step_file
+from OCC.Extend.DataExchange import write_stl_file
from odoo import models, fields, api
from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError
diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py
index 9bd61132..4756a2c5 100644
--- a/sf_sale/models/quick_easy_order_old.py
+++ b/sf_sale/models/quick_easy_order_old.py
@@ -6,8 +6,8 @@ import os
from datetime import datetime
from stl import mesh
# from OCC.Core.GProp import GProp_GProps
-# from OCC.Extend.DataExchange import read_step_file
-# from OCC.Extend.DataExchange import write_stl_file
+from OCC.Extend.DataExchange import read_step_file
+from OCC.Extend.DataExchange import write_stl_file
from odoo.addons.sf_base.commons.common import Common
from odoo import models, fields, api
from odoo.modules import get_resource_path