Merge pull request #25803 from surajshetty3416/fix-extend-cscript

This commit is contained in:
Suraj Shetty 2021-05-23 13:39:09 +05:30 committed by GitHub
commit 540c82712a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 39 additions and 35 deletions

View File

@ -151,6 +151,7 @@
"context": true,
"before": true,
"beforeEach": true,
"onScan": true
"onScan": true,
"extend_cscript": true
}
}

View File

@ -262,4 +262,4 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo
};
$.extend(cur_frm.cscript, new erpnext.accounts.PaymentReconciliationController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.accounts.PaymentReconciliationController({frm: cur_frm}));

View File

@ -135,7 +135,7 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex
}
}
$.extend(cur_frm.cscript, new erpnext.selling.POSInvoiceController({ frm: cur_frm }))
extend_cscript(cur_frm.cscript, new erpnext.selling.POSInvoiceController({ frm: cur_frm }))
frappe.ui.form.on('POS Invoice', {
redeem_loyalty_points: function(frm) {

View File

@ -451,7 +451,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
};
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_frm}));
cur_frm.cscript['Make Delivery Note'] = function() {
frappe.model.open_mapped_doc({

View File

@ -547,7 +547,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
};
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.PurchaseOrderController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.buying.PurchaseOrderController({frm: cur_frm}));
cur_frm.cscript.update_status= function(label, status){
frappe.call({

View File

@ -414,4 +414,4 @@ erpnext.buying.RequestforQuotationController = class RequestforQuotationControll
};
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.RequestforQuotationController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.buying.RequestforQuotationController({frm: cur_frm}));

View File

@ -95,7 +95,7 @@ erpnext.buying.SupplierQuotationController = class SupplierQuotationController e
};
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({frm: cur_frm}));
cur_frm.fields_dict['items'].grid.get_field('project').get_query =
function(doc, cdt, cdn) {

View File

@ -88,4 +88,4 @@ erpnext.LeadController = class LeadController extends frappe.ui.form.Controller
}
};
$.extend(cur_frm.cscript, new erpnext.LeadController({ frm: cur_frm }));
extend_cscript(cur_frm.cscript, new erpnext.LeadController({ frm: cur_frm }));

View File

@ -195,7 +195,7 @@ erpnext.crm.Opportunity = class Opportunity extends frappe.ui.form.Controller {
}
};
$.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm}));
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];

View File

@ -115,5 +115,5 @@ erpnext.maintenance.MaintenanceSchedule = class MaintenanceSchedule extends frap
}
};
$.extend(cur_frm.cscript, new erpnext.maintenance.MaintenanceSchedule({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.maintenance.MaintenanceSchedule({frm: cur_frm}));

View File

@ -99,4 +99,4 @@ erpnext.maintenance.MaintenanceVisit = class MaintenanceVisit extends frappe.ui.
}
};
$.extend(cur_frm.cscript, new erpnext.maintenance.MaintenanceVisit({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.maintenance.MaintenanceVisit({frm: cur_frm}));

View File

@ -405,7 +405,7 @@ erpnext.bom.BomController = class BomController extends erpnext.TransactionContr
}
};
$.extend(cur_frm.cscript, new erpnext.bom.BomController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.bom.BomController({frm: cur_frm}));
cur_frm.cscript.hour_rate = function(doc) {
erpnext.bom.calculate_op_cost(doc);

View File

@ -166,7 +166,9 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
"account_list": frappe.flags.round_off_applicable_accounts
},
callback(r) {
frappe.flags.round_off_applicable_accounts.push(...r.message);
if (r.message) {
frappe.flags.round_off_applicable_accounts.push(...r.message);
}
}
});
}

View File

@ -5,7 +5,7 @@ frappe.provide('erpnext.accounts.dimensions');
erpnext.TransactionController = class TransactionController extends erpnext.taxes_and_totals {
setup() {
this._super();
super.setup();
frappe.flags.hide_serial_batch_dialog = true;
frappe.ui.form.on(this.frm.doctype + " Item", "rate", function(frm, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);

View File

@ -57,4 +57,4 @@ erpnext.selling.InstallationNote = class InstallationNote extends frappe.ui.form
}
};
$.extend(cur_frm.cscript, new erpnext.selling.InstallationNote({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.selling.InstallationNote({frm: cur_frm}));

View File

@ -104,7 +104,7 @@ frappe.ui.form.on("Sales Order Item", {
erpnext.selling.SalesOrderController = class SalesOrderController extends erpnext.selling.SellingController {
onload(doc, dt, dn) {
super.onload();
super.onload(doc, dt, dn);
}
refresh(doc, dt, dn) {
@ -744,4 +744,5 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
});
}
};
$.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, {
extend_cscript(cur_frm.cscript, {
message: function () {
var total_characters = this.frm.doc.message.length;
var total_msg = 1;

View File

@ -1,7 +1,7 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, {
extend_cscript(cur_frm.cscript, {
onload: function() {
if(cur_frm.doc.__islocal) {
cur_frm.set_value("to_currency", frappe.defaults.get_global_default("currency"));

View File

@ -305,7 +305,7 @@ erpnext.stock.DeliveryNoteController = class DeliveryNoteController extends erpn
}
};
$.extend(cur_frm.cscript, new erpnext.stock.DeliveryNoteController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.stock.DeliveryNoteController({frm: cur_frm}));
frappe.ui.form.on('Delivery Note', {
setup: function(frm) {

View File

@ -472,7 +472,7 @@ erpnext.buying.MaterialRequestController = class MaterialRequestController exten
};
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.buying.MaterialRequestController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.buying.MaterialRequestController({frm: cur_frm}));
function set_schedule_date(frm) {
if(frm.doc.schedule_date){

View File

@ -251,7 +251,7 @@ erpnext.stock.PurchaseReceiptController = class PurchaseReceiptController extend
};
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm}));
cur_frm.cscript.update_status = function(status) {
frappe.ui.form.is_saving = true;

View File

@ -1064,4 +1064,4 @@ erpnext.stock.select_batch_and_serial_no = (frm, item) => {
}
$.extend(cur_frm.cscript, new erpnext.stock.StockEntry({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.stock.StockEntry({frm: cur_frm}));

View File

@ -55,7 +55,7 @@ erpnext.support.WarrantyClaim = class WarrantyClaim extends frappe.ui.form.Contr
}
};
$.extend(cur_frm.cscript, new erpnext.support.WarrantyClaim({frm: cur_frm}));
extend_cscript(cur_frm.cscript, new erpnext.support.WarrantyClaim({frm: cur_frm}));
cur_frm.fields_dict['serial_no'].get_query = function(doc, cdt, cdn) {
var cond = [];