mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 11:09:17 +00:00
Merge pull request #23403 from rohitwaghchaure/download-required-materials-not-working
fix: Download Required Materials not working for production plan
This commit is contained in:
@@ -159,6 +159,7 @@ frappe.ui.form.on('Production Plan', {
|
|||||||
get_sales_orders: function(frm) {
|
get_sales_orders: function(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "get_open_sales_orders",
|
method: "get_open_sales_orders",
|
||||||
|
freeze: true,
|
||||||
doc: frm.doc,
|
doc: frm.doc,
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
refresh_field("sales_orders");
|
refresh_field("sales_orders");
|
||||||
@@ -169,6 +170,7 @@ frappe.ui.form.on('Production Plan', {
|
|||||||
get_material_request: function(frm) {
|
get_material_request: function(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "get_pending_material_requests",
|
method: "get_pending_material_requests",
|
||||||
|
freeze: true,
|
||||||
doc: frm.doc,
|
doc: frm.doc,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
refresh_field('material_requests');
|
refresh_field('material_requests');
|
||||||
@@ -219,7 +221,7 @@ frappe.ui.form.on('Production Plan', {
|
|||||||
|
|
||||||
download_materials_required: function(frm) {
|
download_materials_required: function(frm) {
|
||||||
let get_template_url = 'erpnext.manufacturing.doctype.production_plan.production_plan.download_raw_materials';
|
let get_template_url = 'erpnext.manufacturing.doctype.production_plan.production_plan.download_raw_materials';
|
||||||
open_url_post(frappe.request.url, { cmd: get_template_url, production_plan: frm.doc.name });
|
open_url_post(frappe.request.url, { cmd: get_template_url, doc: frm.doc });
|
||||||
},
|
},
|
||||||
|
|
||||||
show_progress: function(frm) {
|
show_progress: function(frm) {
|
||||||
|
|||||||
@@ -422,14 +422,13 @@ class ProductionPlan(Document):
|
|||||||
msgprint(_("No material request created"))
|
msgprint(_("No material request created"))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def download_raw_materials(production_plan):
|
def download_raw_materials(doc):
|
||||||
doc = frappe.get_doc('Production Plan', production_plan)
|
|
||||||
doc.check_permission()
|
|
||||||
|
|
||||||
item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Warehouse',
|
item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Warehouse',
|
||||||
'projected Qty', 'Actual Qty']]
|
'projected Qty', 'Actual Qty']]
|
||||||
|
|
||||||
doc = doc.as_dict()
|
if isinstance(doc, string_types):
|
||||||
|
doc = frappe._dict(json.loads(doc))
|
||||||
|
|
||||||
for d in get_items_for_material_requests(doc, ignore_existing_ordered_qty=True):
|
for d in get_items_for_material_requests(doc, ignore_existing_ordered_qty=True):
|
||||||
item_list.append([d.get('item_code'), d.get('description'), d.get('stock_uom'), d.get('quantity'),
|
item_list.append([d.get('item_code'), d.get('description'), d.get('stock_uom'), d.get('quantity'),
|
||||||
d.get('warehouse'), d.get('projected_qty'), d.get('actual_qty')])
|
d.get('warehouse'), d.get('projected_qty'), d.get('actual_qty')])
|
||||||
|
|||||||
Reference in New Issue
Block a user