fix: javascript: execution blocked by undefined route options (#33405)

Some implementations of DocField.get_route_options_for_new_doc() returned no value instead of an empty object in some cases, which caused a JavaScript error.
This commit is contained in:
Marc de Lima Lucio 2023-01-02 04:48:25 +01:00 committed by GitHub
parent d054f37602
commit 3c393bfdc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,7 @@ frappe.ui.form.on("Project", {
onload: function (frm) {
const so = frm.get_docfield("sales_order");
so.get_route_options_for_new_doc = () => {
if (frm.is_new()) return;
if (frm.is_new()) return {};
return {
"customer": frm.doc.customer,
"project_name": frm.doc.name

View File

@ -272,7 +272,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
let quality_inspection_field = this.frm.get_docfield("items", "quality_inspection");
quality_inspection_field.get_route_options_for_new_doc = function(row) {
if(me.frm.is_new()) return;
if(me.frm.is_new()) return {};
return {
"inspection_type": inspection_type,
"reference_type": me.frm.doc.doctype,

View File

@ -133,7 +133,7 @@ frappe.ui.form.on('Stock Entry', {
let quality_inspection_field = frm.get_docfield("items", "quality_inspection");
quality_inspection_field.get_route_options_for_new_doc = function(row) {
if (frm.is_new()) return;
if (frm.is_new()) return {};
return {
"inspection_type": "Incoming",
"reference_type": frm.doc.doctype,