Skip to content

Commit

Permalink
chore: Remove cur_frm from sales_invoice.js
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 committed Jul 23, 2023
1 parent 8d3d949 commit cdc9b62
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion erpnext/accounts/doctype/sales_invoice/regional/italy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
frappe.ui.form.on("Sales Invoice", {
refresh: (frm) => {
if(frm.doc.docstatus == 1) {
frm.add_custom_button('Generate E-Invoice', () => {
frm.add_custom_button(__('Generate E-Invoice'), () => {
frm.call({
method: "erpnext.regional.italy.utils.generate_single_invoice",
args: {
Expand Down
5 changes: 2 additions & 3 deletions erpnext/crm/doctype/opportunity/opportunity.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.crm");

cur_frm.email_field = "contact_email";

erpnext.pre_sales.set_as_lost("Quotation");
erpnext.sales_common.setup_selling_controller();

Expand All @@ -22,6 +19,8 @@ frappe.ui.form.on("Opportunity", {
}
}
});

frm.email_field = "contact_email";
},

validate: function(frm) {
Expand Down
3 changes: 1 addition & 2 deletions erpnext/public/js/controllers/buying.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
// License: GNU General Public License v3. See license.txt

frappe.provide("erpnext.buying");

// cur_frm.email_field = "contact_email";
// cur_frm.add_fetch('project', 'cost_center', 'cost_center');

erpnext.buying = {
setup_buying_controller: function() {
erpnext.buying.BuyingController = class BuyingController extends erpnext.TransactionController {
setup() {
super.setup();
this.frm.email_field = "contact_email";
}

onload(doc, cdt, cdn) {
Expand Down
11 changes: 5 additions & 6 deletions erpnext/public/js/utils/sales_common.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

// cur_frm.email_field = "contact_email";

frappe.provide("erpnext.selling");

erpnext.sales_common = {
setup_selling_controller:function() {
erpnext.selling.SellingController = class SellingController extends erpnext.TransactionController {
setup() {
super.setup();
this.frm.email_field = "contact_email";
}

onload() {
Expand Down Expand Up @@ -61,7 +60,7 @@ erpnext.sales_common = {
this.frm.set_query("item_code", "items", function() {
return {
query: "erpnext.controllers.queries.item_query",
filters: {'is_sales_item': 1, 'customer': cur_frm.doc.customer, 'has_variants': 0}
filters: {'is_sales_item': 1, 'customer': me.frm.doc.customer, 'has_variants': 0}
}
});
}
Expand Down Expand Up @@ -260,9 +259,9 @@ erpnext.sales_common = {
}

set_product_bundle_help(doc) {
if(!cur_frm.fields_dict.packing_list) return;
if(!this.frm.fields_dict.packing_list) return;
if ((doc.packed_items || []).length) {
$(cur_frm.fields_dict.packing_list.row.wrapper).toggle(true);
$(this.frm.fields_dict.packing_list.row.wrapper).toggle(true);

if (in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
var help_msg = "<div class='alert alert-warning'>" +
Expand All @@ -271,7 +270,7 @@ erpnext.sales_common = {
frappe.meta.get_docfield(doc.doctype, 'product_bundle_help', doc.name).options = help_msg;
}
} else {
$(cur_frm.fields_dict.packing_list.row.wrapper).toggle(false);
$(this.frm.fields_dict.packing_list.row.wrapper).toggle(false);
if (in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
frappe.meta.get_docfield(doc.doctype, 'product_bundle_help', doc.name).options = '';
}
Expand Down

0 comments on commit cdc9b62

Please sign in to comment.