调整数据类型
This commit is contained in:
@@ -157,7 +157,7 @@ class QualityCheck(models.Model):
|
|||||||
record.total_qty = ''
|
record.total_qty = ''
|
||||||
|
|
||||||
# 检验数
|
# 检验数
|
||||||
check_qty = fields.Char('检验数', default=lambda self: self._get_default_check_qty())
|
check_qty = fields.Integer('检验数', default=lambda self: self._get_default_check_qty())
|
||||||
|
|
||||||
def _get_default_check_qty(self):
|
def _get_default_check_qty(self):
|
||||||
"""根据条件设置检验数的默认值"""
|
"""根据条件设置检验数的默认值"""
|
||||||
@@ -173,9 +173,9 @@ class QualityCheck(models.Model):
|
|||||||
def _onchange_check_qty(self):
|
def _onchange_check_qty(self):
|
||||||
"""当测试类型或测量对象变化时,更新检验数"""
|
"""当测试类型或测量对象变化时,更新检验数"""
|
||||||
if self.measure_on == 'product' and self.test_type_id.name == '出厂检验报告':
|
if self.measure_on == 'product' and self.test_type_id.name == '出厂检验报告':
|
||||||
self.check_qty = ''
|
self.check_qty = 0
|
||||||
elif self.measure_on == 'product':
|
elif self.measure_on == 'product':
|
||||||
self.check_qty = '1'
|
self.check_qty = 1
|
||||||
|
|
||||||
# 出厂检验报告编号
|
# 出厂检验报告编号
|
||||||
report_number_id = fields.Many2one('documents.document', string='出厂检验报告编号', readonly=True)
|
report_number_id = fields.Many2one('documents.document', string='出厂检验报告编号', readonly=True)
|
||||||
@@ -364,9 +364,9 @@ class QualityCheck(models.Model):
|
|||||||
raise UserError(_('请先输入检验数'))
|
raise UserError(_('请先输入检验数'))
|
||||||
if not record.total_qty:
|
if not record.total_qty:
|
||||||
raise UserError(_('总数量不能为空'))
|
raise UserError(_('总数量不能为空'))
|
||||||
if int(record.check_qty) <= int(record.total_qty):
|
if record.check_qty <= int(record.total_qty):
|
||||||
raise UserError(_('检验数不可超过总数量'))
|
raise UserError(_('检验数不可超过总数量'))
|
||||||
if int(record.column_nums) >= int(record.check_qty):
|
if record.column_nums >= record.check_qty:
|
||||||
raise UserError(_('测量件数不可超过检验数'))
|
raise UserError(_('测量件数不可超过检验数'))
|
||||||
|
|
||||||
def do_cancel_publish(self):
|
def do_cancel_publish(self):
|
||||||
|
|||||||
@@ -81,6 +81,8 @@
|
|||||||
<!-- type="action"/> -->
|
<!-- type="action"/> -->
|
||||||
<!-- <button name="do_preview" string="预览" type="object" class="btn-primary" attrs="{'invisible': [('is_out_check', '=', False)]}"/> -->
|
<!-- <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), ('publish_status', '!=', 'draft')]}"/>
|
<button name="do_publish" string="发布" type="object" class="btn-primary" attrs="{'invisible': ['|', ('is_out_check', '=', False), ('publish_status', '!=', 'draft')]}"/>
|
||||||
|
<!-- <button name="get_report_url" string="ceshi" type="object" class="btn-primary"/> -->
|
||||||
|
<!-- <button name="upload_factory_report" string="upload_factory_report" type="object" class="btn-primary"/> -->
|
||||||
<button name="do_cancel_publish" string="取消发布" type="object" class="btn-primary" attrs="{'invisible': ['|',('is_out_check', '=', False), ('publish_status', '!=', 'published')]}"/>
|
<button name="do_cancel_publish" string="取消发布" type="object" class="btn-primary" attrs="{'invisible': ['|',('is_out_check', '=', False), ('publish_status', '!=', 'published')]}"/>
|
||||||
<button name="do_re_publish" string="重新发布" type="object" class="btn-primary" attrs="{'invisible': ['|', ('is_out_check', '=', False), ('publish_status', '!=', 'canceled')]}"/>
|
<button name="do_re_publish" string="重新发布" type="object" class="btn-primary" attrs="{'invisible': ['|', ('is_out_check', '=', False), ('publish_status', '!=', 'canceled')]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
Reference in New Issue
Block a user