Merge pull request #48611 from rohitwaghchaure/fixed-job-card-stock-entry

fix: confirmation dialog for submitting the stock entry
This commit is contained in:
rohitwaghchaure
2025-07-15 18:12:10 +05:30
committed by GitHub
3 changed files with 26 additions and 13 deletions

View File

@@ -48,24 +48,37 @@ frappe.ui.form.on("Job Card", {
frm.doc.track_semi_finished_goods &&
frm.doc.docstatus === 1 &&
!frm.doc.is_subcontracted &&
(frm.doc.skip_material_transfer || frm.doc.transferred_qty > 0) &&
flt(frm.doc.for_quantity) + flt(frm.doc.process_loss_qty) > flt(frm.doc.manufactured_qty)
) {
frm.add_custom_button(__("Make Stock Entry"), () => {
frm.call({
method: "make_stock_entry_for_semi_fg_item",
args: {
auto_submit: 1,
frappe.confirm(
__("Do you want to submit the stock entry?"),
() => {
frm.events.make_manufacture_stock_entry(frm, 1);
},
doc: frm.doc,
freeze: true,
callback() {
frm.reload_doc();
},
});
() => {
frm.events.make_manufacture_stock_entry(frm, 0);
}
);
}).addClass("btn-primary");
}
},
make_manufacture_stock_entry(frm, submit_entry) {
frm.call({
method: "make_stock_entry_for_semi_fg_item",
args: {
auto_submit: submit_entry,
},
doc: frm.doc,
freeze: true,
callback() {
frm.reload_doc();
},
});
},
refresh: function (frm) {
frm.trigger("setup_stock_entry");

View File

@@ -440,6 +440,9 @@ class WorkOrder(Document):
"""Update **Manufactured Qty** and **Material Transferred for Qty** in Work Order
based on Stock Entry"""
if self.track_semi_finished_goods:
return
allowance_percentage = flt(
frappe.db.get_single_value("Manufacturing Settings", "overproduction_percentage_for_work_order")
)

View File

@@ -1727,9 +1727,6 @@ class StockEntry(StockController):
else:
job_doc.set_manufactured_qty()
if self.job_card and frappe.get_cached_value("Job Card", self.job_card, "finished_good"):
return
if self.work_order:
pro_doc = frappe.get_doc("Work Order", self.work_order)
_validate_work_order(pro_doc)