Accept Merge Request #1870: (feature/制造功能优化 -> develop)
Merge Request: 补全单据 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1870?initial=true
This commit is contained in:
@@ -285,6 +285,53 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
lines.append(self.create(vals))
|
lines.append(self.create(vals))
|
||||||
sequence += 1
|
sequence += 1
|
||||||
|
|
||||||
|
# 制造询价单的入库单
|
||||||
|
for pod in purchase_orders:
|
||||||
|
pkds = self.env['stock.picking'].search([
|
||||||
|
('origin', '=', pod.name)
|
||||||
|
])
|
||||||
|
if pkds:
|
||||||
|
for pkd in pkds:
|
||||||
|
x1 = 0
|
||||||
|
for move in pkd.move_ids:
|
||||||
|
x1 += 1
|
||||||
|
vals = {
|
||||||
|
'wizard_id': wizard_id,
|
||||||
|
'sequence': sequence,
|
||||||
|
'category': '坯料收货',
|
||||||
|
'doc_name': '库存移动',
|
||||||
|
'doc_number': pkd.name,
|
||||||
|
'line_number': x1,
|
||||||
|
'operation_type': pkd.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(pkd.state, pkd.state),
|
||||||
|
'cancel_reason': '已有异动' if pkd.state not in ['draft', 'cancel'] else ''
|
||||||
|
}
|
||||||
|
lines.append(self.create(vals))
|
||||||
|
|
||||||
|
#
|
||||||
|
for child_pkd in self.env['stock.picking'].search([
|
||||||
|
('origin', '=', pkd.name)
|
||||||
|
]):
|
||||||
|
x2 = 0
|
||||||
|
for child_move in child_pkd.move_ids:
|
||||||
|
x2 += 1
|
||||||
|
vals = {
|
||||||
|
'wizard_id': wizard_id,
|
||||||
|
'sequence': sequence,
|
||||||
|
'category': '坯料外协',
|
||||||
|
'doc_name': '库存移动',
|
||||||
|
'doc_number': child_pkd.name,
|
||||||
|
'line_number': x1,
|
||||||
|
'operation_type': child_pkd.picking_type_id.name,
|
||||||
|
'product_name': child_move.product_id.name if child_move.product_id else '',
|
||||||
|
'quantity': child_move.product_uom_qty,
|
||||||
|
'doc_state': map_dict.get(child_pkd.state, child_pkd.state),
|
||||||
|
'cancel_reason': '已有异动' if child_pkd.state not in ['draft', 'cancel'] else ''
|
||||||
|
}
|
||||||
|
lines.append(self.create(vals))
|
||||||
|
|
||||||
# 检查制造订单的领料单
|
# 检查制造订单的领料单
|
||||||
|
|
||||||
if mo.picking_ids and flag:
|
if mo.picking_ids and flag:
|
||||||
@@ -382,27 +429,46 @@ 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
|
||||||
for comp_mo in component_mos:
|
if component_mos:
|
||||||
h += 1
|
for comp_mo in component_mos:
|
||||||
vals = {
|
h += 1
|
||||||
'wizard_id': wizard_id,
|
vals = {
|
||||||
'sequence': sequence,
|
'wizard_id': wizard_id,
|
||||||
'category': '制造',
|
'sequence': sequence,
|
||||||
'doc_name': '组件制造单',
|
'category': '制造',
|
||||||
'operation_type': '',
|
'doc_name': '组件制造单',
|
||||||
'doc_number': comp_mo.name,
|
'operation_type': '',
|
||||||
'line_number': h,
|
'doc_number': comp_mo.name,
|
||||||
'product_name': move.product_id.name,
|
'line_number': h,
|
||||||
'quantity': comp_mo.product_qty,
|
'product_name': move.product_id.name,
|
||||||
'doc_state': map_dict.get(comp_mo.state, comp_mo.state),
|
'quantity': comp_mo.product_qty,
|
||||||
'cancel_reason': '已有异动' if comp_mo.state not in ['technology_to_confirmed', 'cancel'] else ''
|
'doc_state': map_dict.get(comp_mo.state, comp_mo.state),
|
||||||
}
|
'cancel_reason': '已有异动' if comp_mo.state not in ['technology_to_confirmed',
|
||||||
lines.append(self.create(vals))
|
'cancel'] else ''
|
||||||
sequence += 1
|
}
|
||||||
|
lines.append(self.create(vals))
|
||||||
|
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([
|
||||||
|
|||||||
Reference in New Issue
Block a user