Merge pull request #33103 from rohitwaghchaure/fixed-job-card-for-qty-ux

fix: job card "Qty to Manufacture" UX
This commit is contained in:
rohitwaghchaure 2022-11-24 19:24:05 +05:30 committed by GitHub
commit b0c8643517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -33,6 +33,11 @@ frappe.ui.form.on('Job Card', {
return;
}
let has_stock_entry = frm.doc.__onload &&
frm.doc.__onload.has_stock_entry ? true : false;
frm.toggle_enable("for_quantity", !has_stock_entry);
if (!frm.is_new() && has_items && frm.doc.docstatus < 2) {
let to_request = frm.doc.for_quantity > frm.doc.transferred_qty;
let excess_transfer_allowed = frm.doc.__onload.job_card_excess_transfer;

View File

@ -57,6 +57,10 @@ class JobCard(Document):
)
self.set_onload("job_card_excess_transfer", excess_transfer)
self.set_onload("work_order_closed", self.is_work_order_closed())
self.set_onload("has_stock_entry", self.has_stock_entry())
def has_stock_entry(self):
return frappe.db.exists("Stock Entry", {"job_card": self.name, "docstatus": ["!=", 2]})
def before_validate(self):
self.set_wip_warehouse()