调整行号取值
This commit is contained in:
@@ -161,8 +161,8 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
if order.picking_ids:
|
if order.picking_ids:
|
||||||
b = 0
|
b = 0
|
||||||
for picking in order.picking_ids:
|
for picking in order.picking_ids:
|
||||||
b += 1
|
|
||||||
for move in picking.move_ids:
|
for move in picking.move_ids:
|
||||||
|
b += 1
|
||||||
vals = {
|
vals = {
|
||||||
'wizard_id': wizard_id,
|
'wizard_id': wizard_id,
|
||||||
'sequence': sequence,
|
'sequence': sequence,
|
||||||
@@ -170,7 +170,7 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'doc_name': '交货单',
|
'doc_name': '交货单',
|
||||||
'operation_type': '调拨',
|
'operation_type': '调拨',
|
||||||
'doc_number': picking.name,
|
'doc_number': picking.name,
|
||||||
'line_number': move.product_id.name.split('-')[-1] if move.product_id else '',
|
'line_number': b,
|
||||||
'product_name': f'[{move.product_id.default_code}] {move.product_id.name}' if move else '',
|
'product_name': f'[{move.product_id.default_code}] {move.product_id.name}' if move else '',
|
||||||
# 'quantity': picking.product_qty if hasattr(picking, 'product_qty') else 0,
|
# 'quantity': picking.product_qty if hasattr(picking, 'product_qty') else 0,
|
||||||
'quantity': move.product_uom_qty,
|
'quantity': move.product_uom_qty,
|
||||||
@@ -219,7 +219,7 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'doc_name': '制造订单',
|
'doc_name': '制造订单',
|
||||||
'doc_number': mo.name,
|
'doc_number': mo.name,
|
||||||
'operation_type': '',
|
'operation_type': '',
|
||||||
'line_number': mo.product_id.name.split('-')[-1] if mo.product_id else '',
|
'line_number': d,
|
||||||
'product_name': f'[{mo.product_id.default_code}] {mo.product_id.name}',
|
'product_name': f'[{mo.product_id.default_code}] {mo.product_id.name}',
|
||||||
'quantity': mo.product_qty,
|
'quantity': mo.product_qty,
|
||||||
'doc_state': map_dict.get(mo.state, mo.state),
|
'doc_state': map_dict.get(mo.state, mo.state),
|
||||||
@@ -256,15 +256,16 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
if mo.picking_ids:
|
if mo.picking_ids:
|
||||||
f = 0
|
f = 0
|
||||||
for picking in mo.picking_ids:
|
for picking in mo.picking_ids:
|
||||||
f += 1
|
|
||||||
for move in picking.move_ids:
|
for move in picking.move_ids:
|
||||||
|
f += 1
|
||||||
vals = {
|
vals = {
|
||||||
'wizard_id': wizard_id,
|
'wizard_id': wizard_id,
|
||||||
'sequence': sequence,
|
'sequence': sequence,
|
||||||
'category': '制造',
|
'category': '制造',
|
||||||
'doc_name': '库存移动',
|
'doc_name': '库存移动',
|
||||||
'doc_number': picking.name,
|
'doc_number': picking.name,
|
||||||
'line_number': move.product_id.name.split(' ')[0].split('-')[-1] if move.product_id else '',
|
'line_number': f,
|
||||||
'operation_type': picking.picking_type_id.name,
|
'operation_type': picking.picking_type_id.name,
|
||||||
'product_name': move.product_id.name if move.product_id else '',
|
'product_name': move.product_id.name if move.product_id else '',
|
||||||
'quantity': move.product_uom_qty,
|
'quantity': move.product_uom_qty,
|
||||||
@@ -285,7 +286,7 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'category': '制造',
|
'category': '制造',
|
||||||
'doc_name': '工单',
|
'doc_name': '工单',
|
||||||
'doc_number': workorder.name,
|
'doc_number': workorder.name,
|
||||||
'line_number': mo.product_id.name.split('-')[-1] if mo.product_id else '',
|
'line_number': g,
|
||||||
'operation_type': '',
|
'operation_type': '',
|
||||||
'product_name': f'[{mo.product_id.default_code}] {mo.product_id.name}',
|
'product_name': f'[{mo.product_id.default_code}] {mo.product_id.name}',
|
||||||
'quantity': workorder.qty_production,
|
'quantity': workorder.qty_production,
|
||||||
@@ -358,7 +359,7 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'doc_name': '质检单',
|
'doc_name': '质检单',
|
||||||
'operation_type': '',
|
'operation_type': '',
|
||||||
'doc_number': check.name,
|
'doc_number': check.name,
|
||||||
'line_number': check.product_id.name.split('-')[-1] if check.product_id else '',
|
'line_number': i,
|
||||||
'product_name': f'[{check.product_id.default_code}] {check.product_id.name}',
|
'product_name': f'[{check.product_id.default_code}] {check.product_id.name}',
|
||||||
'quantity': 1,
|
'quantity': 1,
|
||||||
'doc_state': map_dict.get(check.quality_state, check.quality_state),
|
'doc_state': map_dict.get(check.quality_state, check.quality_state),
|
||||||
|
|||||||
Reference in New Issue
Block a user