diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000000..c820d233a5e --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,12 @@ +# Since version 2.23 (released in August 2019), git-blame has a feature +# to ignore or bypass certain commits. +# +# This file contains a list of commits that are not likely what you +# are looking for in a blame, such as mass reformatting or renaming. +# You can set this file as a default ignore file for blame by running +# the following command. +# +# $ git config blame.ignoreRevsFile .git-blame-ignore-revs + +# Replace use of Class.extend with native JS class +1fe891b287a1b3f225d29ee3d07e7b1824aba9e7 diff --git a/.gitignore b/.gitignore index 652fbdc3176..63c51c49765 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ latest_updates.json .wnf-lang-status *.egg-info dist/ +erpnext/public/dist erpnext/docs/current *.swp *.swo diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js index f7d471b725e..78e7ff6ea29 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js @@ -15,7 +15,7 @@ frappe.ui.form.on("Bank Reconciliation Tool", { }, refresh: function (frm) { - frappe.require("assets/js/bank-reconciliation-tool.min.js", () => + frappe.require("bank-reconciliation-tool.bundle.js", () => frm.trigger("make_reconciliation_tool") ); frm.upload_statement_button = frm.page.set_secondary_action( diff --git a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js index 016f29a7b51..0a2e0bc9ba3 100644 --- a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js +++ b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.js @@ -320,7 +320,7 @@ frappe.ui.form.on("Bank Statement Import", { return; } - frappe.require("/assets/js/data_import_tools.min.js", () => { + frappe.require("data_import_tools.bundle.js", () => { frm.import_preview = new frappe.data_import.ImportPreview({ wrapper: frm.get_field("import_preview").$wrapper, doctype: frm.doc.reference_doctype, diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index d76641dc9bd..957a50f0132 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -194,19 +194,19 @@ var update_jv_details = function(doc, r) { refresh_field("accounts"); } -erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ - onload: function() { +erpnext.accounts.JournalEntry = class JournalEntry extends frappe.ui.form.Controller { + onload() { this.load_defaults(); this.setup_queries(); this.setup_balance_formatter(); erpnext.accounts.dimensions.setup_dimension_filters(this.frm, this.frm.doctype); - }, + } - onload_post_render: function() { + onload_post_render() { cur_frm.get_field("accounts").grid.set_multiple_add("account"); - }, + } - load_defaults: function() { + load_defaults() { //this.frm.show_print_first = true; if(this.frm.doc.__islocal && this.frm.doc.company) { frappe.model.set_default_values(this.frm.doc); @@ -216,9 +216,9 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ var posting_date = this.frm.doc.posting_date; if(!this.frm.doc.amended_from) this.frm.set_value('posting_date', posting_date || frappe.datetime.get_today()); } - }, + } - setup_queries: function() { + setup_queries() { var me = this; me.frm.set_query("account", "accounts", function(doc, cdt, cdn) { @@ -324,9 +324,9 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ }); - }, + } - setup_balance_formatter: function() { + setup_balance_formatter() { const formatter = function(value, df, options, doc) { var currency = frappe.meta.get_field_currency(df, doc); var dr_or_cr = value ? ('') : ""; @@ -337,9 +337,9 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ }; this.frm.fields_dict.accounts.grid.update_docfield_property('balance', 'formatter', formatter); this.frm.fields_dict.accounts.grid.update_docfield_property('party_balance', 'formatter', formatter); - }, + } - reference_name: function(doc, cdt, cdn) { + reference_name(doc, cdt, cdn) { var d = frappe.get_doc(cdt, cdn); if(d.reference_name) { @@ -351,9 +351,9 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ this.get_outstanding('Journal Entry', d.reference_name, doc.company, d); } } - }, + } - get_outstanding: function(doctype, docname, company, child, due_date) { + get_outstanding(doctype, docname, company, child, due_date) { var me = this; var args = { "doctype": doctype, @@ -375,9 +375,9 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ } } }); - }, + } - accounts_add: function(doc, cdt, cdn) { + accounts_add(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); $.each(doc.accounts, function(i, d) { if(d.account && d.party && d.party_type) { @@ -400,9 +400,9 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({ cur_frm.cscript.update_totals(doc); erpnext.accounts.dimensions.copy_dimension_from_first_row(this.frm, cdt, cdn, 'accounts'); - }, + } -}); +}; cur_frm.script_manager.make(erpnext.accounts.JournalEntry); diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js index d1523cd7aca..8dcd1aa8e7f 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js @@ -34,8 +34,8 @@ frappe.ui.form.on("Payment Reconciliation Payment", { } }); -erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.extend({ - onload: function() { +erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationController extends frappe.ui.form.Controller { + onload() { var me = this; this.frm.set_query("party", function() { @@ -84,18 +84,18 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext frappe.throw({message: __("Please Select Both Company and Party Type First"), title: title}); } }; - }, + } - refresh: function() { + refresh() { this.frm.disable_save(); this.toggle_primary_action(); - }, + } - onload_post_render: function() { + onload_post_render() { this.toggle_primary_action(); - }, + } - party: function() { + party() { var me = this if (!me.frm.doc.receivable_payable_account && me.frm.doc.party_type && me.frm.doc.party) { return frappe.call({ @@ -112,9 +112,9 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext } }); } - }, + } - get_unreconciled_entries: function() { + get_unreconciled_entries() { var me = this; return this.frm.call({ doc: me.frm.doc, @@ -125,9 +125,9 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext } }); - }, + } - reconcile: function() { + reconcile() { var me = this; var show_dialog = me.frm.doc.payments.filter(d => d.difference_amount && !d.difference_account); @@ -209,9 +209,9 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext } else { this.reconcile_payment_entries(); } - }, + } - reconcile_payment_entries: function() { + reconcile_payment_entries() { var me = this; return this.frm.call({ @@ -222,9 +222,9 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext me.toggle_primary_action(); } }); - }, + } - set_invoice_options: function() { + set_invoice_options() { var me = this; var invoices = []; @@ -244,9 +244,9 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext } refresh_field("payments"); - }, + } - toggle_primary_action: function() { + toggle_primary_action() { if ((this.frm.doc.payments || []).length) { this.frm.fields_dict.reconcile.$input && this.frm.fields_dict.reconcile.$input.addClass("btn-primary"); @@ -260,6 +260,6 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext } } -}); +}; $.extend(cur_frm.cscript, new erpnext.accounts.PaymentReconciliationController({frm: cur_frm})); diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js index 493bd448024..72d587afb5f 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js @@ -4,18 +4,18 @@ {% include 'erpnext/selling/sales_common.js' %}; frappe.provide("erpnext.accounts"); -erpnext.selling.POSInvoiceController = erpnext.selling.SellingController.extend({ +erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnext.selling.SellingController { setup(doc) { this.setup_posting_date_time_check(); - this._super(doc); - }, + super.setup(doc); + } - company: function() { + company() { erpnext.accounts.dimensions.update_dimension(this.frm, this.frm.doctype); - }, + } onload(doc) { - this._super(); + super.onload(); this.frm.ignore_doctypes_on_cancel_all = ['POS Invoice Merge Log']; if(doc.__islocal && doc.is_pos && frappe.get_route_str() !== 'point-of-sale') { this.frm.script_manager.trigger("is_pos"); @@ -23,10 +23,10 @@ erpnext.selling.POSInvoiceController = erpnext.selling.SellingController.extend( } erpnext.accounts.dimensions.setup_dimension_filters(this.frm, this.frm.doctype); - }, + } refresh(doc) { - this._super(); + super.refresh(); if (doc.docstatus == 1 && !doc.is_return) { this.frm.add_custom_button(__('Return'), this.make_sales_return, __('Create')); this.frm.page.set_inner_btn_group_as_primary(__('Create')); @@ -36,13 +36,13 @@ erpnext.selling.POSInvoiceController = erpnext.selling.SellingController.extend( this.frm.return_print_format = "Sales Invoice Return"; this.frm.set_value('consolidated_invoice', ''); } - }, + } - is_pos: function() { + is_pos() { this.set_pos_data(); - }, + } - set_pos_data: async function() { + async set_pos_data() { if(this.frm.doc.is_pos) { this.frm.set_value("allocate_advances_automatically", 0); if(!this.frm.doc.company) { @@ -69,7 +69,7 @@ erpnext.selling.POSInvoiceController = erpnext.selling.SellingController.extend( } } } - }, + } customer() { if (!this.frm.doc.customer) return @@ -86,13 +86,13 @@ erpnext.selling.POSInvoiceController = erpnext.selling.SellingController.extend( }, () => { this.apply_pricing_rule(); }); - }, + } - amount: function(){ + amount(){ this.write_off_outstanding_amount_automatically() - }, + } - change_amount: function(){ + change_amount(){ if(this.frm.doc.paid_amount > this.frm.doc.grand_total){ this.calculate_write_off_amount(); }else { @@ -101,16 +101,16 @@ erpnext.selling.POSInvoiceController = erpnext.selling.SellingController.extend( } this.frm.refresh_fields(); - }, + } - loyalty_amount: function(){ + loyalty_amount(){ this.calculate_outstanding_amount(); this.frm.refresh_field("outstanding_amount"); this.frm.refresh_field("paid_amount"); this.frm.refresh_field("base_paid_amount"); - }, + } - write_off_outstanding_amount_automatically: function() { + write_off_outstanding_amount_automatically() { if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) { frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]); // this will make outstanding amount 0 @@ -125,15 +125,15 @@ erpnext.selling.POSInvoiceController = erpnext.selling.SellingController.extend( this.calculate_outstanding_amount(false); this.frm.refresh_fields(); - }, + } - make_sales_return: function() { + make_sales_return() { frappe.model.open_mapped_doc({ method: "erpnext.accounts.doctype.pos_invoice.pos_invoice.make_sales_return", frm: cur_frm }) - }, -}) + } +} $.extend(cur_frm.cscript, new erpnext.selling.POSInvoiceController({ frm: cur_frm })) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index f58c8f45262..617b5b49d4c 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -4,10 +4,10 @@ frappe.provide("erpnext.accounts"); {% include 'erpnext/public/js/controllers/buying.js' %}; -erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ - setup: function(doc) { +erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.BuyingController { + setup(doc) { this.setup_posting_date_time_check(); - this._super(doc); + super.setup(doc); // formatter for purchase invoice item if(this.frm.doc.update_stock) { @@ -25,14 +25,14 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } }; }); - }, + } - company: function() { + company() { erpnext.accounts.dimensions.update_dimension(this.frm, this.frm.doctype); - }, + } - onload: function() { - this._super(); + onload() { + super.onload(); if(!this.frm.doc.__islocal) { // show credit_to in print format @@ -48,11 +48,11 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } erpnext.accounts.dimensions.setup_dimension_filters(this.frm, this.frm.doctype); - }, + } - refresh: function(doc) { + refresh(doc) { const me = this; - this._super(); + super.refresh(); hide_fields(this.frm.doc); // Show / Hide button @@ -161,26 +161,26 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } this.frm.set_df_property("tax_withholding_category", "hidden", doc.apply_tds ? 0 : 1); - }, + } - unblock_invoice: function() { + unblock_invoice() { const me = this; frappe.call({ 'method': 'erpnext.accounts.doctype.purchase_invoice.purchase_invoice.unblock_invoice', 'args': {'name': me.frm.doc.name}, 'callback': (r) => me.frm.reload_doc() }); - }, + } - block_invoice: function() { + block_invoice() { this.make_comment_dialog_and_block_invoice(); - }, + } - change_release_date: function() { + change_release_date() { this.make_dialog_and_set_release_date(); - }, + } - can_change_release_date: function(date) { + can_change_release_date(date) { const diff = frappe.datetime.get_diff(date, frappe.datetime.nowdate()); if (diff < 0) { frappe.throw(__('New release date should be in the future')); @@ -188,9 +188,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } else { return true; } - }, + } - make_comment_dialog_and_block_invoice: function(){ + make_comment_dialog_and_block_invoice(){ const me = this; const title = __('Block Invoice'); @@ -232,9 +232,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ }); this.dialog.show(); - }, + } - make_dialog_and_set_release_date: function() { + make_dialog_and_set_release_date() { const me = this; const title = __('Set New Release Date'); @@ -263,17 +263,17 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ }); this.dialog.show(); - }, + } - set_release_date: function(data) { + set_release_date(data) { return frappe.call({ 'method': 'erpnext.accounts.doctype.purchase_invoice.purchase_invoice.change_release_date', 'args': data, 'callback': (r) => this.frm.reload_doc() }); - }, + } - supplier: function() { + supplier() { var me = this; // Do not update if inter company reference is there as the details will already be updated @@ -295,9 +295,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ me.frm.set_df_property("apply_tds", "read_only", me.frm.supplier_tds ? 0 : 1); me.frm.set_df_property("tax_withholding_category", "hidden", me.frm.supplier_tds ? 0 : 1); }) - }, + } - apply_tds: function(frm) { + apply_tds(frm) { var me = this; if (!me.frm.doc.apply_tds) { @@ -307,9 +307,9 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ me.frm.set_value("tax_withholding_category", me.frm.supplier_tds); me.frm.set_df_property("tax_withholding_category", "hidden", 0); } - }, + } - credit_to: function() { + credit_to() { var me = this; if(this.frm.doc.credit_to) { me.frm.call({ @@ -327,16 +327,16 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } }); } - }, + } - make_inter_company_invoice: function(frm) { + make_inter_company_invoice(frm) { frappe.model.open_mapped_doc({ method: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_inter_company_sales_invoice", frm: frm }); - }, + } - is_paid: function() { + is_paid() { hide_fields(this.frm.doc); if(cint(this.frm.doc.is_paid)) { this.frm.set_value("allocate_advances_automatically", 0); @@ -347,44 +347,44 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } this.calculate_outstanding_amount(); this.frm.refresh_fields(); - }, + } - write_off_amount: function() { + write_off_amount() { this.set_in_company_currency(this.frm.doc, ["write_off_amount"]); this.calculate_outstanding_amount(); this.frm.refresh_fields(); - }, + } - paid_amount: function() { + paid_amount() { this.set_in_company_currency(this.frm.doc, ["paid_amount"]); this.write_off_amount(); this.frm.refresh_fields(); - }, + } - allocated_amount: function() { + allocated_amount() { this.calculate_total_advance(); this.frm.refresh_fields(); - }, + } - items_add: function(doc, cdt, cdn) { + items_add(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); this.frm.script_manager.copy_from_first_row("items", row, ["expense_account", "cost_center", "project"]); - }, + } - on_submit: function() { + on_submit() { $.each(this.frm.doc["items"] || [], function(i, row) { if(row.purchase_receipt) frappe.model.clear_doc("Purchase Receipt", row.purchase_receipt) }) - }, + } - make_debit_note: function() { + make_debit_note() { frappe.model.open_mapped_doc({ method: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_debit_note", frm: cur_frm }) - }, -}); + } +}; cur_frm.script_manager.make(erpnext.accounts.PurchaseInvoice); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 7c73ad6c90e..b48db246ac6 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -5,17 +5,17 @@ frappe.provide("erpnext.accounts"); -erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.extend({ - setup: function(doc) { +erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends erpnext.selling.SellingController { + setup(doc) { this.setup_posting_date_time_check(); - this._super(doc); - }, - company: function() { + super.setup(doc); + } + company() { erpnext.accounts.dimensions.update_dimension(this.frm, this.frm.doctype); - }, - onload: function() { + } + onload() { var me = this; - this._super(); + super.onload(); this.frm.ignore_doctypes_on_cancel_all = ['POS Invoice']; if(!this.frm.doc.__islocal && !this.frm.doc.customer && this.frm.doc.debit_to) { @@ -35,11 +35,11 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } erpnext.queries.setup_warehouse_query(this.frm); erpnext.accounts.dimensions.setup_dimension_filters(this.frm, this.frm.doctype); - }, + } - refresh: function(doc, dt, dn) { + refresh(doc, dt, dn) { const me = this; - this._super(); + super.refresh(); if(cur_frm.msgbox && cur_frm.msgbox.$wrapper.is(":visible")) { // hide new msgbox cur_frm.msgbox.hide(); @@ -138,16 +138,16 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte }, __('Create')); } } - }, + } - make_maintenance_schedule: function() { + make_maintenance_schedule() { frappe.model.open_mapped_doc({ method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_maintenance_schedule", frm: cur_frm }) - }, + } - on_submit: function(doc, dt, dn) { + on_submit(doc, dt, dn) { var me = this; if (frappe.get_route()[0] != 'Form') { @@ -157,9 +157,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte $.each(doc["items"], function(i, row) { if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note) }) - }, + } - set_default_print_format: function() { + set_default_print_format() { // set default print format to POS type or Credit Note if(cur_frm.doc.is_pos) { if(cur_frm.pos_print_format) { @@ -180,9 +180,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte cur_frm.meta._default_print_format = null; } } - }, + } - sales_order_btn: function() { + sales_order_btn() { var me = this; this.$sales_order_btn = this.frm.add_custom_button(__('Sales Order'), function() { @@ -201,9 +201,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } }) }, __("Get Items From")); - }, + } - quotation_btn: function() { + quotation_btn() { var me = this; this.$quotation_btn = this.frm.add_custom_button(__('Quotation'), function() { @@ -225,9 +225,9 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } }) }, __("Get Items From")); - }, + } - delivery_note_btn: function() { + delivery_note_btn() { var me = this; this.$delivery_note_btn = this.frm.add_custom_button(__('Delivery Note'), function() { @@ -253,12 +253,12 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } }); }, __("Get Items From")); - }, + } - tc_name: function() { + tc_name() { this.get_terms(); - }, - customer: function() { + } + customer() { if (this.frm.doc.is_pos){ var pos_profile = this.frm.doc.pos_profile; } @@ -289,16 +289,16 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } }); } - }, + } - make_inter_company_invoice: function() { + make_inter_company_invoice() { frappe.model.open_mapped_doc({ method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_inter_company_purchase_invoice", frm: me.frm }); - }, + } - debit_to: function() { + debit_to() { var me = this; if(this.frm.doc.debit_to) { me.frm.call({ @@ -316,14 +316,14 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } }); } - }, + } - allocated_amount: function() { + allocated_amount() { this.calculate_total_advance(); this.frm.refresh_fields(); - }, + } - write_off_outstanding_amount_automatically: function() { + write_off_outstanding_amount_automatically() { if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) { frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]); // this will make outstanding amount 0 @@ -338,39 +338,39 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte this.calculate_outstanding_amount(false); this.frm.refresh_fields(); - }, + } - write_off_amount: function() { + write_off_amount() { this.set_in_company_currency(this.frm.doc, ["write_off_amount"]); this.write_off_outstanding_amount_automatically(); - }, + } - items_add: function(doc, cdt, cdn) { + items_add(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); this.frm.script_manager.copy_from_first_row("items", row, ["income_account", "cost_center"]); - }, + } - set_dynamic_labels: function() { - this._super(); + set_dynamic_labels() { + super.set_dynamic_labels(); this.frm.events.hide_fields(this.frm) - }, + } - items_on_form_rendered: function() { + items_on_form_rendered() { erpnext.setup_serial_or_batch_no(); - }, + } - packed_items_on_form_rendered: function(doc, grid_row) { + packed_items_on_form_rendered(doc, grid_row) { erpnext.setup_serial_or_batch_no(); - }, + } - make_sales_return: function() { + make_sales_return() { frappe.model.open_mapped_doc({ method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_sales_return", frm: cur_frm }) - }, + } - asset: function(frm, cdt, cdn) { + asset(frm, cdt, cdn) { var row = locals[cdt][cdn]; if(row.asset) { frappe.call({ @@ -384,18 +384,18 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } }) } - }, + } - is_pos: function(frm){ + is_pos(frm){ this.set_pos_data(); - }, + } - pos_profile: function() { + pos_profile() { this.frm.doc.taxes = [] this.set_pos_data(); - }, + } - set_pos_data: function() { + set_pos_data() { if(this.frm.doc.is_pos) { this.frm.set_value("allocate_advances_automatically", 0); if(!this.frm.doc.company) { @@ -425,13 +425,13 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } } else this.frm.trigger("refresh"); - }, + } - amount: function(){ + amount(){ this.write_off_outstanding_amount_automatically() - }, + } - change_amount: function(){ + change_amount(){ if(this.frm.doc.paid_amount > this.frm.doc.grand_total){ this.calculate_write_off_amount(); }else { @@ -440,15 +440,15 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte } this.frm.refresh_fields(); - }, + } - loyalty_amount: function(){ + loyalty_amount(){ this.calculate_outstanding_amount(); this.frm.refresh_field("outstanding_amount"); this.frm.refresh_field("paid_amount"); this.frm.refresh_field("base_paid_amount"); } -}); +}; // for backward compatibility: combine new and previous states $.extend(cur_frm.cscript, new erpnext.accounts.SalesInvoiceController({frm: cur_frm})); diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index dd0f0658485..c0e19e9c3d0 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -61,8 +61,8 @@ frappe.ui.form.on("Purchase Order Item", { } }); -erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend({ - setup: function() { +erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends erpnext.buying.BuyingController { + setup() { this.frm.custom_make_buttons = { 'Purchase Receipt': 'Purchase Receipt', 'Purchase Invoice': 'Purchase Invoice', @@ -70,13 +70,13 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( 'Payment Entry': 'Payment', } - this._super(); + super.setup(); - }, + } - refresh: function(doc, cdt, cdn) { + refresh(doc, cdt, cdn) { var me = this; - this._super(); + super.refresh(); var allow_receipt = false; var is_drop_ship = false; @@ -182,9 +182,9 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( } else if(doc.docstatus===0) { cur_frm.cscript.add_from_mappers(); } - }, + } - get_items_from_open_material_requests: function() { + get_items_from_open_material_requests() { erpnext.utils.map_current_doc({ method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order_based_on_supplier", args: { @@ -202,17 +202,17 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( }, get_query_method: "erpnext.stock.doctype.material_request.material_request.get_material_requests_based_on_supplier" }); - }, + } - validate: function() { + validate() { set_schedule_date(this.frm); - }, + } - has_unsupplied_items: function() { + has_unsupplied_items() { return this.frm.doc['supplied_items'].some(item => item.required_qty != item.supplied_qty) - }, + } - make_stock_entry: function() { + make_stock_entry() { var items = $.map(cur_frm.doc.items, function(d) { return d.bom ? d.item_code : false; }); var me = this; @@ -326,9 +326,9 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( me.dialog.hide(); }); - }, + } - _make_rm_stock_entry: function(rm_items) { + _make_rm_stock_entry(rm_items) { frappe.call({ method:"erpnext.buying.doctype.purchase_order.purchase_order.make_rm_stock_entry", args: { @@ -341,31 +341,31 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( frappe.set_route("Form", doclist[0].doctype, doclist[0].name); } }); - }, + } - make_inter_company_order: function(frm) { + make_inter_company_order(frm) { frappe.model.open_mapped_doc({ method: "erpnext.buying.doctype.purchase_order.purchase_order.make_inter_company_sales_order", frm: frm }); - }, + } - make_purchase_receipt: function() { + make_purchase_receipt() { frappe.model.open_mapped_doc({ method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt", frm: cur_frm, freeze_message: __("Creating Purchase Receipt ...") }) - }, + } - make_purchase_invoice: function() { + make_purchase_invoice() { frappe.model.open_mapped_doc({ method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice", frm: cur_frm }) - }, + } - add_from_mappers: function() { + add_from_mappers() { var me = this; this.frm.add_custom_button(__('Material Request'), function() { @@ -471,13 +471,13 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( } }); }, __("Tools")); - }, + } - tc_name: function() { + tc_name() { this.get_terms(); - }, + } - items_add: function(doc, cdt, cdn) { + items_add(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); if(doc.schedule_date) { row.schedule_date = doc.schedule_date; @@ -485,13 +485,13 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( } else { this.frm.script_manager.copy_from_first_row("items", row, ["schedule_date"]); } - }, + } - unhold_purchase_order: function(){ + unhold_purchase_order(){ cur_frm.cscript.update_status("Resume", "Draft") - }, + } - hold_purchase_order: function(){ + hold_purchase_order(){ var me = this; var d = new frappe.ui.Dialog({ title: __('Reason for Hold'), @@ -523,28 +523,28 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( } }); d.show(); - }, + } - unclose_purchase_order: function(){ + unclose_purchase_order(){ cur_frm.cscript.update_status('Re-open', 'Submitted') - }, + } - close_purchase_order: function(){ + close_purchase_order(){ cur_frm.cscript.update_status('Close', 'Closed') - }, + } - delivered_by_supplier: function(){ + delivered_by_supplier(){ cur_frm.cscript.update_status('Deliver', 'Delivered') - }, + } - items_on_form_rendered: function() { - set_schedule_date(this.frm); - }, - - schedule_date: function() { + items_on_form_rendered() { set_schedule_date(this.frm); } -}); + + schedule_date() { + set_schedule_date(this.frm); + } +}; // for backward compatibility: combine new and previous states $.extend(cur_frm.cscript, new erpnext.buying.PurchaseOrderController({frm: cur_frm})); diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js index b76c3784a47..ee0e1ef576c 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -205,10 +205,10 @@ frappe.ui.form.on("Request for Quotation Supplier",{ }) -erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.extend({ - refresh: function() { +erpnext.buying.RequestforQuotationController = class RequestforQuotationController extends erpnext.buying.BuyingController { + refresh() { var me = this; - this._super(); + super.refresh(); if (this.frm.doc.docstatus===0) { this.frm.add_custom_button(__('Material Request'), function() { @@ -302,17 +302,17 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e me.get_suppliers_button(me.frm); }, __("Tools")); } - }, + } - calculate_taxes_and_totals: function() { + calculate_taxes_and_totals() { return; - }, + } - tc_name: function() { + tc_name() { this.get_terms(); - }, + } - get_suppliers_button: function (frm) { + get_suppliers_button (frm) { var doc = frm.doc; var dialog = new frappe.ui.Dialog({ title: __("Get Suppliers"), @@ -410,8 +410,8 @@ erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.e }); dialog.show(); - }, -}); + } +}; // for backward compatibility: combine new and previous states $.extend(cur_frm.cscript, new erpnext.buying.RequestforQuotationController({frm: cur_frm})); diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index a0187b0a824..a3ba52e67b2 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -4,19 +4,19 @@ // attach required files {% include 'erpnext/public/js/controllers/buying.js' %}; -erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.extend({ - setup: function() { +erpnext.buying.SupplierQuotationController = class SupplierQuotationController extends erpnext.buying.BuyingController { + setup() { this.frm.custom_make_buttons = { 'Purchase Order': 'Purchase Order', 'Quotation': 'Quotation' } - this._super(); - }, + super.setup(); + } - refresh: function() { + refresh() { var me = this; - this._super(); + super.refresh(); if (this.frm.doc.__islocal && !this.frm.doc.valid_till) { this.frm.set_value('valid_till', frappe.datetime.add_months(this.frm.doc.transaction_date, 1)); @@ -77,22 +77,22 @@ erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.ext }) }, __("Get Items From")); } - }, + } - make_purchase_order: function() { + make_purchase_order() { frappe.model.open_mapped_doc({ method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order", frm: cur_frm }) - }, - make_quotation: function() { + } + make_quotation() { frappe.model.open_mapped_doc({ method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_quotation", frm: cur_frm }) } -}); +}; // for backward compatibility: combine new and previous states $.extend(cur_frm.cscript, new erpnext.buying.SupplierQuotationController({frm: cur_frm})); diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js index 0c88d2826f7..8dfee1d6c72 100644 --- a/erpnext/crm/doctype/lead/lead.js +++ b/erpnext/crm/doctype/lead/lead.js @@ -4,8 +4,8 @@ frappe.provide("erpnext"); cur_frm.email_field = "email_id"; -erpnext.LeadController = frappe.ui.form.Controller.extend({ - setup: function () { +erpnext.LeadController = class LeadController extends frappe.ui.form.Controller { + setup () { this.frm.make_methods = { 'Customer': this.make_customer, 'Quotation': this.make_quotation, @@ -13,9 +13,9 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ }; this.frm.toggle_reqd("lead_name", !this.frm.doc.organization_lead); - }, + } - onload: function () { + onload () { this.frm.set_query("customer", function (doc, cdt, cdn) { return { query: "erpnext.controllers.queries.customer_query" } }); @@ -27,9 +27,9 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ this.frm.set_query("contact_by", function (doc, cdt, cdn) { return { query: "frappe.core.doctype.user.user.user_query" } }); - }, + } - refresh: function () { + refresh () { let doc = this.frm.doc; erpnext.toggle_naming_series(); frappe.dynamic_link = { doc: doc, fieldname: 'name', doctype: 'Lead' } @@ -45,47 +45,47 @@ erpnext.LeadController = frappe.ui.form.Controller.extend({ } else { frappe.contacts.clear_address_and_contact(this.frm); } - }, + } - make_customer: function () { + make_customer () { frappe.model.open_mapped_doc({ method: "erpnext.crm.doctype.lead.lead.make_customer", frm: cur_frm }) - }, + } - make_opportunity: function () { + make_opportunity () { frappe.model.open_mapped_doc({ method: "erpnext.crm.doctype.lead.lead.make_opportunity", frm: cur_frm }) - }, + } - make_quotation: function () { + make_quotation () { frappe.model.open_mapped_doc({ method: "erpnext.crm.doctype.lead.lead.make_quotation", frm: cur_frm }) - }, + } - organization_lead: function () { + organization_lead () { this.frm.toggle_reqd("lead_name", !this.frm.doc.organization_lead); this.frm.toggle_reqd("company_name", this.frm.doc.organization_lead); - }, + } - company_name: function () { + company_name () { if (this.frm.doc.organization_lead && !this.frm.doc.lead_name) { this.frm.set_value("lead_name", this.frm.doc.company_name); } - }, + } - contact_date: function () { + contact_date () { if (this.frm.doc.contact_date) { let d = moment(this.frm.doc.contact_date); d.add(1, "day"); this.frm.set_value("ends_on", d.format(frappe.defaultDatetimeFormat)); } } -}); +}; $.extend(cur_frm.cscript, new erpnext.LeadController({ frm: cur_frm })); diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js index ac374a95f4e..925c30b4516 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.js +++ b/erpnext/crm/doctype/opportunity/opportunity.js @@ -145,8 +145,8 @@ frappe.ui.form.on("Opportunity", { }) // TODO commonify this code -erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({ - onload: function() { +erpnext.crm.Opportunity = class Opportunity extends frappe.ui.form.Controller { + onload() { if(!this.frm.doc.status) { frm.set_value('status', 'Open'); @@ -159,9 +159,9 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({ } this.setup_queries(); - }, + } - setup_queries: function() { + setup_queries() { var me = this; if(this.frm.fields_dict.contact_by.df.options.match(/^User/)) { @@ -185,15 +185,15 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({ else if (me.frm.doc.opportunity_from == "Customer") { me.frm.set_query('party_name', erpnext.queries['customer']); } - }, + } - create_quotation: function() { + create_quotation() { frappe.model.open_mapped_doc({ method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation", frm: cur_frm }) } -}); +}; $.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm})); diff --git a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js index b59d8488285..68e7780039b 100644 --- a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js +++ b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.js @@ -72,8 +72,8 @@ frappe.ui.form.on('Student Attendance Tool', { }); -education.StudentsEditor = Class.extend({ - init: function(frm, wrapper, students) { +education.StudentsEditor = class StudentsEditor { + constructor(frm, wrapper, students) { this.wrapper = wrapper; this.frm = frm; if(students.length > 0) { @@ -81,8 +81,8 @@ education.StudentsEditor = Class.extend({ } else { this.show_empty_state(); } - }, - make: function(frm, students) { + } + make(frm, students) { var me = this; $(this.wrapper).empty(); @@ -173,13 +173,13 @@ education.StudentsEditor = Class.extend({ }); $(htmls.join("")).appendTo(me.wrapper); - }, + } - show_empty_state: function() { + show_empty_state() { $(this.wrapper).html( `
\
@@ -38,9 +38,9 @@ erpnext.ExerciseEditor = Class.extend({
this.make_cards(frm);
this.make_buttons(frm);
}
- },
+ }
- make_cards: function(frm) {
+ make_cards(frm) {
var me = this;
$(me.exercise_cards).empty();
@@ -60,9 +60,9 @@ erpnext.ExerciseEditor = Class.extend({
`, {image_src: step.image, title: step.title, description: step.description, col_id: "col-"+i, card_id: "card-"+i, id: i})).appendTo(me.row);
});
- },
+ }
- make_buttons: function(frm) {
+ make_buttons(frm) {
let me = this;
$('.btn-edit').on('click', function() {
let id = $(this).attr('data-id');
@@ -82,9 +82,9 @@ erpnext.ExerciseEditor = Class.extend({
frm.dirty();
}, 300);
});
- },
+ }
- show_add_card_dialog: function(frm) {
+ show_add_card_dialog(frm) {
let me = this;
let d = new frappe.ui.Dialog({
title: __('Add Exercise Step'),
@@ -137,9 +137,9 @@ erpnext.ExerciseEditor = Class.extend({
primary_action_label: __('Add')
});
d.show();
- },
+ }
- show_edit_card_dialog: function(frm, id) {
+ show_edit_card_dialog(frm, id) {
let new_dialog = new frappe.ui.Dialog({
title: __("Edit Exercise Step"),
fields: [
@@ -183,4 +183,4 @@ erpnext.ExerciseEditor = Class.extend({
});
new_dialog.show();
}
-});
+};
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 9d1ce9bbbfb..3024819d764 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -15,10 +15,11 @@ app_logo_url = "/assets/erpnext/images/erpnext-logo.svg"
develop_version = '13.x.x-develop'
-app_include_js = "/assets/js/erpnext.min.js"
-app_include_css = "/assets/css/erpnext.css"
-web_include_js = "/assets/js/erpnext-web.min.js"
-web_include_css = "/assets/css/erpnext-web.css"
+app_include_js = "erpnext.bundle.js"
+app_include_css = "erpnext.bundle.css"
+web_include_js = "erpnext-web.bundle.js"
+web_include_css = "erpnext-web.bundle.css"
+email_css = "email.bundle.css"
doctype_js = {
"Address": "public/js/address.js",
diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js
index c21d4b893cc..5639cc9ea46 100755
--- a/erpnext/hr/doctype/employee/employee.js
+++ b/erpnext/hr/doctype/employee/employee.js
@@ -2,8 +2,8 @@
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.hr");
-erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
- setup: function() {
+erpnext.hr.EmployeeController = class EmployeeController extends frappe.ui.form.Controller {
+ setup() {
this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) {
return {
query: "frappe.core.doctype.user.user.user_query",
@@ -12,30 +12,30 @@ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
}
this.frm.fields_dict.reports_to.get_query = function(doc, cdt, cdn) {
return { query: "erpnext.controllers.queries.employee_query"} }
- },
+ }
- refresh: function() {
+ refresh() {
var me = this;
erpnext.toggle_naming_series();
- },
+ }
- date_of_birth: function() {
+ date_of_birth() {
return cur_frm.call({
method: "get_retirement_date",
args: {date_of_birth: this.frm.doc.date_of_birth}
});
- },
+ }
- salutation: function() {
+ salutation() {
if(this.frm.doc.salutation) {
this.frm.set_value("gender", {
"Mr": "Male",
"Ms": "Female"
}[this.frm.doc.salutation]);
}
- },
+ }
-});
+};
frappe.ui.form.on('Employee',{
setup: function(frm) {
frm.set_query("leave_policy", function() {
diff --git a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
index 3205a92b1b6..ab965d54e3b 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
+++ b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.js
@@ -68,13 +68,13 @@ erpnext.employee_attendance_tool = {
}
}
-erpnext.MarkedEmployee = Class.extend({
- init: function(frm, wrapper, employee) {
+erpnext.MarkedEmployee = class MarkedEmployee {
+ constructor(frm, wrapper, employee) {
this.wrapper = wrapper;
this.frm = frm;
this.make(frm, employee);
- },
- make: function(frm, employee) {
+ }
+ make(frm, employee) {
var me = this;
$(this.wrapper).empty();
@@ -104,16 +104,16 @@ erpnext.MarkedEmployee = Class.extend({
})).appendTo(row);
});
}
-});
+};
-erpnext.EmployeeSelector = Class.extend({
- init: function(frm, wrapper, employee) {
+erpnext.EmployeeSelector = class EmployeeSelector {
+ constructor(frm, wrapper, employee) {
this.wrapper = wrapper;
this.frm = frm;
this.make(frm, employee);
- },
- make: function(frm, employee) {
+ }
+ make(frm, employee) {
var me = this;
$(this.wrapper).empty();
@@ -266,6 +266,6 @@ erpnext.EmployeeSelector = Class.extend({
mark_employee_toolbar.appendTo($(this.wrapper));
}
-});
+};
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.js b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
index 29aa85484a8..bbafc820764 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.js
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
@@ -5,19 +5,19 @@
frappe.provide("erpnext.hr");
-erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
- onload: function() {
+erpnext.hr.AttendanceControlPanel = class AttendanceControlPanel extends frappe.ui.form.Controller {
+ onload() {
this.frm.set_value("att_fr_date", frappe.datetime.get_today());
this.frm.set_value("att_to_date", frappe.datetime.get_today());
- },
+ }
- refresh: function() {
+ refresh() {
this.frm.disable_save();
this.show_upload();
this.setup_import_progress();
- },
+ }
- get_template:function() {
+ get_template() {
if(!this.frm.doc.att_fr_date || !this.frm.doc.att_to_date) {
frappe.msgprint(__("Attendance From Date and Attendance To Date is mandatory"));
return;
@@ -28,7 +28,7 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
from_date: this.frm.doc.att_fr_date,
to_date: this.frm.doc.att_to_date,
});
- },
+ }
show_upload() {
var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
@@ -36,7 +36,7 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
wrapper: $wrapper,
method: 'erpnext.hr.doctype.upload_attendance.upload_attendance.upload'
});
- },
+ }
setup_import_progress() {
var $log_wrapper = $(this.frm.fields_dict.import_log.wrapper).empty();
@@ -64,6 +64,6 @@ erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
}
});
}
-})
+}
cur_frm.cscript = new erpnext.hr.AttendanceControlPanel({frm: cur_frm});
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
index ddbcdfde57e..2adfaf45ef1 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js
@@ -45,8 +45,8 @@ frappe.ui.form.on('Maintenance Schedule', {
})
// TODO commonify this code
-erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
- refresh: function() {
+erpnext.maintenance.MaintenanceSchedule = class MaintenanceSchedule extends frappe.ui.form.Controller {
+ refresh() {
frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
var me = this;
@@ -76,21 +76,21 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
});
}, __('Create'));
}
- },
+ }
- start_date: function(doc, cdt, cdn) {
+ start_date(doc, cdt, cdn) {
this.set_no_of_visits(doc, cdt, cdn);
- },
+ }
- end_date: function(doc, cdt, cdn) {
+ end_date(doc, cdt, cdn) {
this.set_no_of_visits(doc, cdt, cdn);
- },
+ }
- periodicity: function(doc, cdt, cdn) {
+ periodicity(doc, cdt, cdn) {
this.set_no_of_visits(doc, cdt, cdn);
- },
+ }
- set_no_of_visits: function(doc, cdt, cdn) {
+ set_no_of_visits(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
if (item.start_date && item.end_date && item.periodicity) {
@@ -112,8 +112,8 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
var no_of_visits = cint(date_diff / days_in_period[item.periodicity]);
frappe.model.set_value(item.doctype, item.name, "no_of_visits", no_of_visits);
}
- },
-});
+ }
+};
$.extend(cur_frm.cscript, new erpnext.maintenance.MaintenanceSchedule({frm: cur_frm}));
diff --git a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
index 4cbb02a5b3f..12dc59ccfce 100644
--- a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
+++ b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.js
@@ -41,8 +41,8 @@ frappe.ui.form.on('Maintenance Visit', {
})
// TODO commonify this code
-erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
- refresh: function() {
+erpnext.maintenance.MaintenanceVisit = class MaintenanceVisit extends frappe.ui.form.Controller {
+ refresh() {
frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
var me = this;
@@ -96,7 +96,7 @@ erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
})
}, __("Get Items From"));
}
- },
-});
+ }
+};
-$.extend(cur_frm.cscript, new erpnext.maintenance.MaintenanceVisit({frm: cur_frm}));
\ No newline at end of file
+$.extend(cur_frm.cscript, new erpnext.maintenance.MaintenanceVisit({frm: cur_frm}));
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index a09a5e34300..b32b96af13b 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -360,16 +360,16 @@ frappe.ui.form.on("BOM", {
}
});
-erpnext.bom.BomController = erpnext.TransactionController.extend({
- conversion_rate: function(doc) {
+erpnext.bom.BomController = class BomController extends erpnext.TransactionController {
+ conversion_rate(doc) {
if(this.frm.doc.currency === this.get_company_currency()) {
this.frm.set_value("conversion_rate", 1.0);
} else {
erpnext.bom.update_cost(doc);
}
- },
+ }
- item_code: function(doc, cdt, cdn){
+ item_code(doc, cdt, cdn){
var scrap_items = false;
var child = locals[cdt][cdn];
if (child.doctype == 'BOM Scrap Item') {
@@ -381,19 +381,19 @@ erpnext.bom.BomController = erpnext.TransactionController.extend({
}
get_bom_material_detail(doc, cdt, cdn, scrap_items);
- },
+ }
- buying_price_list: function(doc) {
+ buying_price_list(doc) {
this.apply_price_list();
- },
+ }
- plc_conversion_rate: function(doc) {
+ plc_conversion_rate(doc) {
if (!this.in_apply_price_list) {
this.apply_price_list(null, true);
}
- },
+ }
- conversion_factor: function(doc, cdt, cdn) {
+ conversion_factor(doc, cdt, cdn) {
if (frappe.meta.get_docfield(cdt, "stock_qty", cdn)) {
var item = frappe.get_doc(cdt, cdn);
frappe.model.round_floats_in(item, ["qty", "conversion_factor"]);
@@ -402,8 +402,8 @@ erpnext.bom.BomController = erpnext.TransactionController.extend({
this.toggle_conversion_factor(item);
this.frm.events.update_cost(this.frm);
}
- },
-});
+ }
+};
$.extend(cur_frm.cscript, new erpnext.bom.BomController({frm: cur_frm}));
diff --git a/erpnext/public/css/email.css b/erpnext/public/css/email.css
deleted file mode 100644
index 8cf1a31ad6d..00000000000
--- a/erpnext/public/css/email.css
+++ /dev/null
@@ -1,29 +0,0 @@
-.panel-header {
- background-color: #fafbfc;
- border: 1px solid #d1d8dd;
- border-radius: 3px 3px 0 0;
-}
-.panel-body {
- background-color: #fff;
- border: 1px solid #d1d8dd;
- border-top: none;
- border-radius: 0 0 3px 3px;
- overflow-wrap: break-word;
-}
-.sender-avatar {
- width: 24px;
- height: 24px;
- border-radius: 3px;
- vertical-align: middle;
-}
-.sender-avatar-placeholder {
- width: 24px;
- height: 24px;
- border-radius: 3px;
- vertical-align: middle;
- line-height: 24px;
- text-align: center;
- color: #d1d8dd;
- border: 1px solid #d1d8dd;
- background-color: #fff;
-}
diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css
deleted file mode 100644
index 6e4efcb6685..00000000000
--- a/erpnext/public/css/erpnext.css
+++ /dev/null
@@ -1,408 +0,0 @@
-.erpnext-footer {
- margin: 11px auto;
- text-align: center;
-}
-.show-all-reports {
- margin-top: 5px;
- font-size: 11px;
-}
-/* toolbar */
-.toolbar-splash {
- width: 32px;
- height: 32px;
- margin: -10px auto;
-}
-.erpnext-icon {
- width: 24px;
- margin-right: 0px;
- margin-top: -3px;
-}
-.dashboard-list-item {
- background-color: inherit;
- padding: 5px 0px;
- border-bottom: 1px solid #d1d8dd;
-}
-#page-stock-balance .dashboard-list-item {
- padding: 5px 15px;
-}
-.dashboard-list-item:last-child {
- border-bottom: none;
-}
-.frappe-control[data-fieldname='result_html'] {
- overflow: scroll;
-}
-.assessment-result-tool {
- table-layout: fixed;
-}
-.assessment-result-tool input {
- width: 100%;
- border: 0;
- outline: none;
- text-align: right;
-}
-.assessment-result-tool th {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-.assessment-result-tool .total-score,
-.assessment-result-tool .grade,
-.assessment-result-tool .score {
- text-align: right;
-}
-/* pos */
-body[data-route="pos"] .pos-bill-toolbar {
- padding: 10px 0px;
- height: 51px;
-}
-body[data-route="pos"] .pos-bill-item:hover,
-body[data-route="pos"] .list-customers-table > .pos-list-row:hover {
- background-color: #f5f7fa;
- cursor: pointer;
-}
-body[data-route="pos"] .pos-item-qty {
- display: inline-block;
-}
-body[data-route="pos"] .pos-qty-row > div {
- padding: 5px 0px;
-}
-body[data-route="pos"] .pos-qty-btn {
- margin-top: 3px;
- cursor: pointer;
- font-size: 120%;
-}
-body[data-route="pos"] .search-area .form-group {
- max-width: 100% !important;
-}
-body[data-route="pos"] .tax-table {
- margin-bottom: 10px;
-}
-body[data-route="pos"] .discount-field-col {
- padding-left: 24px;
-}
-body[data-route="pos"] .discount-amount-area .input-group:first-child {
- margin-bottom: 2px;
-}
-body[data-route="pos"] .payment-toolbar .row {
- width: 323px;
- margin: 0 auto;
-}
-body[data-route="pos"] .payment-mode {
- cursor: pointer;
- font-family: sans-serif;
- font-size: 15px;
-}
-body[data-route="pos"] .pos-payment-row .col-xs-6 {
- padding: 15px;
-}
-body[data-route="pos"] .pos-payment-row {
- border-bottom: 1px solid #d1d8dd;
- margin: 2px 0px 5px 0px;
- height: 60px;
- margin-top: 0px;
- margin-bottom: 0px;
-}
-body[data-route="pos"] .pos-payment-row:hover,
-body[data-route="pos"] .pos-keyboard-key:hover {
- background-color: #fafbfc;
- cursor: pointer;
-}
-body[data-route="pos"] .pos-keyboard-key,
-body[data-route="pos"] .delete-btn {
- border: 1px solid #d1d8dd;
- height: 85px;
- width: 85px;
- margin: 10px 10px;
- font-size: 24px;
- font-weight: 200;
- background-color: #FDFDFD;
- border-color: #e8e8e8;
-}
-body[data-route="pos"] .numeric-keypad {
- border: 1px solid #d1d8dd;
- height: 69px;
- width: 69px;
- font-size: 20px;
- font-weight: 200;
- background-color: #FDFDFD;
- border-color: #e8e8e8;
- margin-left: -4px;
-}
-body[data-route="pos"] .pos-pay {
- height: 69px;
- width: 69px;
- font-size: 17px;
- font-weight: 200;
- margin-left: -4px;
-}
-body[data-route="pos"] .numeric-keypad {
- height: 60px;
- width: 60px;
- font-size: 20px;
- font-weight: 200;
- border-radius: 0;
- background-color: #fff;
- margin-left: -4px;
-}
-@media (max-width: 1199px) {
- body[data-route="pos"] .numeric-keypad {
- height: 45px;
- width: 45px;
- font-size: 14px;
- }
-}
-@media (max-width: 991px) {
- body[data-route="pos"] .numeric-keypad {
- height: 40px;
- width: 40px;
- }
-}
-body[data-route="pos"] .numeric_keypad {
- margin-left: -15px;
-}
-body[data-route="pos"] .numeric_keypad > .row > button {
- border: none;
- border-right: 1px solid #d1d8dd;
- border-bottom: 1px solid #d1d8dd;
-}
-body[data-route="pos"] .numeric_keypad > .row > button:first-child {
- border-left: 1px solid #d1d8dd;
-}
-body[data-route="pos"] .numeric_keypad > .row:first-child > button {
- border-top: 1px solid #d1d8dd;
-}
-body[data-route="pos"] .pos-pay {
- background-color: #5E64FF;
- border: none;
-}
-body[data-route="pos"] .multimode-payments {
- padding-left: 30px;
-}
-body[data-route="pos"] .payment-toolbar {
- padding-right: 30px;
-}
-body[data-route="pos"] .list-row-head.pos-invoice-list {
- border-top: 1px solid #d1d8dd;
-}
-body[data-route="pos"] .modal-dialog {
- width: 750px;
-}
-@media (max-width: 767px) {
- body[data-route="pos"] .modal-dialog {
- width: auto;
- }
- body[data-route="pos"] .modal-dialog .modal-content {
- height: auto;
- }
-}
-@media (max-width: 767px) {
- body[data-route="pos"] .amount-row h3 {
- font-size: 15px;
- }
- body[data-route="pos"] .pos-keyboard-key,
- body[data-route="pos"] .delete-btn {
- height: 50px;
- }
- body[data-route="pos"] .multimode-payments {
- padding-left: 15px;
- }
- body[data-route="pos"] .payment-toolbar {
- padding-right: 15px;
- }
-}
-body[data-route="pos"] .amount-label {
- font-size: 16px;
-}
-body[data-route="pos"] .selected-payment-mode {
- background-color: #fafbfc;
- cursor: pointer;
-}
-body[data-route="pos"] .pos-invoice-list {
- padding: 15px 10px;
-}
-body[data-route="pos"] .write_off_amount,
-body[data-route="pos"] .change_amount {
- margin: 15px;
- width: 130px;
-}
-body[data-route="pos"] .pos-list-row {
- display: table;
- table-layout: fixed;
- width: 100%;
- padding: 9px 15px;
- font-size: 12px;
- margin: 0px;
- border-bottom: 1px solid #d1d8dd;
-}
-body[data-route="pos"] .pos-list-row .cell {
- display: table-cell;
- vertical-align: middle;
-}
-body[data-route="pos"] .pos-list-row .cell.price-cell {
- width: 50%;
-}
-body[data-route="pos"] .pos-list-row .subject {
- width: 40%;
-}
-body[data-route="pos"] .pos-list-row .list-row-checkbox,
-body[data-route="pos"] .pos-list-row .list-select-all {
- margin-right: 7px;
-}
-body[data-route="pos"] .pos-bill-header {
- background-color: #f5f7fa;
- border: 1px solid #d1d8dd;
- padding: 13px 15px;
-}
-body[data-route="pos"] .pos-list-row.active {
- background-color: #fffce7;
-}
-body[data-route="pos"] .totals-area {
- border-right: 1px solid #d1d8dd;
- border-left: 1px solid #d1d8dd;
- margin-bottom: 15px;
-}
-body[data-route="pos"] .tax-area .pos-list-row {
- border: none;
-}
-body[data-route="pos"] .item-cart-items {
- height: calc(100vh - 526px);
- overflow: auto;
- border: 1px solid #d1d8dd;
- border-top: none;
-}
-@media (max-width: 767px) {
- body[data-route="pos"] .item-cart-items {
- height: 30vh;
- }
-}
-body[data-route="pos"] .no-items-message {
- min-height: 200px;
- display: flex;
- align-items: center;
- justify-content: center;
- height: 100%;
-}
-body[data-route="pos"] .pos-list-row:last-child {
- border-bottom: none;
-}
-body[data-route="pos"] .form-section-heading {
- padding: 0;
-}
-body[data-route="pos"] .item-list {
- border: 1px solid #d1d8dd;
- border-top: none;
- max-height: calc(100vh - 190px);
- overflow: auto;
-}
-@media (max-width: 767px) {
- body[data-route="pos"] .item-list {
- max-height: initial;
- }
-}
-body[data-route="pos"] .item-list .image-field {
- height: 140px;
-}
-body[data-route="pos"] .item-list .image-field .placeholder-text {
- font-size: 50px;
-}
-body[data-route="pos"] .item-list .pos-item-wrapper {
- position: relative;
-}
-body[data-route="pos"] .pos-bill-toolbar {
- margin-top: 10px;
-}
-body[data-route="pos"] .search-item .form-group {
- margin: 0;
-}
-body[data-route="pos"] .item-list-area .pos-bill-header {
- padding: 5px;
- padding-left: 15px;
-}
-body[data-route="pos"] .pos-selected-item-action .pos-list-row:first-child {
- padding-top: 0;
-}
-body[data-route="pos"] .pos-selected-item-action > .pos-list-row {
- border: none;
-}
-@media (max-width: 1199px) {
- body[data-route="pos"] .pos-selected-item-action > .pos-list-row {
- padding: 5px 15px;
- }
-}
-body[data-route="pos"] .edit-customer-btn {
- position: absolute;
- right: 57px;
- top: 15px;
- z-index: 100;
-}
-body[data-route="pos"] .btn-more {
- display: flex;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- background-color: #fafbfc;
- min-height: 200px;
-}
-body[data-route="pos"] .collapse-btn {
- cursor: pointer;
-}
-@media (max-width: 767px) {
- body[data-route="pos"] .page-actions {
- max-width: 110px;
- }
-}
-.price-info {
- position: absolute;
- left: 0;
- bottom: 0;
- margin: 0 0 15px 15px;
- background-color: rgba(141, 153, 166, 0.6);
- padding: 5px 9px;
- border-radius: 3px;
- color: #fff;
-}
-.leaderboard .result {
- border-top: 1px solid #d1d8dd;
-}
-.leaderboard .list-item {
- padding-left: 45px;
-}
-.leaderboard .list-item_content {
- padding-right: 45px;
-}
-.exercise-card {
- box-shadow: 0 1px 3px rgba(0,0,0,0.30);
- border-radius: 2px;
- padding: 6px 6px 6px 8px;
- margin-top: 10px;
- height: 100% !important;
-}
-.exercise-card .card-img-top {
- width: 100%;
- height: 15vw;
- object-fit: cover;
-}
-.exercise-card .btn-edit {
- position: absolute;
- bottom: 10px;
- left: 20px;
-}
-.exercise-card .btn-del {
- position: absolute;
- bottom: 10px;
- left: 50px;
-}
-.exercise-card .card-body {
- margin-bottom: 10px;
-}
-.exercise-card .card-footer {
- padding: 10px;
-}
-.exercise-row {
- height: 100% !important;
- display: flex;
- flex-wrap: wrap;
-}
-.exercise-col {
- padding: 10px;
-}
diff --git a/erpnext/public/css/leaflet/leaflet.css b/erpnext/public/css/leaflet/leaflet.css
deleted file mode 100755
index 979a8bd712b..00000000000
--- a/erpnext/public/css/leaflet/leaflet.css
+++ /dev/null
@@ -1,611 +0,0 @@
-/* required styles */
-
-.leaflet-pane,
-.leaflet-tile,
-.leaflet-marker-icon,
-.leaflet-marker-shadow,
-.leaflet-tile-container,
-.leaflet-map-pane svg,
-.leaflet-map-pane canvas,
-.leaflet-zoom-box,
-.leaflet-image-layer,
-.leaflet-layer {
- position: absolute;
- left: 0;
- top: 0;
-}
-
-.leaflet-container {
- overflow: hidden;
- -ms-touch-action: none;
- touch-action: none;
-}
-
-.leaflet-tile,
-.leaflet-marker-icon,
-.leaflet-marker-shadow {
- -webkit-user-select: none;
- -moz-user-select: none;
- user-select: none;
- -webkit-user-drag: none;
-}
-
-
-/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
-
-.leaflet-safari .leaflet-tile {
- image-rendering: -webkit-optimize-contrast;
-}
-
-
-/* hack that prevents hw layers "stretching" when loading new tiles */
-
-.leaflet-safari .leaflet-tile-container {
- width: 1600px;
- height: 1600px;
- -webkit-transform-origin: 0 0;
-}
-
-.leaflet-marker-icon,
-.leaflet-marker-shadow {
- display: block;
-}
-
-
-/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
-
-
-/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
-
-.leaflet-container .leaflet-overlay-pane svg,
-.leaflet-container .leaflet-marker-pane img,
-.leaflet-container .leaflet-tile-pane img,
-.leaflet-container img.leaflet-image-layer {
- max-width: none !important;
-}
-
-.leaflet-tile {
- filter: inherit;
- visibility: hidden;
-}
-
-.leaflet-tile-loaded {
- visibility: inherit;
-}
-
-.leaflet-zoom-box {
- width: 0;
- height: 0;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- z-index: 800;
-}
-
-
-/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
-
-.leaflet-overlay-pane svg {
- -moz-user-select: none;
-}
-
-.leaflet-pane {
- z-index: 400;
-}
-
-.leaflet-tile-pane {
- z-index: 200;
-}
-
-.leaflet-overlay-pane {
- z-index: 400;
-}
-
-.leaflet-shadow-pane {
- z-index: 500;
-}
-
-.leaflet-marker-pane {
- z-index: 600;
-}
-
-.leaflet-popup-pane {
- z-index: 700;
-}
-
-.leaflet-map-pane canvas {
- z-index: 100;
-}
-
-.leaflet-map-pane svg {
- z-index: 200;
-}
-
-.leaflet-vml-shape {
- width: 1px;
- height: 1px;
-}
-
-.lvml {
- behavior: url(#default#VML);
- display: inline-block;
- position: absolute;
-}
-
-
-/* control positioning */
-
-.leaflet-control {
- position: relative;
- z-index: 800;
- pointer-events: auto;
-}
-
-.leaflet-top,
-.leaflet-bottom {
- position: absolute;
- z-index: 1000;
- pointer-events: none;
-}
-
-.leaflet-top {
- top: 0;
-}
-
-.leaflet-right {
- right: 0;
-}
-
-.leaflet-bottom {
- bottom: 0;
-}
-
-.leaflet-left {
- left: 0;
-}
-
-.leaflet-control {
- float: left;
- clear: both;
-}
-
-.leaflet-right .leaflet-control {
- float: right;
-}
-
-.leaflet-top .leaflet-control {
- margin-top: 10px;
-}
-
-.leaflet-bottom .leaflet-control {
- margin-bottom: 10px;
-}
-
-.leaflet-left .leaflet-control {
- margin-left: 10px;
-}
-
-.leaflet-right .leaflet-control {
- margin-right: 10px;
-}
-
-
-/* zoom and fade animations */
-
-.leaflet-fade-anim .leaflet-tile {
- will-change: opacity;
-}
-
-.leaflet-fade-anim .leaflet-popup {
- opacity: 0;
- -webkit-transition: opacity 0.2s linear;
- -moz-transition: opacity 0.2s linear;
- -o-transition: opacity 0.2s linear;
- transition: opacity 0.2s linear;
-}
-
-.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
- opacity: 1;
-}
-
-.leaflet-zoom-animated {
- -webkit-transform-origin: 0 0;
- -ms-transform-origin: 0 0;
- transform-origin: 0 0;
-}
-
-.leaflet-zoom-anim .leaflet-zoom-animated {
- will-change: transform;
-}
-
-.leaflet-zoom-anim .leaflet-zoom-animated {
- -webkit-transition: -webkit-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
- -moz-transition: -moz-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
- -o-transition: -o-transform 0.25s cubic-bezier(0, 0, 0.25, 1);
- transition: transform 0.25s cubic-bezier(0, 0, 0.25, 1);
-}
-
-.leaflet-zoom-anim .leaflet-tile,
-.leaflet-pan-anim .leaflet-tile {
- -webkit-transition: none;
- -moz-transition: none;
- -o-transition: none;
- transition: none;
-}
-
-.leaflet-zoom-anim .leaflet-zoom-hide {
- visibility: hidden;
-}
-
-
-/* cursors */
-
-.leaflet-interactive {
- cursor: pointer;
-}
-
-.leaflet-grab {
- cursor: -webkit-grab;
- cursor: -moz-grab;
-}
-
-.leaflet-crosshair,
-.leaflet-crosshair .leaflet-interactive {
- cursor: crosshair;
-}
-
-.leaflet-popup-pane,
-.leaflet-control {
- cursor: auto;
-}
-
-.leaflet-dragging .leaflet-grab,
-.leaflet-dragging .leaflet-grab .leaflet-interactive,
-.leaflet-dragging .leaflet-marker-draggable {
- cursor: move;
- cursor: -webkit-grabbing;
- cursor: -moz-grabbing;
-}
-
-
-/* visual tweaks */
-
-.leaflet-container {
- background: #ddd;
- outline: 0;
-}
-
-.leaflet-container a {
- color: #0078A8;
-}
-
-.leaflet-container a.leaflet-active {
- outline: 2px solid orange;
-}
-
-.leaflet-zoom-box {
- border: 2px dotted #38f;
- background: rgba(255, 255, 255, 0.5);
-}
-
-
-/* general typography */
-
-.leaflet-container {
- font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
-}
-
-
-/* general toolbar styles */
-
-.leaflet-bar {
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
- border-radius: 4px;
-}
-
-.leaflet-bar a,
-.leaflet-bar a:hover {
- background-color: #fff;
- border-bottom: 1px solid #ccc;
- width: 26px;
- height: 26px;
- line-height: 26px;
- display: block;
- text-align: center;
- text-decoration: none;
- color: black;
-}
-
-.leaflet-bar a,
-.leaflet-control-layers-toggle {
- background-position: 50% 50%;
- background-repeat: no-repeat;
- display: block;
-}
-
-.leaflet-bar a:hover {
- background-color: #f4f4f4;
-}
-
-.leaflet-bar a:first-child {
- border-top-left-radius: 4px;
- border-top-right-radius: 4px;
-}
-
-.leaflet-bar a:last-child {
- border-bottom-left-radius: 4px;
- border-bottom-right-radius: 4px;
- border-bottom: none;
-}
-
-.leaflet-bar a.leaflet-disabled {
- cursor: default;
- background-color: #f4f4f4;
- color: #bbb;
-}
-
-.leaflet-touch .leaflet-bar a {
- width: 30px;
- height: 30px;
- line-height: 30px;
-}
-
-
-/* zoom control */
-
-.leaflet-control-zoom-in,
-.leaflet-control-zoom-out {
- font: bold 18px 'Lucida Console', Monaco, monospace;
- text-indent: 1px;
-}
-
-.leaflet-control-zoom-out {
- font-size: 20px;
-}
-
-.leaflet-touch .leaflet-control-zoom-in {
- font-size: 22px;
-}
-
-.leaflet-touch .leaflet-control-zoom-out {
- font-size: 24px;
-}
-
-
-/* layers control */
-
-.leaflet-control-layers {
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
- background: #fff;
- border-radius: 5px;
-}
-
-.leaflet-control-layers-toggle {
- background-image: url('assets/erpnext/images/leaflet/layers.png');
- width: 36px;
- height: 36px;
-}
-
-.leaflet-retina .leaflet-control-layers-toggle {
- background-image: url('assets/erpnext/images/leaflet/layers-2x.png');
- background-size: 26px 26px;
-}
-
-.leaflet-touch .leaflet-control-layers-toggle {
- width: 44px;
- height: 44px;
-}
-
-.leaflet-control-layers .leaflet-control-layers-list,
-.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
- display: none;
-}
-
-.leaflet-control-layers-expanded .leaflet-control-layers-list {
- display: block;
- position: relative;
-}
-
-.leaflet-control-layers-expanded {
- padding: 6px 10px 6px 6px;
- color: #333;
- background: #fff;
-}
-
-.leaflet-control-layers-scrollbar {
- overflow-y: scroll;
- padding-right: 5px;
-}
-
-.leaflet-control-layers-selector {
- margin-top: 2px;
- position: relative;
- top: 1px;
-}
-
-.leaflet-control-layers label {
- display: block;
-}
-
-.leaflet-control-layers-separator {
- height: 0;
- border-top: 1px solid #ddd;
- margin: 5px -10px 5px -6px;
-}
-
-
-/* attribution and scale controls */
-
-.leaflet-container .leaflet-control-attribution {
- background: #fff;
- background: rgba(255, 255, 255, 0.7);
- margin: 0;
-}
-
-.leaflet-control-attribution,
-.leaflet-control-scale-line {
- padding: 0 5px;
- color: #333;
-}
-
-.leaflet-control-attribution a {
- text-decoration: none;
-}
-
-.leaflet-control-attribution a:hover {
- text-decoration: underline;
-}
-
-.leaflet-container .leaflet-control-attribution,
-.leaflet-container .leaflet-control-scale {
- font-size: 11px;
-}
-
-.leaflet-left .leaflet-control-scale {
- margin-left: 5px;
-}
-
-.leaflet-bottom .leaflet-control-scale {
- margin-bottom: 5px;
-}
-
-.leaflet-control-scale-line {
- border: 2px solid #777;
- border-top: none;
- line-height: 1.1;
- padding: 2px 5px 1px;
- font-size: 11px;
- white-space: nowrap;
- overflow: hidden;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- background: #fff;
- background: rgba(255, 255, 255, 0.5);
-}
-
-.leaflet-control-scale-line:not(:first-child) {
- border-top: 2px solid #777;
- border-bottom: none;
- margin-top: -2px;
-}
-
-.leaflet-control-scale-line:not(:first-child):not(:last-child) {
- border-bottom: 2px solid #777;
-}
-
-.leaflet-touch .leaflet-control-attribution,
-.leaflet-touch .leaflet-control-layers,
-.leaflet-touch .leaflet-bar {
- box-shadow: none;
-}
-
-.leaflet-touch .leaflet-control-layers,
-.leaflet-touch .leaflet-bar {
- border: 2px solid rgba(0, 0, 0, 0.2);
- background-clip: padding-box;
-}
-
-
-/* popup */
-
-.leaflet-popup {
- position: absolute;
- text-align: center;
-}
-
-.leaflet-popup-content-wrapper {
- padding: 1px;
- text-align: left;
- border-radius: 12px;
-}
-
-.leaflet-popup-content {
- margin: 13px 19px;
- line-height: 1.4;
-}
-
-.leaflet-popup-content p {
- margin: 18px 0;
-}
-
-.leaflet-popup-tip-container {
- margin: 0 auto;
- width: 40px;
- height: 20px;
- position: relative;
- overflow: hidden;
-}
-
-.leaflet-popup-tip {
- width: 17px;
- height: 17px;
- padding: 1px;
- margin: -10px auto 0;
- -webkit-transform: rotate(45deg);
- -moz-transform: rotate(45deg);
- -ms-transform: rotate(45deg);
- -o-transform: rotate(45deg);
- transform: rotate(45deg);
-}
-
-.leaflet-popup-content-wrapper,
-.leaflet-popup-tip {
- background: white;
- color: #333;
- box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
-}
-
-.leaflet-container a.leaflet-popup-close-button {
- position: absolute;
- top: 0;
- right: 0;
- padding: 4px 4px 0 0;
- border: none;
- text-align: center;
- width: 18px;
- height: 14px;
- font: 16px/14px Tahoma, Verdana, sans-serif;
- color: #c3c3c3;
- text-decoration: none;
- font-weight: bold;
- background: transparent;
-}
-
-.leaflet-container a.leaflet-popup-close-button:hover {
- color: #999;
-}
-
-.leaflet-popup-scrolled {
- overflow: auto;
- border-bottom: 1px solid #ddd;
- border-top: 1px solid #ddd;
-}
-
-.leaflet-oldie .leaflet-popup-content-wrapper {
- zoom: 1;
-}
-
-.leaflet-oldie .leaflet-popup-tip {
- width: 24px;
- margin: 0 auto;
- -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
- filter: progid: DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
-}
-
-.leaflet-oldie .leaflet-popup-tip-container {
- margin-top: -1px;
-}
-
-.leaflet-oldie .leaflet-control-zoom,
-.leaflet-oldie .leaflet-control-layers,
-.leaflet-oldie .leaflet-popup-content-wrapper,
-.leaflet-oldie .leaflet-popup-tip {
- border: 1px solid #999;
-}
-
-
-/* div icon */
-
-.leaflet-div-icon {
- background: #fff;
- border: 1px solid #666;
-}
\ No newline at end of file
diff --git a/erpnext/public/css/leaflet/leaflet.draw.css b/erpnext/public/css/leaflet/leaflet.draw.css
deleted file mode 100755
index 6fb7db0e64a..00000000000
--- a/erpnext/public/css/leaflet/leaflet.draw.css
+++ /dev/null
@@ -1,316 +0,0 @@
-/* ================================================================== */
-
-
-/* Toolbars
-/* ================================================================== */
-
-.leaflet-draw-section {
- position: relative;
-}
-
-.leaflet-draw-toolbar {
- margin-top: 12px;
-}
-
-.leaflet-draw-toolbar-top {
- margin-top: 0;
-}
-
-.leaflet-draw-toolbar-notop a:first-child {
- border-top-right-radius: 0;
-}
-
-.leaflet-draw-toolbar-nobottom a:last-child {
- border-bottom-right-radius: 0;
-}
-
-.leaflet-draw-toolbar a {
- background-image: url('assets/erpnext/images/leaflet/spritesheet.png');
- background-repeat: no-repeat;
-}
-
-.leaflet-retina .leaflet-draw-toolbar a {
- background-image: url('assets/erpnext/images/leaflet/spritesheet-2x.png');
- background-size: 270px 30px;
-}
-
-.leaflet-draw a {
- display: block;
- text-align: center;
- text-decoration: none;
-}
-
-
-/* ================================================================== */
-
-
-/* Toolbar actions menu
-/* ================================================================== */
-
-.leaflet-draw-actions {
- display: none;
- list-style: none;
- margin: 0;
- padding: 0;
- position: absolute;
- left: 26px;
- /* leaflet-draw-toolbar.left + leaflet-draw-toolbar.width */
- top: 0;
- white-space: nowrap;
-}
-
-.leaflet-right .leaflet-draw-actions {
- right: 26px;
- left: auto;
-}
-
-.leaflet-draw-actions li {
- display: inline-block;
-}
-
-.leaflet-draw-actions li:first-child a {
- border-left: none;
-}
-
-.leaflet-draw-actions li:last-child a {
- -webkit-border-radius: 0 4px 4px 0;
- border-radius: 0 4px 4px 0;
-}
-
-.leaflet-right .leaflet-draw-actions li:last-child a {
- -webkit-border-radius: 0;
- border-radius: 0;
-}
-
-.leaflet-right .leaflet-draw-actions li:first-child a {
- -webkit-border-radius: 4px 0 0 4px;
- border-radius: 4px 0 0 4px;
-}
-
-.leaflet-draw-actions a {
- background-color: #919187;
- border-left: 1px solid #AAA;
- color: #FFF;
- font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif;
- line-height: 28px;
- text-decoration: none;
- padding-left: 10px;
- padding-right: 10px;
- height: 28px;
-}
-
-.leaflet-draw-actions-bottom {
- margin-top: 0;
-}
-
-.leaflet-draw-actions-top {
- margin-top: 1px;
-}
-
-.leaflet-draw-actions-top a,
-.leaflet-draw-actions-bottom a {
- height: 27px;
- line-height: 27px;
-}
-
-.leaflet-draw-actions a:hover {
- background-color: #A0A098;
-}
-
-.leaflet-draw-actions-top.leaflet-draw-actions-bottom a {
- height: 26px;
- line-height: 26px;
-}
-
-
-/* ================================================================== */
-
-
-/* Draw toolbar
-/* ================================================================== */
-
-.leaflet-draw-toolbar .leaflet-draw-draw-polyline {
- background-position: -2px -2px;
-}
-
-.leaflet-draw-toolbar .leaflet-draw-draw-polygon {
- background-position: -31px -2px;
-}
-
-.leaflet-draw-toolbar .leaflet-draw-draw-rectangle {
- background-position: -62px -2px;
-}
-
-.leaflet-draw-toolbar .leaflet-draw-draw-circle {
- background-position: -92px -2px;
-}
-
-.leaflet-draw-toolbar .leaflet-draw-draw-marker {
- background-position: -122px -2px;
-}
-
-
-/* ================================================================== */
-
-
-/* Edit toolbar
-/* ================================================================== */
-
-.leaflet-draw-toolbar .leaflet-draw-edit-edit {
- background-position: -152px -2px;
-}
-
-.leaflet-draw-toolbar .leaflet-draw-edit-remove {
- background-position: -182px -2px;
-}
-
-.leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled {
- background-position: -212px -2px;
-}
-
-.leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled {
- background-position: -242px -2px;
-}
-
-
-/* ================================================================== */
-
-
-/* Drawing styles
-/* ================================================================== */
-
-.leaflet-mouse-marker {
- background-color: #fff;
- cursor: crosshair;
-}
-
-.leaflet-draw-tooltip {
- background: rgb(54, 54, 54);
- background: rgba(0, 0, 0, 0.5);
- border: 1px solid transparent;
- -webkit-border-radius: 4px;
- border-radius: 4px;
- color: #fff;
- font: 12px/18px "Helvetica Neue", Arial, Helvetica, sans-serif;
- margin-left: 20px;
- margin-top: -21px;
- padding: 4px 8px;
- position: absolute;
- visibility: hidden;
- white-space: nowrap;
- z-index: 6;
-}
-
-.leaflet-draw-tooltip:before {
- border-right: 6px solid black;
- border-right-color: rgba(0, 0, 0, 0.5);
- border-top: 6px solid transparent;
- border-bottom: 6px solid transparent;
- content: "";
- position: absolute;
- top: 7px;
- left: -7px;
-}
-
-.leaflet-error-draw-tooltip {
- background-color: #F2DEDE;
- border: 1px solid #E6B6BD;
- color: #B94A48;
-}
-
-.leaflet-error-draw-tooltip:before {
- border-right-color: #E6B6BD;
-}
-
-.leaflet-draw-tooltip-single {
- margin-top: -12px
-}
-
-.leaflet-draw-tooltip-subtext {
- color: #f8d5e4;
-}
-
-.leaflet-draw-guide-dash {
- font-size: 1%;
- opacity: 0.6;
- position: absolute;
- width: 5px;
- height: 5px;
-}
-
-
-/* ================================================================== */
-
-
-/* Edit styles
-/* ================================================================== */
-
-.leaflet-edit-marker-selected {
- background: rgba(254, 87, 161, 0.1);
- border: 4px dashed rgba(254, 87, 161, 0.6);
- -webkit-border-radius: 4px;
- border-radius: 4px;
-}
-
-.leaflet-edit-move {
- cursor: move;
-}
-
-.leaflet-edit-resize {
- cursor: pointer;
-}
-
-
-/* ================================================================== */
-
-
-/* Old IE styles
-/* ================================================================== */
-
-.leaflet-oldie .leaflet-draw-toolbar {
- border: 3px solid #999;
-}
-
-.leaflet-oldie .leaflet-draw-toolbar a {
- background-color: #eee;
-}
-
-.leaflet-oldie .leaflet-draw-toolbar a:hover {
- background-color: #fff;
-}
-
-.leaflet-oldie .leaflet-draw-actions {
- left: 32px;
- margin-top: 3px;
-}
-
-.leaflet-oldie .leaflet-draw-actions li {
- display: inline;
- zoom: 1;
-}
-
-.leaflet-oldie .leaflet-edit-marker-selected {
- border: 4px dashed #fe93c2;
-}
-
-.leaflet-oldie .leaflet-draw-actions a {
- background-color: #999;
-}
-
-.leaflet-oldie .leaflet-draw-actions a:hover {
- background-color: #a5a5a5;
-}
-
-.leaflet-oldie .leaflet-draw-actions-top a {
- margin-top: 1px;
-}
-
-.leaflet-oldie .leaflet-draw-actions-bottom a {
- height: 28px;
- line-height: 28px;
-}
-
-.leaflet-oldie .leaflet-draw-actions-top.leaflet-draw-actions-bottom a {
- height: 27px;
- line-height: 27px;
-}
\ No newline at end of file
diff --git a/erpnext/public/js/account_tree_grid.js b/erpnext/public/js/account_tree_grid.js
index 757f33eecce..413a5ee9719 100644
--- a/erpnext/public/js/account_tree_grid.js
+++ b/erpnext/public/js/account_tree_grid.js
@@ -14,9 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see
No payment mode selected in pos profile
").appendTo(multimode_payments) } - }, + } - set_outstanding_amount: function(){ + set_outstanding_amount(){ this.selected_mode = $(this.$body).find(repl("input[idx='%(idx)s']",{'idx': this.idx})); this.highlight_selected_row() this.payment_val = 0.0 @@ -99,47 +99,47 @@ erpnext.payments = erpnext.stock.StockController.extend({ } this.selected_mode.select() this.bind_amount_change_event(); - }, - - bind_keyboard_event: function(){ + } + + bind_keyboard_event(){ var me = this; this.payment_val = ''; this.bind_form_control_event(); this.bind_numeric_keys_event(); - }, + } - bind_form_control_event: function(){ + bind_form_control_event(){ var me = this; $(this.$body).find('.pos-payment-row').click(function(){ me.idx = $(this).attr("idx"); me.set_outstanding_amount() }) - + $(this.$body).find('.form-control').click(function(){ me.idx = $(this).attr("idx"); me.set_outstanding_amount(); me.update_paid_amount(true); }) - + $(this.$body).find('.write_off_amount').change(function(){ me.write_off_amount(flt($(this).val()), precision("write_off_amount")); }) - + $(this.$body).find('.change_amount').change(function(){ me.change_amount(flt($(this).val()), precision("change_amount")); }) - }, + } - highlight_selected_row: function(){ + highlight_selected_row(){ var me = this; var selected_row = $(this.$body).find(repl(".pos-payment-row[idx='%(idx)s']",{'idx': this.idx})); $(this.$body).find('.pos-payment-row').removeClass('selected-payment-mode') selected_row.addClass('selected-payment-mode') $(this.$body).find('.amount').attr('disabled', true); this.selected_mode.attr('disabled', false); - }, - - bind_numeric_keys_event: function(){ + } + + bind_numeric_keys_event(){ var me = this; $(this.$body).find('.pos-keyboard-key').click(function(){ me.payment_val += $(this).text(); @@ -147,7 +147,7 @@ erpnext.payments = erpnext.stock.StockController.extend({ me.idx = me.selected_mode.attr("idx") me.update_paid_amount() }) - + $(this.$body).find('.delete-btn').click(function(){ me.payment_val = cstr(flt(me.selected_mode.val())).slice(0, -1); me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency)); @@ -155,9 +155,9 @@ erpnext.payments = erpnext.stock.StockController.extend({ me.update_paid_amount(); }) - }, - - bind_amount_change_event: function(){ + } + + bind_amount_change_event(){ var me = this; this.selected_mode.change(function(){ me.payment_val = flt($(this).val()) || 0.0; @@ -165,9 +165,9 @@ erpnext.payments = erpnext.stock.StockController.extend({ me.idx = me.selected_mode.attr("idx") me.update_payment_amount() }) - }, + } - clear_amount: function() { + clear_amount() { var me = this; $(this.$body).find('.clr').click(function(e){ e.stopPropagation(); @@ -178,9 +178,9 @@ erpnext.payments = erpnext.stock.StockController.extend({ me.highlight_selected_row(); me.update_payment_amount(); }) - }, + } - write_off_amount: function(write_off_amount) { + write_off_amount(write_off_amount) { var me = this; this.frm.doc.write_off_amount = flt(write_off_amount, precision("write_off_amount")); @@ -188,17 +188,17 @@ erpnext.payments = erpnext.stock.StockController.extend({ precision("base_write_off_amount")); this.calculate_outstanding_amount(false) this.show_amounts() - }, + } - change_amount: function(change_amount) { + change_amount(change_amount) { var me = this; this.frm.doc.change_amount = flt(change_amount, precision("change_amount")); this.calculate_write_off_amount() this.show_amounts() - }, + } - update_paid_amount: function(update_write_off) { + update_paid_amount(update_write_off) { var me = this; if(in_list(['change_amount', 'write_off_amount'], this.idx)){ var value = me.selected_mode.val(); @@ -213,9 +213,9 @@ erpnext.payments = erpnext.stock.StockController.extend({ }else{ this.update_payment_amount() } - }, + } - update_payment_amount: function(){ + update_payment_amount(){ var me = this; $.each(this.frm.doc.payments, function(index, data){ @@ -226,9 +226,9 @@ erpnext.payments = erpnext.stock.StockController.extend({ this.calculate_outstanding_amount(false); this.show_amounts(); - }, + } - show_amounts: function(){ + show_amounts(){ var me = this; $(this.$body).find(".write_off_amount").val(format_currency(this.frm.doc.write_off_amount, this.frm.doc.currency)); $(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency)); @@ -236,4 +236,4 @@ erpnext.payments = erpnext.stock.StockController.extend({ $(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, frappe.get_doc(":Company", this.frm.doc.company).default_currency)) this.update_invoice(); } -}) \ No newline at end of file +} diff --git a/erpnext/public/js/point-of-sale.bundle.js b/erpnext/public/js/point-of-sale.bundle.js new file mode 100644 index 00000000000..fbc4bbbbb36 --- /dev/null +++ b/erpnext/public/js/point-of-sale.bundle.js @@ -0,0 +1,8 @@ +import "../../selling/page/point_of_sale/pos_item_selector.js"; +import "../../selling/page/point_of_sale/pos_item_cart.js"; +import "../../selling/page/point_of_sale/pos_item_details.js"; +import "../../selling/page/point_of_sale/pos_number_pad.js"; +import "../../selling/page/point_of_sale/pos_payment.js"; +import "../../selling/page/point_of_sale/pos_past_order_list.js"; +import "../../selling/page/point_of_sale/pos_past_order_summary.js"; +import "../../selling/page/point_of_sale/pos_controller.js"; diff --git a/erpnext/public/js/stock_analytics.js b/erpnext/public/js/stock_analytics.js index 140c9dc90b6..dfe2c88ea82 100644 --- a/erpnext/public/js/stock_analytics.js +++ b/erpnext/public/js/stock_analytics.js @@ -2,8 +2,8 @@ // License: GNU General Public License v3. See license.txt -erpnext.StockAnalytics = erpnext.StockGridReport.extend({ - init: function(wrapper, opts) { +erpnext.StockAnalytics = class StockAnalytics extends erpnext.StockGridReport { + constructor(wrapper, opts) { var args = { title: __("Stock Analytics"), parent: $(wrapper).find('.layout-main'), @@ -30,9 +30,33 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({ if(opts) $.extend(args, opts); - this._super(args); - }, - setup_columns: function() { + super(args); + + this.filters = [ + {fieldtype:"Select", label: __("Value or Qty"), fieldname: "value_or_qty", + options:[{label:__("Value"), value:"Value"}, {label:__("Quantity"), value:"Quantity"}], + filter: function(val, item, opts, me) { + return me.apply_zero_filter(val, item, opts, me); + }}, + {fieldtype:"Select", label: __("Brand"), link:"Brand", fieldname: "brand", + default_value: __("Select Brand..."), filter: function(val, item, opts) { + return val == opts.default_value || item.brand == val || item._show; + }, link_formatter: {filter_input: "brand"}}, + {fieldtype:"Select", label: __("Warehouse"), link:"Warehouse", fieldname: "warehouse", + default_value: __("Select Warehouse...")}, + {fieldtype:"Date", label: __("From Date"), fieldname: "from_date"}, + {fieldtype:"Date", label: __("To Date"), fieldname: "to_date"}, + {fieldtype:"Select", label: __("Range"), fieldname: "range", + options:[ + {label:__("Daily"), value:"Daily"}, + {label:__("Weekly"), value:"Weekly"}, + {label:__("Monthly"), value:"Monthly"}, + {label:__("Quarterly"), value:"Quarterly"}, + {label:__("Yearly"), value:"Yearly"}, + ]} + ]; + } + setup_columns() { var std_columns = [ {id: "name", name: __("Item"), field: "name", width: 300}, {id: "brand", name: __("Brand"), field: "brand", width: 100}, @@ -43,43 +67,21 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({ this.make_date_range_columns(); this.columns = std_columns.concat(this.columns); - }, - filters: [ - {fieldtype:"Select", label: __("Value or Qty"), fieldname: "value_or_qty", - options:[{label:__("Value"), value:"Value"}, {label:__("Quantity"), value:"Quantity"}], - filter: function(val, item, opts, me) { - return me.apply_zero_filter(val, item, opts, me); - }}, - {fieldtype:"Select", label: __("Brand"), link:"Brand", fieldname: "brand", - default_value: __("Select Brand..."), filter: function(val, item, opts) { - return val == opts.default_value || item.brand == val || item._show; - }, link_formatter: {filter_input: "brand"}}, - {fieldtype:"Select", label: __("Warehouse"), link:"Warehouse", fieldname: "warehouse", - default_value: __("Select Warehouse...")}, - {fieldtype:"Date", label: __("From Date"), fieldname: "from_date"}, - {fieldtype:"Date", label: __("To Date"), fieldname: "to_date"}, - {fieldtype:"Select", label: __("Range"), fieldname: "range", - options:[ - {label:__("Daily"), value:"Daily"}, - {label:__("Weekly"), value:"Weekly"}, - {label:__("Monthly"), value:"Monthly"}, - {label:__("Quarterly"), value:"Quarterly"}, - {label:__("Yearly"), value:"Yearly"}, - ]} - ], - setup_filters: function() { + } + + setup_filters() { var me = this; - this._super(); + super.setup_filters(); this.trigger_refresh_on_change(["value_or_qty", "brand", "warehouse", "range"]); this.show_zero_check(); - }, - init_filter_values: function() { - this._super(); + } + init_filter_values() { + super.init_filter_values(); this.filter_inputs.range && this.filter_inputs.range.val('Monthly'); - }, - prepare_data: function() { + } + prepare_data() { var me = this; if(!this.data) { @@ -112,8 +114,8 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({ this.prepare_balances(); this.update_groups(); - }, - prepare_balances: function() { + } + prepare_balances() { var me = this; var from_date = frappe.datetime.str_to_obj(this.from_date); var to_date = frappe.datetime.str_to_obj(this.to_date); @@ -164,8 +166,8 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({ item.closing_qty_value += diff; } } - }, - update_groups: function() { + } + update_groups() { var me = this; $.each(this.data, function(i, item) { // update groups @@ -192,8 +194,8 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({ } } }); - }, - show_stock_ledger: function(item_code) { + } + show_stock_ledger(item_code) { frappe.route_options = { item_code: item_code, from_date: this.from_date, @@ -201,5 +203,5 @@ erpnext.StockAnalytics = erpnext.StockGridReport.extend({ }; frappe.set_route("query-report", "Stock Ledger"); } -}); +}; diff --git a/erpnext/public/js/stock_grid_report.js b/erpnext/public/js/stock_grid_report.js index 832fd3eccf6..752fafdb971 100644 --- a/erpnext/public/js/stock_grid_report.js +++ b/erpnext/public/js/stock_grid_report.js @@ -1,16 +1,16 @@ // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt -erpnext.StockGridReport = frappe.views.TreeGridReport.extend({ - get_item_warehouse: function(warehouse, item) { +erpnext.StockGridReport = class StockGridReport extends frappe.views.TreeGridReport { + get_item_warehouse(warehouse, item) { if(!this.item_warehouse[item]) this.item_warehouse[item] = {}; if(!this.item_warehouse[item][warehouse]) this.item_warehouse[item][warehouse] = { balance_qty: 0.0, balance_value: 0.0, fifo_stack: [] }; return this.item_warehouse[item][warehouse]; - }, + } - get_value_diff: function(wh, sl, is_fifo) { + get_value_diff(wh, sl, is_fifo) { // value if(sl.qty > 0) { // incoming - rate is given @@ -59,8 +59,8 @@ erpnext.StockGridReport = frappe.views.TreeGridReport.extend({ wh.balance_qty += sl.qty; wh.balance_value += value_diff; return value_diff; - }, - get_fifo_value_diff: function(wh, sl) { + } + get_fifo_value_diff(wh, sl) { // get exact rate from fifo stack var fifo_stack = (wh.fifo_stack || []).reverse(); var fifo_value_diff = 0.0; @@ -89,9 +89,9 @@ erpnext.StockGridReport = frappe.views.TreeGridReport.extend({ // reset the updated stack wh.fifo_stack = fifo_stack.reverse(); return -fifo_value_diff; - }, + } - get_serialized_value_diff: function(sl) { + get_serialized_value_diff(sl) { var me = this; var value_diff = 0.0; @@ -103,9 +103,9 @@ erpnext.StockGridReport = frappe.views.TreeGridReport.extend({ }); return value_diff; - }, + } - get_serialized_buying_rates: function() { + get_serialized_buying_rates() { var serialized_buying_rates = {}; if (frappe.report_dump.data["Serial No"]) { @@ -115,5 +115,5 @@ erpnext.StockGridReport = frappe.views.TreeGridReport.extend({ } return serialized_buying_rates; - }, -}); + } +}; diff --git a/erpnext/public/js/telephony.js b/erpnext/public/js/telephony.js index 9548d6c5f36..1c3e3147976 100644 --- a/erpnext/public/js/telephony.js +++ b/erpnext/public/js/telephony.js @@ -1,19 +1,19 @@ -frappe.ui.form.ControlData = frappe.ui.form.ControlData.extend( { +frappe.ui.form.ControlData = class ControlData extends frappe.ui.form.ControlData { make_input() { - this._super(); + super.make_input(); if (this.df.options == 'Phone') { this.setup_phone(); } if (this.frm && this.frm.fields_dict) { Object.values(this.frm.fields_dict).forEach(function(field) { - if (field.df.read_only === 1 && field.df.options === 'Phone' + if (field.df.read_only === 1 && field.df.options === 'Phone' && field.disp_area.style[0] != 'display' && !field.has_icon) { field.setup_phone(); field.has_icon = true; } }); } - }, + } setup_phone() { if (frappe.phone_call.handler) { let control = this.df.read_only ? '.control-value' : '.control-input'; @@ -30,4 +30,4 @@ frappe.ui.form.ControlData = frappe.ui.form.ControlData.extend( { }); } } -}); +}; diff --git a/erpnext/public/js/utils/customer_quick_entry.js b/erpnext/public/js/utils/customer_quick_entry.js index ebe6cd98f81..efb8dd9d5ca 100644 --- a/erpnext/public/js/utils/customer_quick_entry.js +++ b/erpnext/public/js/utils/customer_quick_entry.js @@ -1,17 +1,17 @@ frappe.provide('frappe.ui.form'); -frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ - init: function(doctype, after_insert) { +frappe.ui.form.CustomerQuickEntryForm = class CustomerQuickEntryForm extends frappe.ui.form.QuickEntryForm { + constructor(doctype, after_insert) { + super(doctype, after_insert); this.skip_redirect_on_error = true; - this._super(doctype, after_insert); - }, + } - render_dialog: function() { + render_dialog() { this.mandatory = this.mandatory.concat(this.get_variant_fields()); - this._super(); - }, + super.render_dialog(); + } - get_variant_fields: function() { + get_variant_fields() { var variant_fields = [{ fieldtype: "Section Break", label: __("Primary Contact Details"), @@ -77,5 +77,5 @@ frappe.ui.form.CustomerQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ }]; return variant_fields; - }, -}) \ No newline at end of file + } +} diff --git a/erpnext/public/js/utils/item_quick_entry.js b/erpnext/public/js/utils/item_quick_entry.js index 27ef107acef..7e0198d33b3 100644 --- a/erpnext/public/js/utils/item_quick_entry.js +++ b/erpnext/public/js/utils/item_quick_entry.js @@ -1,27 +1,27 @@ frappe.provide('frappe.ui.form'); -frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ - init: function(doctype, after_insert) { - this._super(doctype, after_insert); - }, +frappe.ui.form.ItemQuickEntryForm = class ItemQuickEntryForm extends frappe.ui.form.QuickEntryForm { + constructor(doctype, after_insert) { + super(doctype, after_insert); + } - render_dialog: function() { + render_dialog() { this.mandatory = this.get_variant_fields().concat(this.mandatory); this.mandatory = this.mandatory.concat(this.get_attributes_fields()); this.check_naming_series_based_on(); - this._super(); + super.render_dialog(); this.init_post_render_dialog_operations(); this.preset_fields_for_template(); this.dialog.$wrapper.find('.edit-full').text(__('Edit in full page for more options like assets, serial nos, batches etc.')) - }, + } - check_naming_series_based_on: function() { + check_naming_series_based_on() { if (frappe.defaults.get_default("item_naming_by") === "Naming Series") { this.mandatory = this.mandatory.filter(d => d.fieldname !== "item_code"); } - }, + } - init_post_render_dialog_operations: function() { + init_post_render_dialog_operations() { this.dialog.fields_dict.attribute_html.$wrapper.append(frappe.render_template("item_quick_entry")); this.init_for_create_variant_trigger(); this.init_for_item_template_trigger(); @@ -29,9 +29,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ this.toggle_manufacturer_fields(); this.dialog.get_field("item_template").df.hidden = 1; this.dialog.get_field("item_template").refresh(); - }, + } - register_primary_action: function() { + register_primary_action() { var me = this; this.dialog.set_primary_action(__('Save'), function() { if (me.dialog.working) return; @@ -59,9 +59,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ me.insert(variant_values); } }); - }, + } - insert: function(variant_values) { + insert(variant_values) { let me = this; return new Promise(resolve => { frappe.call({ @@ -94,9 +94,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ freeze: true }); }); - }, + } - open_doc: function() { + open_doc() { this.dialog.hide(); this.update_doc(); if (this.dialog.fields_dict.create_variant.$input.prop("checked")) { @@ -106,9 +106,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ } else { frappe.set_route('Form', this.doctype, this.doc.name); } - }, + } - get_variant_fields: function() { + get_variant_fields() { var variant_fields = [{ fieldname: "create_variant", fieldtype: "Check", @@ -130,9 +130,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ }]; return variant_fields; - }, + } - get_manufacturing_fields: function() { + get_manufacturing_fields() { this.manufacturer_fields = [{ fieldtype: 'Link', options: 'Manufacturer', @@ -148,9 +148,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ reqd: 0 }]; return this.manufacturer_fields; - }, + } - get_attributes_fields: function() { + get_attributes_fields() { var attribute_fields = [{ fieldname: 'attribute_html', fieldtype: 'HTML' @@ -158,18 +158,18 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ attribute_fields = attribute_fields.concat(this.get_manufacturing_fields()); return attribute_fields; - }, + } - init_for_create_variant_trigger: function() { + init_for_create_variant_trigger() { var me = this; this.dialog.fields_dict.create_variant.$input.on("click", function() { me.preset_fields_for_template(); me.init_post_template_trigger_operations(false, [], true); }); - }, + } - preset_fields_for_template: function() { + preset_fields_for_template() { var for_variant = this.dialog.get_value('create_variant'); // setup template field, seen and mandatory if variant @@ -195,9 +195,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ f.refresh(); }); - }, + } - init_for_item_template_trigger: function() { + init_for_item_template_trigger() { var me = this; me.dialog.fields_dict["item_template"].df.onchange = () => { @@ -228,9 +228,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ me.init_post_template_trigger_operations(false, [], true); } } - }, + } - init_post_template_trigger_operations: function(is_manufacturer, attributes, attributes_flag) { + init_post_template_trigger_operations(is_manufacturer, attributes, attributes_flag) { this.attributes = attributes; this.attribute_values = {}; this.attributes_count = attributes.length; @@ -240,23 +240,23 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ this.toggle_manufacturer_fields(); this.dialog.fields_dict.attribute_html.$wrapper.find(".attributes").toggleClass("hide-control", attributes_flag); this.dialog.fields_dict.attribute_html.$wrapper.find(".attributes-header").toggleClass("hide-control", attributes_flag); - }, + } - toggle_manufacturer_fields: function() { + toggle_manufacturer_fields() { var me = this; $.each(this.manufacturer_fields, function(i, dialog_field) { me.dialog.get_field(dialog_field.fieldname).df.hidden = !me.is_manufacturer; me.dialog.get_field(dialog_field.fieldname).df.reqd = dialog_field.fieldname == 'manufacturer' ? me.is_manufacturer : false; me.dialog.get_field(dialog_field.fieldname).refresh(); }); - }, + } - initiate_render_attributes: function() { + initiate_render_attributes() { this.dialog.fields_dict.attribute_html.$wrapper.find(".attributes").empty(); this.render_attributes(this.attributes); - }, + } - render_attributes: function(attributes) { + render_attributes(attributes) { var me = this; this.dialog.get_field('attribute_html').toggle(true); @@ -291,9 +291,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ }); } }); - }, + } - init_make_control: function(fieldtype, row) { + init_make_control(fieldtype, row) { this[row.attribute] = frappe.ui.form.make_control({ df: { "fieldtype": fieldtype, @@ -305,9 +305,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ only_input: false }); this[row.attribute].make_input(); - }, + } - init_awesomplete_for_attribute: function(row) { + init_awesomplete_for_attribute(row) { var me = this; this[row.attribute].input.awesomplete = new Awesomplete(this[row.attribute].input, { @@ -343,9 +343,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ me.attribute_values[$(e.target).attr("data-fieldname")] = e.target.value; $(e.target).closest(".frappe-control").toggleClass("has-error", e.target.value ? false : true); }); - }, + } - get_variant_doc: function() { + get_variant_doc() { var me = this; var variant_doc = {}; var attribute = this.validate_mandatory_attributes(); @@ -381,9 +381,9 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ }) } return variant_doc; - }, + } - validate_mandatory_attributes: function() { + validate_mandatory_attributes() { var me = this; var attribute = {}; var mandatory = []; @@ -404,4 +404,4 @@ frappe.ui.form.ItemQuickEntryForm = frappe.ui.form.QuickEntryForm.extend({ } return attribute; } -}); \ No newline at end of file +}; diff --git a/erpnext/public/js/utils/item_selector.js b/erpnext/public/js/utils/item_selector.js index d04c488a59d..9fc264086a3 100644 --- a/erpnext/public/js/utils/item_selector.js +++ b/erpnext/public/js/utils/item_selector.js @@ -1,5 +1,5 @@ -erpnext.ItemSelector = Class.extend({ - init: function(opts) { +erpnext.ItemSelector = class ItemSelector { + constructor(opts) { $.extend(this, opts); if (!this.item_field) { @@ -12,9 +12,9 @@ erpnext.ItemSelector = Class.extend({ this.grid = this.frm.get_field("items").grid; this.setup(); - }, + } - setup: function() { + setup() { var me = this; if(!this.grid.add_items_button) { this.grid.add_items_button = this.grid.add_custom_button(__('Add Items'), function() { @@ -26,9 +26,9 @@ erpnext.ItemSelector = Class.extend({ setTimeout(function() { me.dialog.input.focus(); }, 1000); }); } - }, + } - make_dialog: function() { + make_dialog() { this.dialog = new frappe.ui.Dialog({ title: __('Add Items') }); @@ -53,9 +53,9 @@ erpnext.ItemSelector = Class.extend({ me.timeout_id = undefined; }, 500); }); - }, + } - add_item: function(item_code) { + add_item(item_code) { // add row or update qty var added = false; @@ -82,9 +82,9 @@ erpnext.ItemSelector = Class.extend({ ]); } - }, + } - render_items: function() { + render_items() { let args = { query: this.item_query, filters: {} @@ -107,4 +107,4 @@ erpnext.ItemSelector = Class.extend({ me.dialog.results.html(frappe.render_template('item_selector', {'data':r.values})); }); } -}); \ No newline at end of file +}; diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js index 3333d569a77..79b6220c1c3 100644 --- a/erpnext/public/js/utils/serial_no_batch_selector.js +++ b/erpnext/public/js/utils/serial_no_batch_selector.js @@ -1,6 +1,6 @@ -erpnext.SerialNoBatchSelector = Class.extend({ - init: function(opts, show_dialog) { +erpnext.SerialNoBatchSelector = class SerialNoBatchSelector { + constructor(opts, show_dialog) { $.extend(this, opts); this.show_dialog = show_dialog; // frm, item, warehouse_details, has_batch, oldest @@ -12,16 +12,16 @@ erpnext.SerialNoBatchSelector = Class.extend({ if(d && d.has_serial_no && !(this.show_dialog == false)) this.has_serial_no = 1; this.setup(); - }, + } - setup: function() { + setup() { this.item_code = this.item.item_code; this.qty = this.item.qty; this.make_dialog(); this.on_close_dialog(); - }, + } - make_dialog: function() { + make_dialog() { var me = this; this.data = this.oldest ? this.oldest : []; @@ -176,15 +176,15 @@ erpnext.SerialNoBatchSelector = Class.extend({ } this.dialog.show(); - }, + } - on_close_dialog: function() { + on_close_dialog() { this.dialog.get_close_btn().on('click', () => { this.on_close && this.on_close(this.item); }); - }, + } - validate: function() { + validate() { let values = this.values; if(!values.warehouse) { frappe.throw(__("Please select a warehouse")); @@ -210,7 +210,7 @@ erpnext.SerialNoBatchSelector = Class.extend({ } return true; } - }, + } update_batch_items() { // clones an items if muliple batches are selected. @@ -233,14 +233,14 @@ erpnext.SerialNoBatchSelector = Class.extend({ 'selected_qty', this.values.warehouse); }); } - }, + } update_serial_no_item() { // just updates serial no for the item if(this.has_serial_no && !this.has_batch) { this.map_row_values(this.item, this.values, 'serial_no', 'qty'); } - }, + } update_batch_serial_no_items() { // if serial no selected is from different batches, adds new rows for each batch. @@ -281,14 +281,14 @@ erpnext.SerialNoBatchSelector = Class.extend({ }); }) } - }, + } - batch_exists: function(batch) { + batch_exists(batch) { const batches = this.frm.doc.items.map(data => data.batch_no); return (batches && in_list(batches, batch)) ? true : false; - }, + } - map_row_values: function(row, values, number, qty_field, warehouse) { + map_row_values(row, values, number, qty_field, warehouse) { row.qty = values[qty_field]; row.transfer_qty = flt(values[qty_field]) * flt(row.conversion_factor); row[number] = values[number]; @@ -301,9 +301,9 @@ erpnext.SerialNoBatchSelector = Class.extend({ } this.frm.dirty(); - }, + } - update_total_qty: function() { + update_total_qty() { let qty_field = this.dialog.fields_dict.qty; let total_qty = 0; @@ -312,9 +312,9 @@ erpnext.SerialNoBatchSelector = Class.extend({ }); qty_field.set_input(total_qty); - }, + } - get_batch_fields: function() { + get_batch_fields() { var me = this; return [ @@ -425,9 +425,9 @@ erpnext.SerialNoBatchSelector = Class.extend({ }, } ]; - }, + } - get_serial_no_fields: function() { + get_serial_no_fields() { var me = this; this.serial_list = []; @@ -510,4 +510,4 @@ erpnext.SerialNoBatchSelector = Class.extend({ } ]; } -}); +}; diff --git a/erpnext/public/less/hub.less b/erpnext/public/less/hub.less deleted file mode 100644 index 29deada8a41..00000000000 --- a/erpnext/public/less/hub.less +++ /dev/null @@ -1,375 +0,0 @@ -@import "variables.less"; -@import (reference) "desk.less"; - -body[data-route*="marketplace"] { - .layout-side-section { - padding-top: 25px; - padding-left: 5px; - padding-right: 25px; - } - - [data-route], [data-action] { - cursor: pointer; - } - - .layout-main-section { - border: none; - font-size: @text-medium; - padding-top: 25px; - - @media (max-width: @screen-xs) { - padding-left: 20px; - padding-right: 20px; - } - } - - input, textarea { - font-size: @text-medium; - } - - .hub-image { - height: 200px; - } - - .hub-image-loading, .hub-image-broken { - content: " "; - position: absolute; - left: 0; - height: 100%; - width: 100%; - background-color: var(--bg-light-gray); - display: flex; - align-items: center; - justify-content: center; - - span { - font-size: 32px; - color: @text-extra-muted; - } - } - - .progress-bar { - background-color: #89da28; - } - - .subpage-title.flex { - align-items: flex-start; - justify-content: space-between; - } - - .hub-card { - margin-bottom: 25px; - position: relative; - border: 1px solid @border-color; - border-radius: 4px; - overflow: hidden; - - &:hover .hub-card-overlay { - display: block; - } - } - - .hub-card.is-local { - &.active { - .hub-card-header { - background-color: #f4ffe5; - } - - .octicon-check { - display: inline; - } - } - - .octicon-check { - display: none; - position: absolute; - font-size: 20px; - right: 15px; - top: 50%; - transform: translateY(-50%); - } - } - - .hub-card-header { - position: relative; - padding: 12px 15px; - height: 60px; - border-bottom: 1px solid @border-color; - } - - .hub-card-body { - position: relative; - height: 200px; - } - - .hub-card-overlay { - display: none; - position: absolute; - top: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.05); - } - - .hub-card-overlay-body { - position: relative; - height: 100%; - } - - .hub-card-overlay-button { - position: absolute; - right: 15px; - bottom: 15px; - } - - .hub-card-image { - position: relative; - width: 100%; - height: 100%; - object-fit: contain; - } - - .hub-search-container { - margin-bottom: 20px; - - input { - height: 32px; - } - } - - .hub-sidebar { - padding-top: 25px; - padding-right: 15px; - } - - .hub-sidebar-group { - margin-bottom: 10px; - } - - .hub-sidebar-item { - padding: 5px 8px; - margin-bottom: 3px; - border-radius: 4px; - border: 1px solid transparent; - - &.active, &:hover:not(.is-title) { - border-color: @border-color; - } - } - - .hub-item-image { - position: relative; - border: 1px solid @border-color; - border-radius: 4px; - overflow: hidden; - height: 200px; - width: 200px; - display: flex; - align-items: center; - } - - .hub-item-skeleton-image { - border-radius: 4px; - background-color: @light-bg; - overflow: hidden; - height: 200px; - width: 200px; - } - - .hub-skeleton { - background-color: @light-bg; - color: @light-bg; - max-width: 500px; - } - - .hub-item-seller img { - width: 50px; - height: 50px; - border-radius: 4px; - border: 1px solid @border-color; - } - - .register-title { - font-size: @text-regular; - } - - .register-form { - border: 1px solid @border-color; - border-radius: 4px; - padding: 15px 25px; - } - - .publish-area.filled { - .empty-items-container { - display: none; - } - } - - .publish-area.empty { - .hub-items-container { - display: none; - } - } - - .publish-area-head { - display: flex; - justify-content: space-between; - margin-bottom: 20px; - } - - .hub-list-item { - display: flex; - justify-content: space-between; - align-items: center; - border: 1px solid @border-color; - margin-bottom: -1px; - overflow: hidden; - } - - .hub-list-item:first-child { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - } - .hub-list-item:last-child { - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - } - - .hub-list-left { - display: flex; - align-items: center; - max-width: 90%; - } - - .hub-list-right { - padding-right: 15px; - } - - .hub-list-image { - position: relative; - width: 58px; - height: 58px; - border-right: 1px solid @border-color; - - &::after { - font-size: 12px; - } - } - - .hub-list-body { - padding: 12px 15px; - } - - .hub-list-title { - font-weight: bold; - } - - .hub-list-subtitle { - color: @text-muted; - } - - .selling-item-message-card { - max-width: 500px; - margin-bottom: 15px; - border-radius: 3px; - border: 1px solid @border-color; - .selling-item-detail { - overflow: auto; - .item-image { - float: left; - height: 80px; - width: 80px; - object-fit: contain; - margin: 5px; - } - .item-name { - margin-left: 10px; - } - } - .received-message-container { - clear: left; - background-color: @light-bg; - .received-message { - border-top: 1px solid @border-color; - padding: 10px; - } - .frappe-timestamp { - float: right; - } - } - } - - .form-container { - .frappe-control { - max-width: 100% !important; - } - } - - .form-message { - padding-top: 0; - padding-bottom: 0; - border-bottom: none; - } - - .hub-items-container { - .hub-items-header { - justify-content: space-between; - align-items: baseline; - } - } - - .hub-item-container { - overflow: hidden; - } - - .hub-item-review-container { - margin-top: calc(30vh); - } - - .hub-item-dropdown { - margin-top: 20px; - } - - /* messages page */ - - .message-list-item { - display: flex; - align-items: center; - padding: 8px 12px; - - &:not(.active) { - filter: grayscale(1); - color: @text-muted; - } - - &:hover { - background-color: @light-bg; - } - - .list-item-left { - width: 30px; - border-radius: 4px; - overflow: hidden; - margin-right: 15px; - } - - .list-item-body { - font-weight: bold; - padding-bottom: 1px; - } - } - - .message-container { - display: flex; - flex-direction: column; - border: 1px solid @border-color; - border-radius: 3px; - height: calc(100vh - 300px); - justify-content: space-between; - padding: 15px; - } - - .message-list { - overflow: scroll; - } -} diff --git a/erpnext/public/less/pos.less b/erpnext/public/less/pos.less deleted file mode 100644 index b081ed4414b..00000000000 --- a/erpnext/public/less/pos.less +++ /dev/null @@ -1,229 +0,0 @@ -@import "../../../../frappe/frappe/public/less/variables.less"; - -[data-route="point-of-sale"] { - .layout-main-section-wrapper { - margin-bottom: 0; - } - - .pos-items-wrapper { - max-height: ~"calc(100vh - 210px)"; - } -} - -.pos { - // display: flex; - padding: 15px; -} - -.list-item { - min-height: 40px; - height: auto; -} - -.cart-container { - padding: 0 15px; - // flex: 2; - display: inline-block; - width: 39%; - vertical-align: top; -} - -.item-container { - padding: 0 15px; - // flex: 3; - display: inline-block; - width: 60%; - vertical-align: top; -} - -.search-field { - width: 60%; - - input::placeholder { - font-size: @text-medium; - } -} - -.item-group-field { - width: 40%; - margin-left: 15px; -} - -.cart-wrapper { - margin-bottom: 12px; - .list-item__content:not(:first-child) { - justify-content: flex-end; - } - - .list-item--head .list-item__content:nth-child(2) { - flex: 1.5; - } -} - -.cart-items { - height: 150px; - overflow: auto; - - .list-item.current-item { - background-color: @light-yellow; - } - - .list-item.current-item.qty input { - border: 1px solid @brand-primary; - font-weight: bold; - } - - .list-item.current-item.disc .discount { - font-weight: bold; - } - - .list-item.current-item.rate .rate { - font-weight: bold; - } - - .list-item .quantity { - flex: 1.5; - } - - input { - text-align: right; - height: 22px; - font-size: @text-medium; - } -} - -.fields { - display: flex; -} - -.pos-items-wrapper { - max-height: 480px; - overflow-y: auto; -} - -.pos-items { - overflow: hidden; -} - -.pos-item-wrapper { - display: flex; - flex-direction: column; - position: relative; - width: 25%; -} - -.image-view-container { - display: block; -} - -.image-view-container .image-field { - height: auto; -} - -.empty-state { - height: 100%; - position: relative; - - span { - position: absolute; - color: @text-muted; - font-size: @text-medium; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - } -} - -@keyframes yellow-fade { - 0% {background-color: @light-yellow;} - 100% {background-color: transparent;} -} - -.highlight { - animation: yellow-fade 1s ease-in 1; -} - -input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { - -webkit-appearance: none; - margin: 0; -} - -// number pad - -.number-pad { - border-collapse: collapse; - cursor: pointer; - display: table; -} -.num-row { - display: table-row; -} -.num-col { - display: table-cell; - border: 1px solid @border-color; - - & > div { - width: 50px; - height: 50px; - text-align: center; - line-height: 50px; - } - - &.active { - background-color: @light-yellow; - } - - &.brand-primary { - background-color: @brand-primary; - color: #ffffff; - } -} - -// taxes, totals and discount area -.discount-amount { - .discount-inputs { - display: flex; - flex-direction: column; - padding: 15px 0; - } - - input:first-child { - margin-bottom: 10px; - } -} - -.taxes-and-totals { - border-top: 1px solid @border-color; - - .taxes { - display: flex; - flex-direction: column; - padding: 15px 0; - align-items: flex-end; - - & > div:first-child { - margin-bottom: 10px; - } - } -} - -.grand-total { - border-top: 1px solid @border-color; - - .list-item { - height: 60px; - } - - .grand-total-value { - font-size: 18px; - } -} - -.rounded-total-value { - font-size: 18px; -} - -.quantity-total { - font-size: 18px; -} \ No newline at end of file diff --git a/erpnext/public/less/products.less b/erpnext/public/less/products.less deleted file mode 100644 index 5e744ceac5b..00000000000 --- a/erpnext/public/less/products.less +++ /dev/null @@ -1,71 +0,0 @@ -@import "variables.less"; - -.products-list .product-image { - display: inline-block; - width: 160px; - height: 160px; - object-fit: contain; - margin-right: 1rem; -} - -.product-image.no-image { - display: flex; - justify-content: center; - align-items: center; - font-size: 3rem; - color: var(--gray); - background: var(--light); -} - -.product-image a { - text-decoration: none; -} - -.filter-options { - margin-left: -5px; - padding-left: 5px; - max-height: 300px; - overflow: auto; -} - -.item-slideshow-image { - height: 3rem; - width: 3rem; - object-fit: contain; - padding: 0.5rem; - border: 1px solid @border-color; - border-radius: 4px; - cursor: pointer; - - &:hover, &.active { - border-color: var(--primary); - } -} - -.address-card { - cursor: pointer; - position: relative; - - .check { - display: none; - } - - &.active { - border-color: var(--primary); - - .check { - display: inline-flex; - } - } -} - -.check { - display: inline-flex; - padding: 0.25rem; - background: var(--primary); - color: white; - border-radius: 50%; - font-size: 12px; - width: 24px; - height: 24px; -} \ No newline at end of file diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less deleted file mode 100644 index ac878de105b..00000000000 --- a/erpnext/public/less/website.less +++ /dev/null @@ -1,388 +0,0 @@ -@import "variables.less"; - -.web-long-description { - font-size: 18px; - line-height: 200%; -} - -.web-page-content { - margin-bottom: 30px; -} - -.item-stock { - margin-bottom: 10px !important; -} - -.product-link { - display: block; - text-align: center; -} - - -.product-image img { - max-height: 500px; - margin: 0 auto; -} - -@media (max-width: 767px) { - .product-image { - height: 0px; - padding: 0px 0px 100%; - overflow: hidden; - } -} - -.product-image-square { - width: 100%; - height: 0; - padding: 50% 0px; - background-size: cover; - background-repeat: no-repeat; - background-position: center top; -} - -.product-image.missing-image { - .product-image-square; - position: relative; - background-color: @light-border-color; -} - -.product-image.missing-image .octicon { - font-size: 32px; - color: @border-color; -} - -.product-search { - margin-bottom: 15px; -} - - -@media (max-width: 767px) { - .product-search { - width: 100%; - } -} - -.borderless td, .borderless th { - border-bottom: 1px solid @light-border-color; - padding-left:0px !important; - line-height: 1.8em !important; -} - -.item-desc { - border-top: 2px solid @light-border-color; - padding-top:10px; -} - -.featured-products { - border-top: 1px solid @light-border-color; -} - -.transaction-list-item { - .indicator { - font-weight: inherit; - color: @text-muted; - } - - .transaction-time { - margin-top: 5px; - } - -} - -// order.html -.transaction-subheading { - .indicator { - font-weight: inherit; - color: @text-muted; - } -} - -.order-container { - margin: 50px 0px; - - .order-item-header .h6 { - padding: 7px 15px; - } - - .order-items { - margin: 30px 0px 0px; - } - - .order-item-table { - margin: 0px -15px; - } - - .order-item-header { - border-bottom: 1px solid #d1d8dd; - } - - .order-image-col { - padding-right: 0px; - } - - .order-image { - max-width: 55px; - max-height: 55px; - margin-top: -5px; - } - - .order-taxes { - margin-top: 30px; - - .row { - margin-top: 15px; - } - } - - .tax-grand-total-row { - padding-top: 15px; - padding-bottom: 30px; - } - - .tax-grand-total { - display: inline-block; - font-size: 16px; - font-weight: bold; - margin-top: 5px; - } -} - -.cart-container { - margin: 50px 0px; - - .checkout { - margin-bottom:15px; - } - - .cart-item-header .h6 { - padding: 7px 15px; - } - - .cart-items { - margin: 30px 0px 0px; - } - - .cart-item-table { - margin: 0px -15px; - } - - .cart-item-header { - border-bottom: 1px solid #d1d8dd; - } - - .cart-image-col { - padding-right: 0px; - } - - .cart-image { - max-width: 55px; - max-height: 55px; - margin-top: -5px; - } - - .cart-taxes { - margin-top: 30px; - - .row { - margin-top: 15px; - } - } - - .tax-grand-total-row { - border-top: 1px solid @border-color; - padding-top: 15px; - } - - .cart-addresses { - margin-top: 50px; - } -} - -.cart-items-dropdown .cart-dropdown, -.item_name_dropdown { - display: none; - -} - -.cart-dropdown-container { - width: 400px; - padding: 15px; - - .item-price { - display: block !important; - padding-bottom: 10px; - } - - .cart-item-header { - border-bottom: 1px solid #d1d8dd; - } - - .cart-items-dropdown { - max-height: 350px; - } - - .cart-items-dropdown .cart-dropdown { - display:block; - margin-top:15px; - } - - .item_name_dropdown { - display:block; - } - - .item-description, - .cart-items .checkout, - .item_name_and_description { - display: none; - } - - .checkout-btn { - padding-bottom:25px; - } - .col-name-description { - margin-bottom:8px; - } -} - -// .number-spinner { -// width:100px; -// margin-top:5px; -// } - -.cart-btn { - border-color: #ccc; -} -.cart-qty { - text-align:center; -} - -.product-list-link { - .row { - border-bottom: 1px solid @light-border-color; - } - - .row:hover { - background-color: @light-bg; - } - - .row > div { - padding-top: 15px; - padding-bottom: 15px; - } -} - -.product-list-link:first-child .row { - border-top: 1px solid @light-border-color; -} - -.item-group-nav-buttons { - margin-top: 15px; -} - -.footer-subscribe { - .btn-default { - background-color: transparent; - border: 1px solid @border-color; - } -} - -@media (min-width: 992px) { - .footer-subscribe { - max-width: 350px; - } -} - -.item-group-content { - margin-top: 30px; -} - -.item-group-slideshow { - margin-bottom: 1rem; -} - -.product-image-img { - border: 1px solid @light-border-color; - border-radius: 3px; -} - -.product-text { - word-wrap: break-word; - height: 75px; - display: block; /* Fallback for non-webkit */ - display: -webkit-box; - max-width: 100%; - margin: 0 auto; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - overflow: hidden; - text-overflow: ellipsis; -} - -.product-image-wrapper { - padding-bottom: 40px; -} - -.duration-bar { - display: inline-block; - color: white; - background: #8FD288; - padding: 3px; -} - -.duration-invisible { - visibility: hidden; -} - -.duration-value { - float: right; -} - -.bar-outer-text { - color: #8FD288; - background: none; - float: none; - border: none; -} - -.bom-spec { - margin-bottom: 20px; -} - -.modal-title { - margin-top: 5px; -} - -.modal-header { - padding: 10px 15px; -} -// For Item Alternate Image -.item-alternative-image { - padding: 5px; - margin-bottom: 5px; - - &:hover { - border-color: @brand-primary; - } -} - -.item-slideshow-image { - height: 3rem; - width: 3rem; - object-fit: contain; - padding: 0.5rem; - border: 1px solid @border-color; - border-radius: 4px; - cursor: pointer; - - &:hover, &.active { - border-color: @brand-primary; - } -} - -.section-products { - .card-img-top { - max-height: 300px; - object-fit: contain; - } -} \ No newline at end of file diff --git a/erpnext/public/less/email.less b/erpnext/public/scss/email.bundle.scss similarity index 60% rename from erpnext/public/less/email.less rename to erpnext/public/scss/email.bundle.scss index 4077c4940d1..3c0b918dae9 100644 --- a/erpnext/public/less/email.less +++ b/erpnext/public/scss/email.bundle.scss @@ -1,14 +1,14 @@ -@import "../../../../frappe/frappe/public/less/variables.less"; +@import "frappe/public/scss/desk/variables"; .panel-header { - background-color: @light-bg; - border: 1px solid @border-color; + background-color: var(--bg-color); + border: 1px solid $border-color; border-radius: 3px 3px 0 0; } .panel-body { background-color: #fff; - border: 1px solid @border-color; + border: 1px solid $border-color; border-top: none; border-radius: 0 0 3px 3px; overflow-wrap: break-word; @@ -22,11 +22,11 @@ } .sender-avatar-placeholder { - .sender-avatar; + @extend .sender-avatar; line-height: 24px; text-align: center; - color: @border-color; - border: 1px solid @border-color; + color: $border-color; + border: 1px solid $border-color; background-color: #fff; -} \ No newline at end of file +} diff --git a/erpnext/public/scss/erpnext-web.bundle.scss b/erpnext/public/scss/erpnext-web.bundle.scss new file mode 100644 index 00000000000..6ef1892a3df --- /dev/null +++ b/erpnext/public/scss/erpnext-web.bundle.scss @@ -0,0 +1,2 @@ +@import "./shopping_cart"; +@import "./website"; diff --git a/erpnext/public/scss/erpnext.bundle.scss b/erpnext/public/scss/erpnext.bundle.scss new file mode 100644 index 00000000000..d3313c7cee2 --- /dev/null +++ b/erpnext/public/scss/erpnext.bundle.scss @@ -0,0 +1,3 @@ +@import "./erpnext"; +@import "./call_popup"; +@import "./point-of-sale"; diff --git a/erpnext/public/less/erpnext.less b/erpnext/public/scss/erpnext.scss similarity index 82% rename from erpnext/public/less/erpnext.less rename to erpnext/public/scss/erpnext.scss index 4076ebec1fd..0e6186138fc 100644 --- a/erpnext/public/less/erpnext.less +++ b/erpnext/public/scss/erpnext.scss @@ -1,4 +1,4 @@ -@import "variables.less"; +@import "frappe/public/scss/desk/variables"; .erpnext-footer { margin: 11px auto; @@ -141,7 +141,7 @@ body[data-route="pos"] { } .pos-payment-row { - border-bottom:1px solid @border-color; + border-bottom:1px solid $border-color; margin: 2px 0px 5px 0px; height: 60px; margin-top: 0px; @@ -149,12 +149,12 @@ body[data-route="pos"] { } .pos-payment-row:hover, .pos-keyboard-key:hover{ - background-color: @light-bg; + background-color: var(--bg-color); cursor: pointer; } .pos-keyboard-key, .delete-btn { - border: 1px solid @border-color; + border: 1px solid $border-color; height:85px; width:85px; margin:10px 10px; @@ -165,7 +165,7 @@ body[data-route="pos"] { } .numeric-keypad { - border: 1px solid @border-color; + border: 1px solid $border-color; height:69px; width:69px; font-size:20px; @@ -192,13 +192,13 @@ body[data-route="pos"] { background-color: #fff; margin-left:-4px; - @media (max-width: @screen-md) { + @media (max-width: map-get($grid-breakpoints, "xl")) { height: 45px; width: 45px; font-size: 14px; } - @media (max-width: @screen-sm) { + @media (max-width: map-get($grid-breakpoints, "lg")) { height: 40px; width: 40px; } @@ -209,21 +209,21 @@ body[data-route="pos"] { & > .row > button { border: none; - border-right: 1px solid @border-color; - border-bottom: 1px solid @border-color; + border-right: 1px solid $border-color; + border-bottom: 1px solid $border-color; &:first-child { - border-left: 1px solid @border-color; + border-left: 1px solid $border-color; } } & > .row:first-child > button { - border-top: 1px solid @border-color; + border-top: 1px solid $border-color; } } .pos-pay { - background-color: @brand-primary; + background-color: var(--primary); border: none; } @@ -236,13 +236,13 @@ body[data-route="pos"] { } .list-row-head.pos-invoice-list { - border-top: 1px solid @border-color; + border-top: 1px solid $border-color; } .modal-dialog { width: 750px; - @media (max-width: @screen-xs) { + @media (max-width: map-get($grid-breakpoints, 'md')) { width: auto; .modal-content { @@ -251,7 +251,7 @@ body[data-route="pos"] { } } - @media (max-width: @screen-xs) { + @media (max-width: map-get($grid-breakpoints, 'md')) { .amount-row h3 { font-size: 15px; } @@ -271,7 +271,7 @@ body[data-route="pos"] { } .selected-payment-mode { - background-color: @light-bg; + background-color: var(--bg-color); cursor: pointer; } @@ -291,7 +291,7 @@ body[data-route="pos"] { padding: 9px 15px; font-size: 12px; margin: 0px; - border-bottom: 1px solid @border-color; + border-bottom: 1px solid $border-color; .cell { display: table-cell; @@ -313,17 +313,17 @@ body[data-route="pos"] { .pos-bill-header { background-color: #f5f7fa; - border: 1px solid @border-color; + border: 1px solid $border-color; padding: 13px 15px; } .pos-list-row.active { - background-color: @light-yellow; + background-color: var(--fg-hover-color); } .totals-area { - border-right: 1px solid @border-color; - border-left: 1px solid @border-color; + border-right: 1px solid $border-color; + border-left: 1px solid $border-color; margin-bottom: 15px; } @@ -332,12 +332,12 @@ body[data-route="pos"] { } .item-cart-items { - height: ~"calc(100vh - 526px)"; + height: calc(100vh - 526px); overflow: auto; - border: 1px solid @border-color; + border: 1px solid $border-color; border-top: none; - @media (max-width: @screen-xs) { + @media (max-width: map-get($grid-breakpoints, 'md')) { height: 30vh; } } @@ -359,12 +359,12 @@ body[data-route="pos"] { } .item-list { - border: 1px solid @border-color; + border: 1px solid $border-color; border-top: none; - max-height: ~"calc(100vh - 190px)"; + max-height: calc(100vh - 190px); overflow: auto; - @media (max-width: @screen-xs) { + @media (max-width: map-get($grid-breakpoints, 'md')) { max-height: initial; } @@ -402,7 +402,7 @@ body[data-route="pos"] { &> .pos-list-row { border: none; - @media (max-width: @screen-md) { + @media (max-width: map-get($grid-breakpoints, 'xl')) { padding: 5px 15px; } } @@ -420,7 +420,7 @@ body[data-route="pos"] { justify-content: center; align-items: center; cursor: pointer; - background-color: @light-bg; + background-color: var(--bg-color); min-height: 200px; } @@ -428,7 +428,7 @@ body[data-route="pos"] { cursor: pointer; } - @media (max-width: @screen-xs) { + @media (max-width: map-get($grid-breakpoints, 'md')) { .page-actions { max-width: 110px; } @@ -491,4 +491,4 @@ body[data-route="pos"] { .exercise-col { padding: 10px; -} \ No newline at end of file +} diff --git a/erpnext/selling/doctype/installation_note/installation_note.js b/erpnext/selling/doctype/installation_note/installation_note.js index 7fd0877d11a..ffa185baf6d 100644 --- a/erpnext/selling/doctype/installation_note/installation_note.js +++ b/erpnext/selling/doctype/installation_note/installation_note.js @@ -30,8 +30,8 @@ frappe.ui.form.on('Installation Note', { frappe.provide("erpnext.selling"); // TODO commonify this code -erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({ - refresh: function() { +erpnext.selling.InstallationNote = class InstallationNote extends frappe.ui.form.Controller { + refresh() { var me = this; if (this.frm.doc.docstatus===0) { this.frm.add_custom_button(__('From Delivery Note'), @@ -54,7 +54,7 @@ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({ }, "fa fa-download", "btn-default" ); } - }, -}); + } +}; $.extend(cur_frm.cscript, new erpnext.selling.InstallationNote({frm: cur_frm})); \ No newline at end of file diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 5a0d9c90655..10606bf81e1 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -36,13 +36,13 @@ frappe.ui.form.on('Quotation', { } }); -erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ - onload: function(doc, dt, dn) { +erpnext.selling.QuotationController = class QuotationController extends erpnext.selling.SellingController { + onload(doc, dt, dn) { var me = this; - this._super(doc, dt, dn); + super.(doc, dt, dn); - }, - party_name: function() { + } + party_name() { var me = this; erpnext.utils.get_party_details(this.frm, null, null, function() { me.apply_price_list(); @@ -51,9 +51,9 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ if(me.frm.doc.quotation_to=="Lead" && me.frm.doc.party_name) { me.frm.trigger("get_lead_details"); } - }, - refresh: function(doc, dt, dn) { - this._super(doc, dt, dn); + } + refresh(doc, dt, dn) { + super.refresh(doc, dt, dn); doctype = doc.quotation_to == 'Customer' ? 'Customer':'Lead'; frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'party_name', doctype: doctype} @@ -121,9 +121,9 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ this.toggle_reqd_lead_customer(); - }, + } - set_dynamic_field_label: function(){ + set_dynamic_field_label(){ if (this.frm.doc.quotation_to == "Customer") { this.frm.set_df_property("party_name", "label", "Customer"); @@ -138,22 +138,22 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ return{ query: "erpnext.controllers.queries.lead_query" } } } - }, + } - toggle_reqd_lead_customer: function() { + toggle_reqd_lead_customer() { var me = this; // to overwrite the customer_filter trigger from queries.js this.frm.toggle_reqd("party_name", this.frm.doc.quotation_to); this.frm.set_query('customer_address', this.address_query); this.frm.set_query('shipping_address_name', this.address_query); - }, + } - tc_name: function() { + tc_name() { this.get_terms(); - }, + } - address_query: function(doc) { + address_query(doc) { return { query: 'frappe.contacts.doctype.address.address.address_query', filters: { @@ -161,20 +161,20 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ link_name: doc.party_name } }; - }, + } - validate_company_and_party: function(party_field) { + validate_company_and_party(party_field) { if(!this.frm.doc.quotation_to) { frappe.msgprint(__("Please select a value for {0} quotation_to {1}", [this.frm.doc.doctype, this.frm.doc.name])); return false; } else if (this.frm.doc.quotation_to == "Lead") { return true; } else { - return this._super(party_field); + return super.validate_company_and_party(party_field); } - }, + } - get_lead_details: function() { + get_lead_details() { var me = this; if(!this.frm.doc.quotation_to === "Lead") { return; @@ -198,7 +198,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ } }) } -}); +}; cur_frm.script_manager.make(erpnext.selling.QuotationController); diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index e3b41e66fbc..d5ceca8ec83 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -102,14 +102,14 @@ frappe.ui.form.on("Sales Order Item", { } }); -erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend({ - onload: function(doc, dt, dn) { - this._super(); - }, +erpnext.selling.SalesOrderController = class SalesOrderController extends erpnext.selling.SellingController { + onload(doc, dt, dn) { + super.onload(); + } - refresh: function(doc, dt, dn) { + refresh(doc, dt, dn) { var me = this; - this._super(); + super.refresh(); let allow_delivery = false; if (doc.docstatus==1) { @@ -241,14 +241,14 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } this.order_type(doc); - }, + } create_pick_list() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.create_pick_list", frm: this.frm }) - }, + } make_work_order() { var me = this; @@ -343,33 +343,33 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } } }); - }, + } - order_type: function() { + order_type() { this.toggle_delivery_date(); - }, + } - tc_name: function() { + tc_name() { this.get_terms(); - }, + } - make_material_request: function() { + make_material_request() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_material_request", frm: this.frm }) - }, + } - skip_delivery_note: function() { + skip_delivery_note() { this.toggle_delivery_date(); - }, + } - toggle_delivery_date: function() { + toggle_delivery_date() { this.frm.fields_dict.items.grid.toggle_reqd("delivery_date", (this.frm.doc.order_type == "Sales" && !this.frm.doc.skip_delivery_note)); - }, + } - make_raw_material_request: function() { + make_raw_material_request() { var me = this; this.frm.call({ doc: this.frm.doc, @@ -390,9 +390,9 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } } }); - }, + } - make_raw_material_request_dialog: function(r) { + make_raw_material_request_dialog(r) { var fields = [ {fieldtype:'Check', fieldname:'include_exploded_items', label: __('Include Exploded Items')}, @@ -447,9 +447,9 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( primary_action_label: __('Create') }); d.show(); - }, + } - make_delivery_note_based_on_delivery_date: function() { + make_delivery_note_based_on_delivery_date() { var me = this; var delivery_dates = []; @@ -509,51 +509,51 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } else { this.make_delivery_note(); } - }, + } - make_delivery_note: function() { + make_delivery_note() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_delivery_note", frm: this.frm }) - }, + } - make_sales_invoice: function() { + make_sales_invoice() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice", frm: this.frm }) - }, + } - make_maintenance_schedule: function() { + make_maintenance_schedule() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule", frm: this.frm }) - }, + } - make_project: function() { + make_project() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_project", frm: this.frm }) - }, + } - make_inter_company_order: function() { + make_inter_company_order() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_inter_company_purchase_order", frm: this.frm }); - }, + } - make_maintenance_visit: function() { + make_maintenance_visit() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit", frm: this.frm }) - }, + } - make_purchase_order: function(){ + make_purchase_order(){ let pending_items = this.frm.doc.items.some((item) =>{ let pending_qty = flt(item.stock_qty) - flt(item.ordered_qty); return pending_qty > 0; @@ -690,9 +690,9 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( dialog.get_field("items_for_po").refresh(); dialog.wrapper.find('.grid-heading-row .grid-row-check').click(); dialog.show(); - }, + } - hold_sales_order: function(){ + hold_sales_order(){ var me = this; var d = new frappe.ui.Dialog({ title: __('Reason for Hold'), @@ -724,11 +724,11 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } }); d.show(); - }, - close_sales_order: function(){ + } + close_sales_order(){ this.frm.cscript.update_status("Close", "Closed") - }, - update_status: function(label, status){ + } + update_status(label, status){ var doc = this.frm.doc; var me = this; frappe.ui.form.is_saving = true; @@ -743,5 +743,5 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } }); } -}); +}; $.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm})); diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js index e3405e0ce89..6db4150be94 100644 --- a/erpnext/selling/page/point_of_sale/point_of_sale.js +++ b/erpnext/selling/page/point_of_sale/point_of_sale.js @@ -7,7 +7,7 @@ frappe.pages['point-of-sale'].on_page_load = function(wrapper) { single_column: true }); - frappe.require('assets/js/point-of-sale.min.js', function() { + frappe.require('point-of-sale.bundle.js', function() { wrapper.pos = new erpnext.PointOfSale.Controller(wrapper); window.cur_pos = wrapper.pos; }); @@ -19,4 +19,4 @@ frappe.pages['point-of-sale'].refresh = function(wrapper) { wrapper.pos.wrapper.html(""); wrapper.pos.check_opening_entry(); } -}; \ No newline at end of file +}; diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 04285735abd..eb02867720c 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -9,15 +9,15 @@ cur_frm.cscript.tax_table = "Sales Taxes and Charges"; cur_frm.email_field = "contact_email"; frappe.provide("erpnext.selling"); -erpnext.selling.SellingController = erpnext.TransactionController.extend({ - setup: function() { - this._super(); +erpnext.selling.SellingController = class SellingController extends erpnext.TransactionController { + setup() { + super.setup(); this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate"); this.frm.add_fetch("sales_person", "commission_rate", "commission_rate"); - }, + } - onload: function() { - this._super(); + onload() { + super.onload(); this.setup_queries(); this.frm.set_query('shipping_rule', function() { return { @@ -26,9 +26,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } }; }); - }, + } - setup_queries: function() { + setup_queries() { var me = this; $.each([["customer", "customer"], @@ -81,10 +81,10 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }); } - }, + } - refresh: function() { - this._super(); + refresh() { + super.refresh(); frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'} @@ -95,45 +95,45 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.toggle_display("packing_list", packing_list_exists ? true : false); } this.toggle_editable_price_list_rate(); - }, + } - customer: function() { + customer() { var me = this; erpnext.utils.get_party_details(this.frm, null, null, function() { me.apply_price_list(); }); - }, + } - customer_address: function() { + customer_address() { erpnext.utils.get_address_display(this.frm, "customer_address"); erpnext.utils.set_taxes_from_address(this.frm, "customer_address", "customer_address", "shipping_address_name"); - }, + } - shipping_address_name: function() { + shipping_address_name() { erpnext.utils.get_address_display(this.frm, "shipping_address_name", "shipping_address"); erpnext.utils.set_taxes_from_address(this.frm, "shipping_address_name", "customer_address", "shipping_address_name"); - }, + } - sales_partner: function() { + sales_partner() { this.apply_pricing_rule(); - }, + } - campaign: function() { + campaign() { this.apply_pricing_rule(); - }, + } - selling_price_list: function() { + selling_price_list() { this.apply_price_list(); this.set_dynamic_labels(); - }, + } - discount_percentage: function(doc, cdt, cdn) { + discount_percentage(doc, cdt, cdn) { var item = frappe.get_doc(cdt, cdn); item.discount_amount = 0.0; this.apply_discount_on_item(doc, cdt, cdn, 'discount_percentage'); - }, + } - discount_amount: function(doc, cdt, cdn) { + discount_amount(doc, cdt, cdn) { if(doc.name === cdn) { return; @@ -142,9 +142,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ var item = frappe.get_doc(cdt, cdn); item.discount_percentage = 0.0; this.apply_discount_on_item(doc, cdt, cdn, 'discount_amount'); - }, + } - apply_discount_on_item: function(doc, cdt, cdn, field) { + apply_discount_on_item(doc, cdt, cdn, field) { var item = frappe.get_doc(cdt, cdn); if(!item.price_list_rate) { item[field] = 0.0; @@ -152,14 +152,14 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.price_list_rate(doc, cdt, cdn); } this.set_gross_profit(item); - }, + } - commission_rate: function() { + commission_rate() { this.calculate_commission(); refresh_field("total_commission"); - }, + } - total_commission: function() { + total_commission() { if(this.frm.doc.base_net_total) { frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "total_commission"]); @@ -175,9 +175,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.set_value("commission_rate", flt(this.frm.doc.total_commission * 100.0 / this.frm.doc.base_net_total)); } - }, + } - allocated_percentage: function(doc, cdt, cdn) { + allocated_percentage(doc, cdt, cdn) { var sales_person = frappe.get_doc(cdt, cdn); if(sales_person.allocated_percentage) { @@ -193,15 +193,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ refresh_field(["allocated_percentage", "allocated_amount", "commission_rate","incentives"], sales_person.name, sales_person.parentfield); } - }, + } - sales_person: function(doc, cdt, cdn) { + sales_person(doc, cdt, cdn) { var row = frappe.get_doc(cdt, cdn); this.calculate_incentive(row); refresh_field("incentives",row.name,row.parentfield); - }, + } - warehouse: function(doc, cdt, cdn) { + warehouse(doc, cdt, cdn) { var me = this; var item = frappe.get_doc(cdt, cdn); @@ -239,18 +239,18 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }); } }) - }, + } - toggle_editable_price_list_rate: function() { + toggle_editable_price_list_rate() { var df = frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "price_list_rate", this.frm.doc.name); var editable_price_list_rate = cint(frappe.defaults.get_default("editable_price_list_rate")); if(df && editable_price_list_rate) { df.read_only = 0; } - }, + } - calculate_commission: function() { + calculate_commission() { if(this.frm.fields_dict.commission_rate) { if(this.frm.doc.commission_rate > 100) { var msg = __(frappe.meta.get_label(this.frm.doc.doctype, "commission_rate", this.frm.doc.name)) + @@ -262,9 +262,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.doc.total_commission = flt(this.frm.doc.base_net_total * this.frm.doc.commission_rate / 100.0, precision("total_commission")); } - }, + } - calculate_contribution: function() { + calculate_contribution() { var me = this; $.each(this.frm.doc.doctype.sales_team || [], function(i, sales_person) { frappe.model.round_floats_in(sales_person); @@ -274,18 +274,18 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ precision("allocated_amount", sales_person)); } }); - }, + } - calculate_incentive: function(row) { + calculate_incentive(row) { if(row.allocated_amount) { row.incentives = flt( row.allocated_amount * row.commission_rate / 100.0, precision("incentives", row)); } - }, + } - batch_no: function(doc, cdt, cdn) { + batch_no(doc, cdt, cdn) { var me = this; var item = frappe.get_doc(cdt, cdn); @@ -312,14 +312,14 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }); } }) - }, + } - set_dynamic_labels: function() { - this._super(); + set_dynamic_labels() { + super.set_dynamic_labels(); this.set_product_bundle_help(this.frm.doc); - }, + } - set_product_bundle_help: function(doc) { + set_product_bundle_help(doc) { if(!cur_frm.fields_dict.packing_list) return; if ((doc.packed_items || []).length) { $(cur_frm.fields_dict.packing_list.row.wrapper).toggle(true); @@ -337,9 +337,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } } refresh_field('product_bundle_help'); - }, + } - company_address: function() { + company_address() { var me = this; if(this.frm.doc.company_address) { frappe.call({ @@ -354,42 +354,42 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } else { this.frm.set_value("company_address_display", ""); } - }, + } - conversion_factor: function(doc, cdt, cdn, dont_fetch_price_list_rate) { - this._super(doc, cdt, cdn, dont_fetch_price_list_rate); + conversion_factor(doc, cdt, cdn, dont_fetch_price_list_rate) { + super.conversion_factor(doc, cdt, cdn, dont_fetch_price_list_rate); if(frappe.meta.get_docfield(cdt, "stock_qty", cdn) && in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) { if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return; this.set_batch_number(cdt, cdn); } - }, + } - batch_no: function(doc, cdt, cdn) { - this._super(doc, cdt, cdn); - }, + batch_no(doc, cdt, cdn) { + super.batch_no(doc, cdt, cdn); + } - qty: function(doc, cdt, cdn) { - this._super(doc, cdt, cdn); + qty(doc, cdt, cdn) { + super.qty(doc, cdt, cdn); if(in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) { if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return; this.set_batch_number(cdt, cdn); } - }, + } /* Determine appropriate batch number and set it in the form. * @param {string} cdt - Document Doctype * @param {string} cdn - Document name */ - set_batch_number: function(cdt, cdn) { + set_batch_number(cdt, cdn) { const doc = frappe.get_doc(cdt, cdn); if (doc && doc.has_batch_no && doc.warehouse) { this._set_batch_number(doc); } - }, + } - _set_batch_number: function(doc) { + _set_batch_number(doc) { let args = {'item_code': doc.item_code, 'warehouse': doc.warehouse, 'qty': flt(doc.qty) * flt(doc.conversion_factor)}; if (doc.has_serial_no && doc.serial_no) { args['serial_no'] = doc.serial_no @@ -406,9 +406,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } } }); - }, + } - update_auto_repeat_reference: function(doc) { + update_auto_repeat_reference(doc) { if (doc.auto_repeat) { frappe.call({ method:"frappe.automation.doctype.auto_repeat.auto_repeat.update_reference", @@ -426,7 +426,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }) } } -}); +}; frappe.ui.form.on(cur_frm.doctype,"project", function(frm) { if(in_list(["Delivery Note", "Sales Invoice"], frm.doc.doctype)) { diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js index 933ca8ab3d4..dbf9901a007 100644 --- a/erpnext/stock/dashboard/item_dashboard.js +++ b/erpnext/stock/dashboard/item_dashboard.js @@ -1,11 +1,11 @@ frappe.provide('erpnext.stock'); -erpnext.stock.ItemDashboard = Class.extend({ - init: function (opts) { +erpnext.stock.ItemDashboard = class ItemDashboard { + constructor(opts) { $.extend(this, opts); this.make(); - }, - make: function () { + } + make() { var me = this; this.start = 0; if (!this.sort_by) { @@ -79,9 +79,9 @@ erpnext.stock.ItemDashboard = Class.extend({ me.refresh(); }); - }, - refresh: function () { - if (this.before_refresh) { + } + refresh() { + if(this.before_refresh) { this.before_refresh(); } @@ -104,9 +104,9 @@ erpnext.stock.ItemDashboard = Class.extend({ me.render(r.message); } }); - }, - render: function (data) { - if (this.start === 0) { + } + render(data) { + if (this.start===0) { this.max_count = 0; this.result.empty(); } @@ -141,11 +141,11 @@ erpnext.stock.ItemDashboard = Class.extend({ $(`