sf-质量检查-上传报告校验必填,及上传时检查图号跟产品的零件图号是否一致
This commit is contained in:
@@ -258,6 +258,23 @@ class QualityCheck(models.Model):
|
||||
line[field_name] = False
|
||||
self.column_nums = self.column_nums - 1
|
||||
|
||||
def upload_measure_line(self):
|
||||
"""
|
||||
上传测量值
|
||||
"""
|
||||
|
||||
for record in self:
|
||||
if not record.part_name or not record.part_number:
|
||||
raise UserError(_('零件名称和零件图号均不能为空'))
|
||||
|
||||
# 如果验证通过,返回原动作
|
||||
action = self.env.ref('quality_control.import_complex_model_wizard').read()[0]
|
||||
action['context'] = {
|
||||
'default_model_name': 'quality.check.measure.line',
|
||||
'default_check_id': self.id,
|
||||
}
|
||||
return action
|
||||
|
||||
def do_preview(self):
|
||||
"""
|
||||
预览出厂检验报告
|
||||
|
||||
@@ -334,11 +334,15 @@
|
||||
<div class="o_row">
|
||||
<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"
|
||||
<!-- <button name="%(quality_control.import_complex_model_wizard)d" string="上传111" -->
|
||||
<!-- type="action" -->
|
||||
<!-- class="btn-primary" -->
|
||||
<!-- attrs="{'force_show':1, 'invisible': [('publish_status', '=', 'published')]}" -->
|
||||
<!-- context="{'default_model_name': 'quality.check.measure.line', 'default_check_id': id}"/> -->
|
||||
<button name="upload_measure_line" string="上传"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
attrs="{'force_show':1, 'invisible': [('publish_status', '=', 'published')]}"
|
||||
context="{'default_model_name': 'quality.check.measure.line', 'default_check_id': id}"/>
|
||||
attrs="{'force_show':1, 'invisible': [('publish_status', '=', 'published')]}"/>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="o_row">
|
||||
|
||||
@@ -161,6 +161,17 @@ class ImportComplexModelWizard(models.TransientModel):
|
||||
|
||||
# 从第二行开始读取数据(跳过表头)
|
||||
max_columns = 1
|
||||
for row_index in range(1, sheet.nrows):
|
||||
row = sheet.row_values(row_index)
|
||||
# 检查行是否有数据
|
||||
if not any(row):
|
||||
continue
|
||||
|
||||
if row[2] == '':
|
||||
continue
|
||||
if row[1] != quality_check.part_number:
|
||||
print(sheet.row_values(row_index))
|
||||
raise UserError(_('上传内容图号错误,请修改'))
|
||||
for row_index in range(1, sheet.nrows):
|
||||
row = sheet.row_values(row_index)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user