[Fix] PO status not changed as material return created against them (#6869)
This commit is contained in:
parent
e0ab64d6cc
commit
b3ba7f01ef
@ -207,6 +207,7 @@ def make_return_doc(doctype, source_name, target_doc=None):
|
||||
target_doc.rejected_qty = -1* source_doc.rejected_qty
|
||||
target_doc.qty = -1* source_doc.qty
|
||||
target_doc.purchase_order = source_doc.purchase_order
|
||||
target_doc.purchase_order_item = source_doc.purchase_order_item
|
||||
target_doc.rejected_warehouse = source_doc.rejected_warehouse
|
||||
elif doctype == "Purchase Invoice":
|
||||
target_doc.received_qty = -1* source_doc.received_qty
|
||||
|
@ -346,4 +346,5 @@ execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where pur
|
||||
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
|
||||
erpnext.patches.v7_1.add_account_user_role_for_timesheet
|
||||
erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
|
||||
erpnext.patches.v7_1.update_invoice_status
|
||||
erpnext.patches.v7_1.update_invoice_status
|
||||
erpnext.patches.v7_0.po_status_issue_for_pr_return
|
36
erpnext/patches/v7_0/po_status_issue_for_pr_return.py
Normal file
36
erpnext/patches/v7_0/po_status_issue_for_pr_return.py
Normal file
@ -0,0 +1,36 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
parent_list = []
|
||||
count = 0
|
||||
for data in frappe.db.sql("""
|
||||
select
|
||||
`tabPurchase Receipt Item`.purchase_order, `tabPurchase Receipt Item`.name,
|
||||
`tabPurchase Receipt Item`.item_code, `tabPurchase Receipt Item`.idx,
|
||||
`tabPurchase Receipt Item`.parent
|
||||
from
|
||||
`tabPurchase Receipt Item`, `tabPurchase Receipt`
|
||||
where
|
||||
`tabPurchase Receipt Item`.parent = `tabPurchase Receipt`.name and
|
||||
`tabPurchase Receipt Item`.purchase_order_item is null and
|
||||
`tabPurchase Receipt Item`.purchase_order is not null and
|
||||
`tabPurchase Receipt`.is_return = 1""", as_dict=1):
|
||||
name = frappe.db.get_value('Purchase Order Item',
|
||||
{'item_code': data.item_code, 'parent': data.purchase_order, 'idx': data.idx}, 'name')
|
||||
|
||||
if name:
|
||||
frappe.db.set_value('Purchase Receipt Item', data.name, 'purchase_order_item', name, update_modified=False)
|
||||
parent_list.append(data.parent)
|
||||
|
||||
count +=1
|
||||
if count % 200 == 0:
|
||||
frappe.db.commit()
|
||||
|
||||
if len(parent_list) > 0:
|
||||
for parent in set(parent_list):
|
||||
doc = frappe.get_doc('Purchase Receipt', parent)
|
||||
doc.update_qty(update_modified=False)
|
Loading…
x
Reference in New Issue
Block a user