Skip to content

Commit

Permalink
fix: fields required in after mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninad1306 committed Oct 10, 2024
1 parent bc38c52 commit ce603a3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions erpnext/controllers/subcontracting_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,17 @@ def add_items_in_ste(ste_doc, row, qty, rm_details, rm_detail_field="sco_rm_deta
def make_return_stock_entry_for_subcontract(
available_materials, order_doc, rm_details, order_doctype="Subcontracting Order"
):
def post_process(source_doc, target_doc):
target_doc.purpose = "Material Transfer"

if source_doc.doctype == "Purchase Order":
target_doc.purchase_order = source_doc.name
else:
target_doc.subcontracting_order = source_doc.name

target_doc.company = source_doc.company
target_doc.is_return = 1

ste_doc = get_mapped_doc(
order_doctype,
order_doc.name,
Expand All @@ -1219,18 +1230,13 @@ def make_return_stock_entry_for_subcontract(
},
},
ignore_child_tables=True,
postprocess=post_process,
)

ste_doc.purpose = "Material Transfer"

if order_doctype == "Purchase Order":
ste_doc.purchase_order = order_doc.name
rm_detail_field = "po_detail"
else:
ste_doc.subcontracting_order = order_doc.name
rm_detail_field = "sco_rm_detail"
ste_doc.company = order_doc.company
ste_doc.is_return = 1

for _key, value in available_materials.items():
if not value.qty:
Expand Down

0 comments on commit ce603a3

Please sign in to comment.