fix: Move ledger display to dialog

This commit is contained in:
Deepesh Garg 2023-06-21 17:15:46 +05:30
parent 011ac131cf
commit ed76ee3e16
2 changed files with 34 additions and 33 deletions

View File

@ -211,12 +211,7 @@
"is_discounted",
"remarks",
"repost_required",
"connections_tab",
"ledger_preview",
"accounting_ledger_section",
"accounting_ledger_preview_html",
"stock_ledger_section",
"stock_ledger_preview_html"
"connections_tab"
],
"fields": [
{
@ -2147,29 +2142,6 @@
"fieldname": "use_company_roundoff_cost_center",
"fieldtype": "Check",
"label": "Use Company default Cost Center for Round off"
},
{
"fieldname": "ledger_preview",
"fieldtype": "Tab Break",
"label": "Ledger Preview"
},
{
"fieldname": "accounting_ledger_section",
"fieldtype": "Section Break",
"label": "Accounting Ledger"
},
{
"fieldname": "accounting_ledger_preview_html",
"fieldtype": "HTML"
},
{
"fieldname": "stock_ledger_section",
"fieldtype": "Section Break",
"label": "Stock Ledger"
},
{
"fieldname": "stock_ledger_preview_html",
"fieldtype": "HTML"
}
],
"icon": "fa fa-file-text",
@ -2182,7 +2154,7 @@
"link_fieldname": "consolidated_invoice"
}
],
"modified": "2023-06-11 11:18:14.024258",
"modified": "2023-06-21 16:02:18.988799",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@ -94,15 +94,44 @@ erpnext.stock.StockController = class StockController extends frappe.ui.form.Con
"docname": me.frm.doc.name
},
"callback": function(response) {
me.get_datatable(response.message.gl_columns, response.message.gl_data, me.frm.get_field("accounting_ledger_preview_html").wrapper);
me.get_datatable(response.message.sl_columns, response.message.sl_data, me.frm.get_field("stock_ledger_preview_html").wrapper);
me.frm.scroll_to_field("accounting_ledger_preview_html");
me.make_dialog(response.message);
}
})
}, __("View"));
}
}
make_dialog(data) {
let me = this;
let gl_columns = data.gl_columns;
let gl_data = data.gl_data;
let sl_columns = data.sl_columns;
let sl_data = data.sl_data;
let dialog = new frappe.ui.Dialog({
"size": "extra-large",
"title": __("Ledger Preview"),
"fields": [
{
"fieldtype": "HTML",
"fieldname": "accounting_ledger_preview_html",
"label": __("Accounting Ledger"),
},
{
"fieldtype": "HTML",
"fieldname": "stock_ledger_preview_html",
"label": __("Stock Ledger"),
}
]
});
setTimeout(function() {
me.get_datatable(gl_columns, gl_data, dialog.get_field("accounting_ledger_preview_html").wrapper);
}, 200);
dialog.show();
}
get_datatable(columns, data, wrapper) {
const datatable_options = {
columns: columns,