From 7de05ae8f3beeb90561ba3ac9b395556be68c664 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 23 May 2019 11:29:39 +0530 Subject: [PATCH 1/9] fix: Dashboards for doctypes in accounting module --- .../accounts/doctype/bank/bank_dashboard.py | 19 +++++++++ .../bank_account/bank_account_dashboard.py | 32 +++++++++++++++ .../doctype/c_form/c_form_dashboard.py | 18 +++++++++ .../finance_book/finance_book_dashboard.py | 27 +++++++++++++ .../fiscal_year/fiscal_year_dashboard.py | 23 +++++++++++ .../item_tax_template_dashboard.py | 27 +++++++++++++ .../doctype/journal_entry/journal_entry.js | 7 ++-- .../journal_entry/journal_entry_dashboard.py | 26 +++++++++++++ .../loyalty_program_dashboard.py | 19 +++++++++ .../payment_gateway_account_dashboard.py | 22 +++++++++++ .../payment_term/payment_term_dashboard.py | 19 +++++++++ .../payment_terms_template_dashboard.py | 0 .../pos_profile/pos_profile_dashboard.py | 19 +++++++++ .../share_type/share_type_dashboard.py | 15 +++++++ .../shareholder/shareholder_dashboard.py | 18 +++++++++ .../shipping_rule/shipping_rule_dashboard.py | 26 +++++++++++++ .../subscription_plan_dashboard.py | 24 ++++++++++++ .../tax_category/tax_category_dashboard.py | 39 +++++++++++++++++++ .../tax_withholding_category_dashboard.py | 15 +++++++ 19 files changed, 391 insertions(+), 4 deletions(-) create mode 100644 erpnext/accounts/doctype/bank/bank_dashboard.py create mode 100644 erpnext/accounts/doctype/bank_account/bank_account_dashboard.py create mode 100644 erpnext/accounts/doctype/c_form/c_form_dashboard.py create mode 100644 erpnext/accounts/doctype/finance_book/finance_book_dashboard.py create mode 100644 erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py create mode 100644 erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py create mode 100644 erpnext/accounts/doctype/journal_entry/journal_entry_dashboard.py create mode 100644 erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py create mode 100644 erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py create mode 100644 erpnext/accounts/doctype/payment_term/payment_term_dashboard.py create mode 100644 erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py create mode 100644 erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py create mode 100644 erpnext/accounts/doctype/share_type/share_type_dashboard.py create mode 100644 erpnext/accounts/doctype/shareholder/shareholder_dashboard.py create mode 100644 erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py create mode 100644 erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py create mode 100644 erpnext/accounts/doctype/tax_category/tax_category_dashboard.py create mode 100644 erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py diff --git a/erpnext/accounts/doctype/bank/bank_dashboard.py b/erpnext/accounts/doctype/bank/bank_dashboard.py new file mode 100644 index 0000000000..dcc6669043 --- /dev/null +++ b/erpnext/accounts/doctype/bank/bank_dashboard.py @@ -0,0 +1,19 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'bank', + 'transactions': [ + { + 'label': _('Bank Deatils'), + 'items': ['Bank Account', 'Bank Statement Transaction Entry', 'Bank Guarantee'] + }, + { + 'label': _('Payments'), + 'items': ['Payment Order'] + } + ] + } diff --git a/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py b/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py new file mode 100644 index 0000000000..8339cb5937 --- /dev/null +++ b/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py @@ -0,0 +1,32 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'bank_account', + 'non_standard_fieldnames': { + 'Customer': 'default_bank_account', + 'Supplier': 'default_bank_account', + 'Journal Entry': 'bank_account_no' + }, + 'transactions': [ + { + 'label': _('Payments'), + 'items': ['Payment Entry', 'Payment Request', 'Payment Order'] + }, + { + 'label': _('Party'), + 'items': ['Customer', 'Supplier'] + }, + { + 'label': _('Banking'), + 'items': ['Bank Guarantee'] + }, + { + 'label': _('Journal Entries'), + 'items': ['Journal Entry'] + } + ] + } \ No newline at end of file diff --git a/erpnext/accounts/doctype/c_form/c_form_dashboard.py b/erpnext/accounts/doctype/c_form/c_form_dashboard.py new file mode 100644 index 0000000000..97af2bc5b6 --- /dev/null +++ b/erpnext/accounts/doctype/c_form/c_form_dashboard.py @@ -0,0 +1,18 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'c_form', + 'non_standard_fieldnames': { + 'Sales Invoice': 'c_form_no' + }, + 'transactions': [ + { + 'label': _('Sales Invoice'), + 'items': ['Sales Invoice'] + } + ] + } diff --git a/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py b/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py new file mode 100644 index 0000000000..4d3b42e911 --- /dev/null +++ b/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py @@ -0,0 +1,27 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'finance_book', + 'non_standard_fieldnames': { + 'Asset': 'default_finance_book', + 'Company': 'default_finance_book' + }, + 'transactions': [ + { + 'label': _('Assets'), + 'items': ['Asset', 'Asset Value Adjustment'] + }, + { + 'label': _('Companies'), + 'items': ['Company'] + }, + { + 'label': _('Journal Entries'), + 'items': ['Journal Entry'] + } + ] + } diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py new file mode 100644 index 0000000000..c7604ec7cc --- /dev/null +++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py @@ -0,0 +1,23 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'fiscal_year', + 'transactions': [ + { + 'label': _('Budgets'), + 'items': ['Budget'] + }, + { + 'label': _('References'), + 'items': ['Period Closing Voucher', 'Request for Quotation', 'Tax Withholding Category'] + }, + { + 'label': _('Target Details'), + 'items': ['Sales Person', 'Sales Partner', 'Territory', 'Monthly Distribution'] + } + ] + } diff --git a/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py b/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py new file mode 100644 index 0000000000..674ad83a58 --- /dev/null +++ b/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py @@ -0,0 +1,27 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'item_tax_template', + 'transactions': [ + { + 'label': _('Pre Sales'), + 'items': ['Quotation', 'Supplier Quotation'] + }, + { + 'label': _('Sales'), + 'items': ['Sales Invoice', 'Sales Order', 'Delivery Note'] + }, + { + 'label': _('Purchase'), + 'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt'] + }, + { + 'label': _('Item Tax'), + 'items': ['Item'] + } + ] + } diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index 3ac677e50a..6973a46cc7 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -25,13 +25,13 @@ frappe.ui.form.on("Journal Entry", { "group_by_voucher": 0 }; frappe.set_route("query-report", "General Ledger"); - }, "fa fa-table"); + }, __('View')); } if(frm.doc.docstatus==1) { frm.add_custom_button(__('Reverse Journal Entry'), function() { return erpnext.journal_entry.reverse_journal_entry(frm); - }); + }, __('Make')); } if (frm.doc.__islocal) { @@ -47,8 +47,7 @@ frappe.ui.form.on("Journal Entry", { frm.add_custom_button(__("Create Inter Company Journal Entry"), function() { frm.trigger("make_inter_company_journal_entry"); - } - ); + }, __('Make')); } }, diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry_dashboard.py b/erpnext/accounts/doctype/journal_entry/journal_entry_dashboard.py new file mode 100644 index 0000000000..ba2641940a --- /dev/null +++ b/erpnext/accounts/doctype/journal_entry/journal_entry_dashboard.py @@ -0,0 +1,26 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'journal_entry', + 'non_standard_fieldnames': { + 'Stock Entry': 'credit_note', + }, + 'transactions': [ + { + 'label': _('Assets'), + 'items': ['Asset', 'Asset Value Adjustment'] + }, + { + 'label': _('Stock'), + 'items': ['Stock Entry'] + }, + { + 'label': _('Salaries'), + 'items': ['Salary Slip'] + } + ] + } diff --git a/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py b/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py new file mode 100644 index 0000000000..3fab11bf85 --- /dev/null +++ b/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py @@ -0,0 +1,19 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'loyalty_program', + 'transactions': [ + { + 'label': _('Sales Invoice'), + 'items': ['Sales Invoice'] + }, + { + 'label': _('Customers'), + 'items': ['Customer'] + } + ] + } diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py new file mode 100644 index 0000000000..210593e550 --- /dev/null +++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py @@ -0,0 +1,22 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'payment_gateway_account', + 'non_standard_fieldnames': { + 'Subscription Plan': 'payment_gateway' + }, + 'transactions': [ + { + 'label': _('Payments'), + 'items': ['Payment Request'] + }, + { + 'label': _('Subscription Plans'), + 'items': ['Subscription Plan'] + } + ] + } diff --git a/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py b/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py new file mode 100644 index 0000000000..fafbb71976 --- /dev/null +++ b/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py @@ -0,0 +1,19 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'payment_term', + 'transactions': [ + { + 'label': _('Invoices and Orders'), + 'items': ['Sales Invoice', 'Sales Order', 'Purchase Invoice', 'Purchase Order', 'Quotation'] + }, + { + 'label': _('Payment Terms Template'), + 'items': ['Payment Terms Template'] + } + ] + } diff --git a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py b/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py new file mode 100644 index 0000000000..c0a3636cc6 --- /dev/null +++ b/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py @@ -0,0 +1,19 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'pos_profile', + 'transactions': [ + { + 'label': _('Sales Invoices'), + 'items': ['Sales Invoice'] + }, + { + 'label': _('POS Closing Vouchers'), + 'items': ['POS Closing Voucher'] + } + ] + } diff --git a/erpnext/accounts/doctype/share_type/share_type_dashboard.py b/erpnext/accounts/doctype/share_type/share_type_dashboard.py new file mode 100644 index 0000000000..455b022577 --- /dev/null +++ b/erpnext/accounts/doctype/share_type/share_type_dashboard.py @@ -0,0 +1,15 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'share_type', + 'transactions': [ + { + 'label': _('References'), + 'items': ['Share Transfer', 'Shareholder'] + } + ] + } diff --git a/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py b/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py new file mode 100644 index 0000000000..1a64c94d22 --- /dev/null +++ b/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py @@ -0,0 +1,18 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'shareholder', + 'non_standard_fieldnames': { + 'Share Transfer': 'to_shareholder' + }, + 'transactions': [ + { + 'label': _('Share Transfers'), + 'items': ['Share Transfer'] + } + ] + } diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py b/erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py new file mode 100644 index 0000000000..636ee5788d --- /dev/null +++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py @@ -0,0 +1,26 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'shipping_rule', + 'non_standard_fieldnames': { + 'Payment Entry': 'party_name' + }, + 'transactions': [ + { + 'label': _('Pre Sales'), + 'items': ['Quotation', 'Supplier Quotation'] + }, + { + 'label': _('Sales'), + 'items': ['Sales Order', 'Delivery Note', 'Sales Invoice'] + }, + { + 'label': _('Purchase'), + 'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt'] + } + ] + } diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py b/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py new file mode 100644 index 0000000000..e28b127529 --- /dev/null +++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py @@ -0,0 +1,24 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'subscription_plan', + 'non_standard_fieldnames': { + 'Payment Request': 'plan', + 'Subscription': 'plan' + + }, + 'transactions': [ + { + 'label': _('Payments'), + 'items': ['Payment Request'] + }, + { + 'label': _('Subscriptions'), + 'items': ['Subscription'] + } + ] + } diff --git a/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py b/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py new file mode 100644 index 0000000000..5c5d32c9c4 --- /dev/null +++ b/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py @@ -0,0 +1,39 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'tax_category', + 'non_standard_fieldnames': { + 'Payment Entry': 'party_name' + }, + 'internal_links': { + 'Purchase Order': ['items', 'purchase_order'], + 'Project': ['items', 'project'], + 'Quality Inspection': ['items', 'quality_inspection'], + }, + 'transactions': [ + { + 'label': _('Pre Sales'), + 'items': ['Quotation', 'Supplier Quotation'] + }, + { + 'label': _('Sales'), + 'items': ['Sales Invoice', 'Delivery Note', 'Sales Order'] + }, + { + 'label': _('Purchase'), + 'items': ['Purchase Invoice', 'Purchase Receipt'] + }, + { + 'label': _('Party'), + 'items': ['Customer', 'Supplier'] + }, + { + 'label': _('Taxes'), + 'items': ['Item', 'Tax Rule'] + } + ] + } diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py new file mode 100644 index 0000000000..3c8ae98d3d --- /dev/null +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py @@ -0,0 +1,15 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'tax_withholding_category', + 'transactions': [ + { + 'label': _('Suppliers'), + 'items': ['Supplier'] + } + ] + } From 8f3a6c1596cd8ab6c38759c21e1935050bc37d2c Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 30 May 2019 11:53:12 +0530 Subject: [PATCH 2/9] fix: Dashboards for doctypes in accounting modules --- .../monthly_distribution_dashboard.py | 24 ++++++++++++++ .../payment_terms_template_dashboard.py | 33 +++++++++++++++++++ ...se_taxes_and_charges_template_dashboard.py | 26 +++++++++++++++ ...es_taxes_and_charges_template_dashboard.py | 28 ++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py create mode 100644 erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py create mode 100644 erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py new file mode 100644 index 0000000000..d307fd5732 --- /dev/null +++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py @@ -0,0 +1,24 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'monthly_distribution', + 'non_standard_fieldnames': { + 'Sales Person': 'distribution_id', + 'Territory': 'distribution_id', + 'Sales Partner': 'distribution_id', + }, + 'transactions': [ + { + 'label': _('Target Details'), + 'items': ['Sales Person', 'Territory', 'Sales Partner'] + }, + { + 'label': _('References'), + 'items': ['Budget'] + } + ] + } \ No newline at end of file diff --git a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py index e69de29bb2..c705097ac6 100644 --- a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py +++ b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py @@ -0,0 +1,33 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'payment_terms_template', + 'non_standard_fieldnames': { + 'Customer Group': 'payment_terms', + 'Supplier Group': 'payment_terms', + 'Supplier': 'payment_terms', + 'Customer': 'payment_terms' + }, + 'transactions': [ + { + 'label': _('Sales'), + 'items': ['Sales Invoice', 'Sales Order', 'Quotation'] + }, + { + 'label': _('Purchase'), + 'items': ['Purchase Invoice', 'Purchase Order'] + }, + { + 'label': _('Party'), + 'items': ['Customer', 'Supplier'] + }, + { + 'label': _('Group'), + 'items': ['Customer Group', 'Supplier Group'] + } + ] + } \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py new file mode 100644 index 0000000000..0953a98fa2 --- /dev/null +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py @@ -0,0 +1,26 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'taxes_and_charges', + 'non_standard_fieldnames': { + 'Tax Rule': 'purchase_tax_template', + }, + 'transactions': [ + { + 'label': _('Transactions'), + 'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt'] + }, + { + 'label': _('Supplier Quotations'), + 'items': ['Supplier Quotation'] + }, + { + 'label': _('Tax Rules'), + 'items': ['Tax Rule'] + } + ] + } \ No newline at end of file diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py new file mode 100644 index 0000000000..9deb5b6b9e --- /dev/null +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py @@ -0,0 +1,28 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'taxes_and_charges', + 'non_standard_fieldnames': { + 'Tax Rule': 'sales_tax_template', + 'Subscription': 'tax_template', + 'Restaurant': 'default_tax_template' + }, + 'transactions': [ + { + 'label': _('Transactions'), + 'items': ['Sales Invoice', 'Sales Order', 'Delivery Note'] + }, + { + 'label': _('References'), + 'items': ['POS Profile', 'Subscription', 'Restaurant'] + }, + { + 'label': _('Tax Rules'), + 'items': ['Tax Rule'] + } + ] + } \ No newline at end of file From e233708754d208bd0a5a95e701bd7eb4c0ea5d5a Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 30 May 2019 12:14:16 +0530 Subject: [PATCH 3/9] fix: Tax category dashboard --- .../doctype/tax_category/tax_category_dashboard.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py b/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py index 5c5d32c9c4..d643efb090 100644 --- a/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py +++ b/erpnext/accounts/doctype/tax_category/tax_category_dashboard.py @@ -6,14 +6,6 @@ from frappe import _ def get_data(): return { 'fieldname': 'tax_category', - 'non_standard_fieldnames': { - 'Payment Entry': 'party_name' - }, - 'internal_links': { - 'Purchase Order': ['items', 'purchase_order'], - 'Project': ['items', 'project'], - 'Quality Inspection': ['items', 'quality_inspection'], - }, 'transactions': [ { 'label': _('Pre Sales'), From a9b2e4e4a89547c7061bc6d03c6be8e6a8c9441d Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Thu, 30 May 2019 12:18:10 +0530 Subject: [PATCH 4/9] fix: White space in subscription plan dashboard --- .../doctype/subscription_plan/subscription_plan_dashboard.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py b/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py index e28b127529..b118e582a2 100644 --- a/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py +++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py @@ -9,7 +9,6 @@ def get_data(): 'non_standard_fieldnames': { 'Payment Request': 'plan', 'Subscription': 'plan' - }, 'transactions': [ { From 290847df4655dc32f773eef0da7cc01a7ed36668 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sun, 2 Jun 2019 19:35:18 +0530 Subject: [PATCH 5/9] fix: Fixes in accounting doctype dashboards --- .../accounts/doctype/bank/bank_dashboard.py | 1 - .../bank_account/bank_account_dashboard.py | 2 -- .../doctype/c_form/c_form_dashboard.py | 18 ------------- .../finance_book/finance_book_dashboard.py | 2 -- .../item_tax_template_dashboard.py | 1 - .../journal_entry/journal_entry_dashboard.py | 26 ------------------- .../loyalty_program_dashboard.py | 7 +---- .../monthly_distribution_dashboard.py | 1 - .../payment_gateway_account_dashboard.py | 2 -- .../payment_term/payment_term_dashboard.py | 9 ++++--- .../pos_profile/pos_profile_dashboard.py | 7 +---- ...se_taxes_and_charges_template_dashboard.py | 8 ++---- ...es_taxes_and_charges_template_dashboard.py | 6 +---- .../shareholder/shareholder_dashboard.py | 1 - .../subscription_plan_dashboard.py | 8 ++---- .../tax_withholding_category_dashboard.py | 1 - 16 files changed, 13 insertions(+), 87 deletions(-) delete mode 100644 erpnext/accounts/doctype/c_form/c_form_dashboard.py delete mode 100644 erpnext/accounts/doctype/journal_entry/journal_entry_dashboard.py diff --git a/erpnext/accounts/doctype/bank/bank_dashboard.py b/erpnext/accounts/doctype/bank/bank_dashboard.py index dcc6669043..230613c5b3 100644 --- a/erpnext/accounts/doctype/bank/bank_dashboard.py +++ b/erpnext/accounts/doctype/bank/bank_dashboard.py @@ -12,7 +12,6 @@ def get_data(): 'items': ['Bank Account', 'Bank Statement Transaction Entry', 'Bank Guarantee'] }, { - 'label': _('Payments'), 'items': ['Payment Order'] } ] diff --git a/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py b/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py index 8339cb5937..3d149eb334 100644 --- a/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py +++ b/erpnext/accounts/doctype/bank_account/bank_account_dashboard.py @@ -21,11 +21,9 @@ def get_data(): 'items': ['Customer', 'Supplier'] }, { - 'label': _('Banking'), 'items': ['Bank Guarantee'] }, { - 'label': _('Journal Entries'), 'items': ['Journal Entry'] } ] diff --git a/erpnext/accounts/doctype/c_form/c_form_dashboard.py b/erpnext/accounts/doctype/c_form/c_form_dashboard.py deleted file mode 100644 index 97af2bc5b6..0000000000 --- a/erpnext/accounts/doctype/c_form/c_form_dashboard.py +++ /dev/null @@ -1,18 +0,0 @@ -from __future__ import unicode_literals - -from frappe import _ - - -def get_data(): - return { - 'fieldname': 'c_form', - 'non_standard_fieldnames': { - 'Sales Invoice': 'c_form_no' - }, - 'transactions': [ - { - 'label': _('Sales Invoice'), - 'items': ['Sales Invoice'] - } - ] - } diff --git a/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py b/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py index 4d3b42e911..c2ebea6e8f 100644 --- a/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py +++ b/erpnext/accounts/doctype/finance_book/finance_book_dashboard.py @@ -16,11 +16,9 @@ def get_data(): 'items': ['Asset', 'Asset Value Adjustment'] }, { - 'label': _('Companies'), 'items': ['Company'] }, { - 'label': _('Journal Entries'), 'items': ['Journal Entry'] } ] diff --git a/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py b/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py index 674ad83a58..acc308e0e6 100644 --- a/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py +++ b/erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py @@ -20,7 +20,6 @@ def get_data(): 'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt'] }, { - 'label': _('Item Tax'), 'items': ['Item'] } ] diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry_dashboard.py b/erpnext/accounts/doctype/journal_entry/journal_entry_dashboard.py deleted file mode 100644 index ba2641940a..0000000000 --- a/erpnext/accounts/doctype/journal_entry/journal_entry_dashboard.py +++ /dev/null @@ -1,26 +0,0 @@ -from __future__ import unicode_literals - -from frappe import _ - - -def get_data(): - return { - 'fieldname': 'journal_entry', - 'non_standard_fieldnames': { - 'Stock Entry': 'credit_note', - }, - 'transactions': [ - { - 'label': _('Assets'), - 'items': ['Asset', 'Asset Value Adjustment'] - }, - { - 'label': _('Stock'), - 'items': ['Stock Entry'] - }, - { - 'label': _('Salaries'), - 'items': ['Salary Slip'] - } - ] - } diff --git a/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py b/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py index 3fab11bf85..189004f5ec 100644 --- a/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py +++ b/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py @@ -8,12 +8,7 @@ def get_data(): 'fieldname': 'loyalty_program', 'transactions': [ { - 'label': _('Sales Invoice'), - 'items': ['Sales Invoice'] - }, - { - 'label': _('Customers'), - 'items': ['Customer'] + 'items': ['Sales Invoice', 'Customer'] } ] } diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py index d307fd5732..a679499815 100644 --- a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py +++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py @@ -17,7 +17,6 @@ def get_data(): 'items': ['Sales Person', 'Territory', 'Sales Partner'] }, { - 'label': _('References'), 'items': ['Budget'] } ] diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py index 210593e550..08982296f3 100644 --- a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py +++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py @@ -11,11 +11,9 @@ def get_data(): }, 'transactions': [ { - 'label': _('Payments'), 'items': ['Payment Request'] }, { - 'label': _('Subscription Plans'), 'items': ['Subscription Plan'] } ] diff --git a/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py b/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py index fafbb71976..d146fcdee3 100644 --- a/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py +++ b/erpnext/accounts/doctype/payment_term/payment_term_dashboard.py @@ -8,11 +8,14 @@ def get_data(): 'fieldname': 'payment_term', 'transactions': [ { - 'label': _('Invoices and Orders'), - 'items': ['Sales Invoice', 'Sales Order', 'Purchase Invoice', 'Purchase Order', 'Quotation'] + 'label': _('Sales'), + 'items': ['Sales Invoice', 'Sales Order', 'Quotation'] + }, + { + 'label': _('Purchase'), + 'items': ['Purchase Invoice', 'Purchase Order'] }, { - 'label': _('Payment Terms Template'), 'items': ['Payment Terms Template'] } ] diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py b/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py index c0a3636cc6..e28bf73075 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py +++ b/erpnext/accounts/doctype/pos_profile/pos_profile_dashboard.py @@ -8,12 +8,7 @@ def get_data(): 'fieldname': 'pos_profile', 'transactions': [ { - 'label': _('Sales Invoices'), - 'items': ['Sales Invoice'] - }, - { - 'label': _('POS Closing Vouchers'), - 'items': ['POS Closing Voucher'] + 'items': ['Sales Invoice', 'POS Closing Voucher'] } ] } diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py index 0953a98fa2..11c220bf2d 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py @@ -15,12 +15,8 @@ def get_data(): 'items': ['Purchase Invoice', 'Purchase Order', 'Purchase Receipt'] }, { - 'label': _('Supplier Quotations'), - 'items': ['Supplier Quotation'] - }, - { - 'label': _('Tax Rules'), - 'items': ['Tax Rule'] + 'label': _('References'), + 'items': ['Supplier Quotation', 'Tax Rule'] } ] } \ No newline at end of file diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py index 9deb5b6b9e..0e9c808608 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py @@ -18,11 +18,7 @@ def get_data(): }, { 'label': _('References'), - 'items': ['POS Profile', 'Subscription', 'Restaurant'] - }, - { - 'label': _('Tax Rules'), - 'items': ['Tax Rule'] + 'items': ['POS Profile', 'Subscription', 'Restaurant', 'Tax Rule'] } ] } \ No newline at end of file diff --git a/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py b/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py index 1a64c94d22..3b77fd51b5 100644 --- a/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py +++ b/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py @@ -11,7 +11,6 @@ def get_data(): }, 'transactions': [ { - 'label': _('Share Transfers'), 'items': ['Share Transfer'] } ] diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py b/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py index b118e582a2..df3023335a 100644 --- a/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py +++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py @@ -12,12 +12,8 @@ def get_data(): }, 'transactions': [ { - 'label': _('Payments'), - 'items': ['Payment Request'] - }, - { - 'label': _('Subscriptions'), - 'items': ['Subscription'] + 'label': _('References'), + 'items': ['Payment Request', 'Subscription'] } ] } diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py index 3c8ae98d3d..d51ba65b13 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py @@ -8,7 +8,6 @@ def get_data(): 'fieldname': 'tax_withholding_category', 'transactions': [ { - 'label': _('Suppliers'), 'items': ['Supplier'] } ] From 1831844fcf60100568d317e9a73887477d34385a Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Mon, 3 Jun 2019 21:53:58 +0530 Subject: [PATCH 6/9] fix: Dashboard for cost center --- erpnext/accounts/doctype/bank/bank_dashboard.py | 2 +- .../doctype/cost_center/cost_center_dashboard.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 erpnext/accounts/doctype/cost_center/cost_center_dashboard.py diff --git a/erpnext/accounts/doctype/bank/bank_dashboard.py b/erpnext/accounts/doctype/bank/bank_dashboard.py index 230613c5b3..432404155d 100644 --- a/erpnext/accounts/doctype/bank/bank_dashboard.py +++ b/erpnext/accounts/doctype/bank/bank_dashboard.py @@ -9,7 +9,7 @@ def get_data(): 'transactions': [ { 'label': _('Bank Deatils'), - 'items': ['Bank Account', 'Bank Statement Transaction Entry', 'Bank Guarantee'] + 'items': ['Bank Account', 'Bank Guarantee'] }, { 'items': ['Payment Order'] diff --git a/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py b/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py new file mode 100644 index 0000000000..788ac8be83 --- /dev/null +++ b/erpnext/accounts/doctype/cost_center/cost_center_dashboard.py @@ -0,0 +1,15 @@ +from __future__ import unicode_literals + +from frappe import _ + + +def get_data(): + return { + 'fieldname': 'cost_center', + 'reports': [ + { + 'label': _('Reports'), + 'items': ['Budget Variance Report', 'General Ledger'] + } + ] + } \ No newline at end of file From a99d3a844f1194c6a6f7ac12f0df4103c74f5b60 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 12 Jun 2019 14:32:27 +0530 Subject: [PATCH 7/9] test: fix fixtures for program and course --- erpnext/education/doctype/course/test_records.json | 9 +++------ erpnext/education/doctype/program/test_records.json | 6 ++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/erpnext/education/doctype/course/test_records.json b/erpnext/education/doctype/course/test_records.json index ec57dc73a1..1e7467aed2 100644 --- a/erpnext/education/doctype/course/test_records.json +++ b/erpnext/education/doctype/course/test_records.json @@ -1,17 +1,14 @@ [ { - "course_name": "_Test Course", - "course_code": "TC100", + "course_name": "TC100", "course_abbreviation": "TC" }, { - "course_name": "_Test Course 1", - "course_code": "TC101", + "course_name": "TC101", "course_abbreviation": "TC1" }, { - "course_name": "_Test Course 2", - "course_code": "TC102", + "course_name": "TC102", "course_abbreviation": "TC2" } ] \ No newline at end of file diff --git a/erpnext/education/doctype/program/test_records.json b/erpnext/education/doctype/program/test_records.json index 7901db3225..4013695896 100644 --- a/erpnext/education/doctype/program/test_records.json +++ b/erpnext/education/doctype/program/test_records.json @@ -1,13 +1,11 @@ [ { - "program_name": "_Test Program 1", - "program_code": "_TP1", + "program_name": "_TP1", "description": "Test Description", "program_abbreviation": "TP1" }, { - "program_name": "_Test Program 2", - "program_code": "_TP2", + "program_name": "_TP2", "description": "Test Description", "program_abbreviation": "TP2" } From 3264822c1c4eead89f6824fb853ca67222c72765 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 12 Jun 2019 15:43:36 +0530 Subject: [PATCH 8/9] test: fixed unknown column course_name --- .../education/doctype/program_enrollment/program_enrollment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment.py b/erpnext/education/doctype/program_enrollment/program_enrollment.py index d232e47245..d5348ffd06 100644 --- a/erpnext/education/doctype/program_enrollment/program_enrollment.py +++ b/erpnext/education/doctype/program_enrollment/program_enrollment.py @@ -66,7 +66,7 @@ class ProgramEnrollment(Document): msgprint(_("Fee Records Created - {0}").format(comma_and(fee_list))) def get_courses(self): - return frappe.db.sql('''select course, course_name from `tabProgram Course` where parent = %s and required = 1''', (self.program), as_dict=1) + return frappe.db.sql('''select course from `tabProgram Course` where parent = %s and required = 1''', (self.program), as_dict=1) def create_course_enrollments(self): student = frappe.get_doc("Student", self.student) From 147d5d9bf2128291d46fa539e81d3f4e8d8c178b Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 12 Jun 2019 16:01:02 +0530 Subject: [PATCH 9/9] fix: redirect to lms home if query params not set --- erpnext/www/lms/course.py | 11 +++++++++-- erpnext/www/lms/program.py | 10 ++++++++-- erpnext/www/lms/topic.py | 10 +++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py index e7ed2e3ed6..c18d64e507 100644 --- a/erpnext/www/lms/course.py +++ b/erpnext/www/lms/course.py @@ -5,9 +5,16 @@ import frappe no_cache = 1 def get_context(context): + try: + program = frappe.form_dict['program'] + course_name = frappe.form_dict['name'] + except KeyError: + frappe.local.flags.redirect_location = '/lms' + raise frappe.Redirect + context.education_settings = frappe.get_single("Education Settings") - course = frappe.get_doc('Course', frappe.form_dict['name']) - context.program = frappe.form_dict['program'] + course = frappe.get_doc('Course', course_name) + context.program = program context.course = course context.topics = course.get_topics() diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py index 1fcb3d3028..7badedcc85 100644 --- a/erpnext/www/lms/program.py +++ b/erpnext/www/lms/program.py @@ -6,10 +6,16 @@ from frappe import _ no_cache = 1 def get_context(context): + try: + program = frappe.form_dict['program'] + except KeyError: + frappe.local.flags.redirect_location = '/lms' + raise frappe.Redirect + context.education_settings = frappe.get_single("Education Settings") - context.program = get_program(frappe.form_dict['program']) + context.program = get_program(program) context.courses = [frappe.get_doc("Course", course.course) for course in context.program.courses] - context.has_access = utils.allowed_program_access(frappe.form_dict['program']) + context.has_access = utils.allowed_program_access(program) context.progress = get_course_progress(context.courses, context.program) def get_program(program_name): diff --git a/erpnext/www/lms/topic.py b/erpnext/www/lms/topic.py index 0af0778312..f75ae8e9b6 100644 --- a/erpnext/www/lms/topic.py +++ b/erpnext/www/lms/topic.py @@ -5,9 +5,13 @@ import frappe no_cache = 1 def get_context(context): - course = frappe.form_dict['course'] - program = frappe.form_dict['program'] - topic = frappe.form_dict['topic'] + try: + course = frappe.form_dict['course'] + program = frappe.form_dict['program'] + topic = frappe.form_dict['topic'] + except KeyError: + frappe.local.flags.redirect_location = '/lms' + raise frappe.Redirect context.program = program context.course = course