feat: Confirmation to submit material request against Production Plan (#18062)
* feat: Confirmation to submit material request against Production Plan * fix: Test cases for production plan * fix: Test Cases for production plan
This commit is contained in:
parent
f5aff98589
commit
dbe9a41389
@ -126,6 +126,20 @@ frappe.ui.form.on('Production Plan', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
make_material_request: function(frm) {
|
make_material_request: function(frm) {
|
||||||
|
|
||||||
|
frappe.confirm(__("Do you want to submit the material request"),
|
||||||
|
function() {
|
||||||
|
frm.events.create_material_request(frm, 1);
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
frm.events.create_material_request(frm, 0);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
create_material_request: function(frm, submit) {
|
||||||
|
frm.doc.submit_material_request = submit;
|
||||||
|
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "make_material_request",
|
method: "make_material_request",
|
||||||
freeze: true,
|
freeze: true,
|
||||||
|
@ -395,7 +395,11 @@ class ProductionPlan(Document):
|
|||||||
# submit
|
# submit
|
||||||
material_request.flags.ignore_permissions = 1
|
material_request.flags.ignore_permissions = 1
|
||||||
material_request.run_method("set_missing_values")
|
material_request.run_method("set_missing_values")
|
||||||
material_request.submit()
|
|
||||||
|
if self.get('submit_material_request'):
|
||||||
|
material_request.submit()
|
||||||
|
else:
|
||||||
|
material_request.save()
|
||||||
|
|
||||||
frappe.flags.mute_messages = False
|
frappe.flags.mute_messages = False
|
||||||
|
|
||||||
|
@ -51,7 +51,8 @@ class TestProductionPlan(unittest.TestCase):
|
|||||||
|
|
||||||
for name in material_requests:
|
for name in material_requests:
|
||||||
mr = frappe.get_doc('Material Request', name[0])
|
mr = frappe.get_doc('Material Request', name[0])
|
||||||
mr.cancel()
|
if mr.docstatus != 0:
|
||||||
|
mr.cancel()
|
||||||
|
|
||||||
for name in work_orders:
|
for name in work_orders:
|
||||||
mr = frappe.delete_doc('Work Order', name[0])
|
mr = frappe.delete_doc('Work Order', name[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user