Skip to content

Commit

Permalink
fix: set fg-itm-qty based on qty instead of the other way round i…
Browse files Browse the repository at this point in the history
…n Subcontracting POs (backport #38842) (#38855)

fix: set `fg-itm-qty` based on `qty` instead of the other way round

(cherry picked from commit a99d0a6)

Co-authored-by: Gughan Ravikumar <gughanrk@gmail.com>
  • Loading branch information
mergify[bot] and SvbZ3r0 authored Dec 20, 2023
1 parent d65be69 commit 4e27174
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions erpnext/buying/doctype/purchase_order/purchase_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ frappe.ui.form.on("Purchase Order Item", {
}
},

fg_item_qty: async function(frm, cdt, cdn) {
qty: async function (frm, cdt, cdn) {
if (frm.doc.is_subcontracted && !frm.doc.is_old_subcontracting_flow) {
var row = locals[cdt][cdn];

if (row.fg_item) {
var result = await frm.events.get_subcontracting_boms_for_finished_goods(row.fg_item)

if (result.message && row.item_code == result.message.service_item && row.uom == result.message.service_item_uom) {
frappe.model.set_value(cdt, cdn, "qty", flt(row.fg_item_qty) * flt(result.message.conversion_factor));
frappe.model.set_value(cdt, cdn, "fg_item_qty", flt(row.qty) / flt(result.message.conversion_factor));
}
}
}
Expand Down

0 comments on commit 4e27174

Please sign in to comment.