完善取消订单功能
This commit is contained in:
@@ -57,6 +57,13 @@ class SFSaleOrderCancelWizard(models.TransientModel):
|
|||||||
if mo_purchase_orders:
|
if mo_purchase_orders:
|
||||||
mo_purchase_orders.write({'state': 'cancel'})
|
mo_purchase_orders.write({'state': 'cancel'})
|
||||||
|
|
||||||
|
# 取消制造订单的质检单
|
||||||
|
mo_quality_checks = self.env['quality.check'].search([
|
||||||
|
('production_id', '=', mo.id)
|
||||||
|
])
|
||||||
|
if mo_quality_checks:
|
||||||
|
mo_quality_checks.write({'state': 'cancel'})
|
||||||
|
|
||||||
# 取消制造订单
|
# 取消制造订单
|
||||||
mo.action_cancel()
|
mo.action_cancel()
|
||||||
|
|
||||||
@@ -75,6 +82,7 @@ class SFSaleOrderCancelWizard(models.TransientModel):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class SFSaleOrderCancelLine(models.TransientModel):
|
class SFSaleOrderCancelLine(models.TransientModel):
|
||||||
_name = 'sf.sale.order.cancel.line'
|
_name = 'sf.sale.order.cancel.line'
|
||||||
_description = '销售订单取消行'
|
_description = '销售订单取消行'
|
||||||
@@ -103,7 +111,9 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'pending': '等待其他工单',
|
'pending': '等待其他工单',
|
||||||
'none': '待处理',
|
'none': '待处理',
|
||||||
'draft': '报价',
|
'draft': '报价',
|
||||||
'cancel': '已取消'
|
'cancel': '已取消',
|
||||||
|
'pass': '通过的',
|
||||||
|
'fail': '失败的'
|
||||||
}
|
}
|
||||||
|
|
||||||
# 检查销售订单
|
# 检查销售订单
|
||||||
@@ -237,7 +247,8 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'product_name': mo.product_id.name,
|
'product_name': mo.product_id.name,
|
||||||
'quantity': workorder.qty_production,
|
'quantity': workorder.qty_production,
|
||||||
'doc_state': map_dict.get(workorder.state, workorder.state),
|
'doc_state': map_dict.get(workorder.state, workorder.state),
|
||||||
'cancel_reason': '已有异动' if workorder.state not in ['draft', 'cancel', 'pending', 'waiting'] else ''
|
'cancel_reason': '已有异动' if workorder.state not in ['draft', 'cancel', 'pending',
|
||||||
|
'waiting'] else ''
|
||||||
}
|
}
|
||||||
lines.append(self.create(vals))
|
lines.append(self.create(vals))
|
||||||
sequence += 1
|
sequence += 1
|
||||||
|
|||||||
Reference in New Issue
Block a user