调整单据状态
This commit is contained in:
@@ -232,11 +232,9 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
}
|
}
|
||||||
lines.append(self.create(vals))
|
lines.append(self.create(vals))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 检查销售订单直接关联的采购单
|
# 检查销售订单直接关联的采购单
|
||||||
purchase_orders = self.env['purchase.order'].search([
|
purchase_orders = self.env['purchase.order'].search([
|
||||||
('origin', '=', order.name)
|
('origin', 'like', f'%{order.name}%')
|
||||||
])
|
])
|
||||||
if purchase_orders:
|
if purchase_orders:
|
||||||
c = 0
|
c = 0
|
||||||
@@ -280,7 +278,7 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'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,
|
||||||
'doc_state': map_dict.get(pkd.state, pkd.state),
|
'doc_state': map_dict.get(pkd.state, pkd.state),
|
||||||
'cancel_reason': '已有异动' if pkd.state not in ['draft', 'cancel'] else ''
|
'cancel_reason': '已有异动' if pkd.state not in ['waiting', 'cancel', 'confirmed'] else ''
|
||||||
}
|
}
|
||||||
lines.append(self.create(vals))
|
lines.append(self.create(vals))
|
||||||
|
|
||||||
@@ -302,8 +300,8 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'product_name': child_move.product_id.name if child_move.product_id else '',
|
'product_name': child_move.product_id.name if child_move.product_id else '',
|
||||||
'quantity': child_move.product_uom_qty,
|
'quantity': child_move.product_uom_qty,
|
||||||
'doc_state': map_dict.get(child_pkd.state, child_pkd.state),
|
'doc_state': map_dict.get(child_pkd.state, child_pkd.state),
|
||||||
'cancel_reason': '已有异动' if child_pkd.state not in ['draft',
|
'cancel_reason': '已有异动' if child_pkd.state not in ['waiting',
|
||||||
'cancel'] else ''
|
'cancel', 'confirmed'] else ''
|
||||||
}
|
}
|
||||||
lines.append(self.create(vals))
|
lines.append(self.create(vals))
|
||||||
|
|
||||||
@@ -336,7 +334,7 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
|
|
||||||
# 检查制造订单关联的采购单
|
# 检查制造订单关联的采购单
|
||||||
purchase_orders = self.env['purchase.order'].search([
|
purchase_orders = self.env['purchase.order'].search([
|
||||||
('origin', '=', mo.name)
|
('origin', 'like', f'%{mo.name}%')
|
||||||
])
|
])
|
||||||
if purchase_orders:
|
if purchase_orders:
|
||||||
e = 0
|
e = 0
|
||||||
@@ -516,7 +514,7 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'operation_type': '',
|
'operation_type': '',
|
||||||
'doc_number': comp_mo.name,
|
'doc_number': comp_mo.name,
|
||||||
'line_number': h,
|
'line_number': h,
|
||||||
'product_name': move.product_id.name,
|
'product_name': f'[{comp_mo.product_id.default_code}] {comp_mo.product_id.name}',
|
||||||
'quantity': comp_mo.product_qty,
|
'quantity': comp_mo.product_qty,
|
||||||
'doc_state': map_dict.get(comp_mo.state, comp_mo.state),
|
'doc_state': map_dict.get(comp_mo.state, comp_mo.state),
|
||||||
'cancel_reason': '已有异动' if comp_mo.state not in ['technology_to_confirmed',
|
'cancel_reason': '已有异动' if comp_mo.state not in ['technology_to_confirmed',
|
||||||
@@ -540,7 +538,7 @@ class SFSaleOrderCancelLine(models.TransientModel):
|
|||||||
'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,
|
||||||
'doc_state': map_dict.get(pinking_id.state, pinking_id.state),
|
'doc_state': map_dict.get(pinking_id.state, pinking_id.state),
|
||||||
'cancel_reason': '已有异动' if pinking_id.state not in ['cancel', 'waiting'] else ''
|
'cancel_reason': '已有异动' if pinking_id.state not in ['cancel', 'waiting', 'assigned'] else ''
|
||||||
}
|
}
|
||||||
lines.append(self.create(vals))
|
lines.append(self.create(vals))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user