22 lines
843 B
Python
22 lines
843 B
Python
from odoo import api, models
|
||
|
||
|
||
class StockPicking(models.Model):
|
||
_inherit = 'stock.picking'
|
||
|
||
def button_validate(self):
|
||
"""
|
||
调拨单若关联了质量检查单,验证调拨单时,应校验是否有不合格品,若存在,应弹窗提示:
|
||
“警告:存在不合格产品XXXX n 件、YYYYY m件,继续调拨请点“确认”,否则请取消?”
|
||
"""
|
||
if self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail'):
|
||
return {
|
||
'type': 'ir.actions.act_window',
|
||
'res_model': 'sf.functional.tool.assembly.order',
|
||
'name': ' ',
|
||
'view_mode': 'form',
|
||
'target': 'new',
|
||
'context': {'': True}
|
||
}
|
||
return super(StockPicking, self).button_validate()
|