fix: Use extend_cscript function to properly extend class methods to cscript
This commit is contained in:
parent
94a52c0e17
commit
81d49e9c71
@ -151,6 +151,7 @@
|
|||||||
"context": true,
|
"context": true,
|
||||||
"before": true,
|
"before": true,
|
||||||
"beforeEach": true,
|
"beforeEach": true,
|
||||||
"onScan": true
|
"onScan": true,
|
||||||
|
"extend_cscript": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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}));
|
||||||
|
@ -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', {
|
frappe.ui.form.on('POS Invoice', {
|
||||||
redeem_loyalty_points: function(frm) {
|
redeem_loyalty_points: function(frm) {
|
||||||
|
@ -450,8 +450,11 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('innn')
|
||||||
// for backward compatibility: combine new and previous states
|
// for backward compatibility: combine new and previous states
|
||||||
$.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_frm}));
|
let controller_instance = new erpnext.accounts.SalesInvoiceController({frm: cur_frm})
|
||||||
|
extend_cscript(cur_frm.cscript, controller_instance);
|
||||||
|
extend_cscript(cur_frm.cscript.__proto_, controller_instance.__proto__);
|
||||||
|
|
||||||
cur_frm.cscript['Make Delivery Note'] = function() {
|
cur_frm.cscript['Make Delivery Note'] = function() {
|
||||||
frappe.model.open_mapped_doc({
|
frappe.model.open_mapped_doc({
|
||||||
|
@ -547,7 +547,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
|
|||||||
};
|
};
|
||||||
|
|
||||||
// for backward compatibility: combine new and previous states
|
// 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){
|
cur_frm.cscript.update_status= function(label, status){
|
||||||
frappe.call({
|
frappe.call({
|
||||||
|
@ -414,4 +414,4 @@ erpnext.buying.RequestforQuotationController = class RequestforQuotationControll
|
|||||||
};
|
};
|
||||||
|
|
||||||
// for backward compatibility: combine new and previous states
|
// 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}));
|
||||||
|
@ -95,7 +95,7 @@ erpnext.buying.SupplierQuotationController = class SupplierQuotationController e
|
|||||||
};
|
};
|
||||||
|
|
||||||
// for backward compatibility: combine new and previous states
|
// 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 =
|
cur_frm.fields_dict['items'].grid.get_field('project').get_query =
|
||||||
function(doc, cdt, cdn) {
|
function(doc, cdt, cdn) {
|
||||||
|
@ -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 }));
|
||||||
|
@ -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) {
|
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
|
@ -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}));
|
||||||
|
|
||||||
|
@ -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}));
|
||||||
|
@ -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) {
|
cur_frm.cscript.hour_rate = function(doc) {
|
||||||
erpnext.bom.calculate_op_cost(doc);
|
erpnext.bom.calculate_op_cost(doc);
|
||||||
|
@ -166,7 +166,9 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
"account_list": frappe.flags.round_off_applicable_accounts
|
"account_list": frappe.flags.round_off_applicable_accounts
|
||||||
},
|
},
|
||||||
callback(r) {
|
callback(r) {
|
||||||
frappe.flags.round_off_applicable_accounts.push(...r.message);
|
if (r.message) {
|
||||||
|
frappe.flags.round_off_applicable_accounts.push(...r.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ frappe.provide('erpnext.accounts.dimensions');
|
|||||||
|
|
||||||
erpnext.TransactionController = class TransactionController extends erpnext.taxes_and_totals {
|
erpnext.TransactionController = class TransactionController extends erpnext.taxes_and_totals {
|
||||||
setup() {
|
setup() {
|
||||||
this._super();
|
super.setup();
|
||||||
frappe.flags.hide_serial_batch_dialog = true;
|
frappe.flags.hide_serial_batch_dialog = true;
|
||||||
frappe.ui.form.on(this.frm.doctype + " Item", "rate", function(frm, cdt, cdn) {
|
frappe.ui.form.on(this.frm.doctype + " Item", "rate", function(frm, cdt, cdn) {
|
||||||
var item = frappe.get_doc(cdt, cdn);
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
|
@ -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}));
|
||||||
|
@ -104,7 +104,7 @@ frappe.ui.form.on("Sales Order Item", {
|
|||||||
|
|
||||||
erpnext.selling.SalesOrderController = class SalesOrderController extends erpnext.selling.SellingController {
|
erpnext.selling.SalesOrderController = class SalesOrderController extends erpnext.selling.SellingController {
|
||||||
onload(doc, dt, dn) {
|
onload(doc, dt, dn) {
|
||||||
super.onload();
|
super.onload(doc, dt, dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(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}));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
$.extend(cur_frm.cscript, {
|
extend_cscript(cur_frm.cscript, {
|
||||||
message: function () {
|
message: function () {
|
||||||
var total_characters = this.frm.doc.message.length;
|
var total_characters = this.frm.doc.message.length;
|
||||||
var total_msg = 1;
|
var total_msg = 1;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
$.extend(cur_frm.cscript, {
|
extend_cscript(cur_frm.cscript, {
|
||||||
onload: function() {
|
onload: function() {
|
||||||
if(cur_frm.doc.__islocal) {
|
if(cur_frm.doc.__islocal) {
|
||||||
cur_frm.set_value("to_currency", frappe.defaults.get_global_default("currency"));
|
cur_frm.set_value("to_currency", frappe.defaults.get_global_default("currency"));
|
||||||
|
@ -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', {
|
frappe.ui.form.on('Delivery Note', {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
|
@ -472,7 +472,7 @@ erpnext.buying.MaterialRequestController = class MaterialRequestController exten
|
|||||||
};
|
};
|
||||||
|
|
||||||
// for backward compatibility: combine new and previous states
|
// 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) {
|
function set_schedule_date(frm) {
|
||||||
if(frm.doc.schedule_date){
|
if(frm.doc.schedule_date){
|
||||||
|
@ -251,7 +251,7 @@ erpnext.stock.PurchaseReceiptController = class PurchaseReceiptController extend
|
|||||||
};
|
};
|
||||||
|
|
||||||
// for backward compatibility: combine new and previous states
|
// 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) {
|
cur_frm.cscript.update_status = function(status) {
|
||||||
frappe.ui.form.is_saving = true;
|
frappe.ui.form.is_saving = true;
|
||||||
|
@ -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}));
|
||||||
|
@ -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) {
|
cur_frm.fields_dict['serial_no'].get_query = function(doc, cdt, cdn) {
|
||||||
var cond = [];
|
var cond = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user