Merge pull request #18408 from rohitwaghchaure/not_able_to_make_material_request_for_product_bundle_from_so

fix: not able to make material request for bundle items from the sale…
This commit is contained in:
Deepesh Garg 2019-07-19 09:48:07 +05:30 committed by GitHub
commit 635dc1dfda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -509,10 +509,12 @@ def make_material_request(source_name, target_doc=None):
doc.material_request_type = "Purchase" doc.material_request_type = "Purchase"
def update_item(source, target, source_parent): def update_item(source, target, source_parent):
# qty is for packed items, because packed items don't have stock_qty field
qty = source.get("stock_qty") or source.get("qty")
target.project = source_parent.project target.project = source_parent.project
target.qty = source.stock_qty - requested_item_qty.get(source.name, 0) target.qty = qty - requested_item_qty.get(source.name, 0)
target.conversion_factor = 1 target.conversion_factor = 1
target.stock_qty = source.stock_qty - requested_item_qty.get(source.name, 0) target.stock_qty = qty - requested_item_qty.get(source.name, 0)
doc = get_mapped_doc("Sales Order", source_name, { doc = get_mapped_doc("Sales Order", source_name, {
"Sales Order": { "Sales Order": {