feat: Apply Putaway Rules within transaction itself
- Added checkbox 'Apply Putaway Rule' in PR and SE - Added link to rule in child tables - Rule is applied on Save - Validation for over receipt - Apply Rule on Stock Entry as well for Material Transfer and Receipt
This commit is contained in:
@@ -524,3 +524,26 @@ erpnext.buying.get_items_from_product_bundle = function(frm) {
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
erpnext.apply_putaway_rule = (frm) => {
|
||||
if (!frm.doc.company) {
|
||||
frappe.throw({message:__("Please select a Company first."), title: __("Mandatory")})
|
||||
}
|
||||
if (!frm.doc.items.length) return;
|
||||
|
||||
frappe.call({
|
||||
method: "erpnext.stock.doctype.putaway_rule.putaway_rule.apply_putaway_rule",
|
||||
args: {
|
||||
items: frm.doc.items,
|
||||
company: frm.doc.company
|
||||
},
|
||||
callback: (result) => {
|
||||
if(!result.exc) {
|
||||
if(result.message) {
|
||||
frm.doc.items = result.message;
|
||||
frm.get_field("items").refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user