Accept Merge Request #2138: (feature/6694 -> develop)
Merge Request: 修改欠单逻辑 Created By: @胡尧 Accepted By: @胡尧 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2138?initial=true
This commit is contained in:
@@ -19,7 +19,11 @@ class PurchaseOrder(models.Model):
|
|||||||
def button_confirm(self):
|
def button_confirm(self):
|
||||||
res = super(PurchaseOrder, self).button_confirm()
|
res = super(PurchaseOrder, self).button_confirm()
|
||||||
# 取消反向调拨单
|
# 取消反向调拨单
|
||||||
reverse_move_ids = self.env['stock.move'].search([('origin', '=', self.name), ('purchase_line_id', '=', False)])
|
reverse_move_ids = self.env['stock.move'].search([
|
||||||
|
('origin', '=', self.name),
|
||||||
|
('purchase_line_id', '=', False),
|
||||||
|
('state', '!=', 'done')
|
||||||
|
])
|
||||||
if reverse_move_ids:
|
if reverse_move_ids:
|
||||||
reverse_move_ids.picking_id.action_cancel()
|
reverse_move_ids.picking_id.action_cancel()
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -36,10 +36,12 @@ class StockPicking(models.Model):
|
|||||||
|
|
||||||
def _action_done(self):
|
def _action_done(self):
|
||||||
res = super(StockPicking, self)._action_done()
|
res = super(StockPicking, self)._action_done()
|
||||||
# 将采购申请明细行的move_dest_ids设置为backorder_ids
|
# 将新产生的backorder对应上原来的采购申请明细行
|
||||||
backorder_ids = self.backorder_ids
|
backorder_ids = self.backorder_ids
|
||||||
if backorder_ids:
|
if backorder_ids:
|
||||||
purchase_request_lines = self.move_ids.move_orig_ids.purchase_line_id.purchase_request_lines
|
purchase_request_lines = self.move_ids.move_orig_ids.purchase_line_id.purchase_request_lines
|
||||||
if purchase_request_lines:
|
if purchase_request_lines:
|
||||||
purchase_request_lines.move_dest_ids = [(4, x.id) for x in backorder_ids.move_ids]
|
purchase_request_lines.move_dest_ids = [
|
||||||
|
(4, x.id) for x in backorder_ids.move_ids if x.product_id.id == purchase_request_lines.product_id.id
|
||||||
|
]
|
||||||
return res
|
return res
|
||||||
Reference in New Issue
Block a user