补全单据
This commit is contained in:
@@ -382,10 +382,9 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
|
|
||||||
# 检查组件的制造单
|
# 检查组件的制造单
|
||||||
component_mos = self.env['mrp.production'].search([
|
component_mos = self.env['mrp.production'].search([
|
||||||
('origin', '=', mo.name),
|
('origin', '=', mo.name)])
|
||||||
('product_id', '=', move.product_id.id)
|
|
||||||
])
|
|
||||||
h = 0
|
h = 0
|
||||||
|
if component_mos:
|
||||||
for comp_mo in component_mos:
|
for comp_mo in component_mos:
|
||||||
h += 1
|
h += 1
|
||||||
vals = {
|
vals = {
|
||||||
@@ -404,6 +403,26 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
lines.append(self.create(vals))
|
lines.append(self.create(vals))
|
||||||
sequence += 1
|
sequence += 1
|
||||||
|
|
||||||
|
for pinking_id in comp_mo.picking_ids:
|
||||||
|
y = 0
|
||||||
|
for move in pinking_id.move_ids:
|
||||||
|
y += 1
|
||||||
|
vals = {
|
||||||
|
'wizard_id': wizard_id,
|
||||||
|
'sequence': sequence,
|
||||||
|
'category': '子制造调拨',
|
||||||
|
'doc_name': '库存移动',
|
||||||
|
'doc_number': f'{comp_mo.name}-{pinking_id.name}',
|
||||||
|
'line_number': y,
|
||||||
|
'operation_type': pinking_id.picking_type_id.name,
|
||||||
|
'product_name': move.product_id.name if move.product_id else '',
|
||||||
|
'quantity': move.product_uom_qty,
|
||||||
|
'doc_state': map_dict.get(pinking_id.state, pinking_id.state),
|
||||||
|
'cancel_reason': '已有异动' if pinking_id.state not in ['cancel', 'waiting'] else ''
|
||||||
|
}
|
||||||
|
lines.append(self.create(vals))
|
||||||
|
|
||||||
|
|
||||||
# 检查制造订单的质检单
|
# 检查制造订单的质检单
|
||||||
quality_checks = self.env['quality.check'].search([
|
quality_checks = self.env['quality.check'].search([
|
||||||
('production_id', '=', mo.id)
|
('production_id', '=', mo.id)
|
||||||
|
|||||||
Reference in New Issue
Block a user