fix: do not fetch received items in purchase receipt
(cherry picked from commit 5bff434902)
This commit is contained in:
committed by
Mergify
parent
e947d65cb2
commit
e778d7e690
@@ -669,7 +669,7 @@ class StockController(AccountsController):
|
|||||||
self.validate_multi_currency()
|
self.validate_multi_currency()
|
||||||
self.validate_packed_items()
|
self.validate_packed_items()
|
||||||
|
|
||||||
if self.get("is_internal_supplier"):
|
if self.get("is_internal_supplier") and self.docstatus == 1:
|
||||||
self.validate_internal_transfer_qty()
|
self.validate_internal_transfer_qty()
|
||||||
else:
|
else:
|
||||||
self.validate_internal_transfer_warehouse()
|
self.validate_internal_transfer_warehouse()
|
||||||
|
|||||||
@@ -965,6 +965,9 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
|
|||||||
for tax in get_taxes_and_charges(master_doctype, target.get("taxes_and_charges")):
|
for tax in get_taxes_and_charges(master_doctype, target.get("taxes_and_charges")):
|
||||||
target.append("taxes", tax)
|
target.append("taxes", tax)
|
||||||
|
|
||||||
|
if not target.get("items"):
|
||||||
|
frappe.throw(_("All items have already been received"))
|
||||||
|
|
||||||
def update_details(source_doc, target_doc, source_parent):
|
def update_details(source_doc, target_doc, source_parent):
|
||||||
target_doc.inter_company_invoice_reference = source_doc.name
|
target_doc.inter_company_invoice_reference = source_doc.name
|
||||||
if target_doc.doctype == "Purchase Receipt":
|
if target_doc.doctype == "Purchase Receipt":
|
||||||
@@ -1020,6 +1023,10 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
|
|||||||
shipping_address_name=target_doc.shipping_address_name,
|
shipping_address_name=target_doc.shipping_address_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def update_item(source, target, source_parent):
|
||||||
|
if source_parent.doctype == "Delivery Note" and source.received_qty:
|
||||||
|
target.qty = flt(source.qty) + flt(source.returned_qty) - flt(source.received_qty)
|
||||||
|
|
||||||
doclist = get_mapped_doc(
|
doclist = get_mapped_doc(
|
||||||
doctype,
|
doctype,
|
||||||
source_name,
|
source_name,
|
||||||
@@ -1043,6 +1050,8 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
|
|||||||
"Material_request_item": "material_request_item",
|
"Material_request_item": "material_request_item",
|
||||||
},
|
},
|
||||||
"field_no_map": ["warehouse"],
|
"field_no_map": ["warehouse"],
|
||||||
|
"condition": lambda item: item.received_qty < item.qty + item.returned_qty,
|
||||||
|
"postprocess": update_item,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
target_doc,
|
target_doc,
|
||||||
|
|||||||
Reference in New Issue
Block a user