From db3bb793e9e4d6dd9b1b536c57afda5693de5689 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 26 Aug 2019 11:29:18 +0530 Subject: [PATCH 1/5] feat: added domain info on footer (#18839) --- erpnext/templates/includes/footer/footer_powered.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/templates/includes/footer/footer_powered.html b/erpnext/templates/includes/footer/footer_powered.html index faf5e9278c..8d5523ff97 100644 --- a/erpnext/templates/includes/footer/footer_powered.html +++ b/erpnext/templates/includes/footer/footer_powered.html @@ -1 +1,3 @@ -Powered by ERPNext +{% set domains = frappe.get_doc("Domain Settings").active_domains %} + +Powered by ERPNext - {{ domains[0].domain if domains else 'Open Source' }} ERP Software From cfec328c7490b12ec55a90cfb35edf0f1a360636 Mon Sep 17 00:00:00 2001 From: mbhavesh95863 <41165270+mbhavesh95863@users.noreply.github.com> Date: Tue, 27 Aug 2019 19:17:19 +0530 Subject: [PATCH 2/5] Same report 2 times in list --- erpnext/config/selling.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py index 844710d47c..928bd5fa32 100644 --- a/erpnext/config/selling.py +++ b/erpnext/config/selling.py @@ -304,12 +304,6 @@ def get_data(): "name": "Customers Without Any Sales Transactions", "doctype": "Customer" }, - { - "type": "report", - "is_query_report": True, - "name": "Sales Partners Commission", - "doctype": "Customer" - }, { "type": "report", "is_query_report": True, From 0aeccbf4b2ccecd71f43fd8b4d33fa6e300f5e82 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 28 Aug 2019 11:39:45 +0530 Subject: [PATCH 3/5] feat: added dashboard fixtures (#18812) * feat: add dashboard charts fixture * fix: remove return statement * feat: added patch for creating default dashboards * chore: renamed dashboard charts * feat: add add_dashboard function to install fixtures * fix: reload doctype issue in patches * fix (travis): reloaded dashboard chart source * fix (travis): reloaded dashboard chart source * fix (travis): reloaded dashboard doctype * fix (travis): reloaded dashboard chart link doctype --- erpnext/patches.txt | 5 + .../patches/v12_0/add_default_dashboards.py | 8 ++ .../setup_wizard/data/dashboard_charts.py | 107 ++++++++++++++++++ .../operations/install_fixtures.py | 10 +- 4 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v12_0/add_default_dashboards.py create mode 100644 erpnext/setup/setup_wizard/data/dashboard_charts.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index dc6c6daa13..07b8ee6ab4 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -625,5 +625,10 @@ erpnext.patches.v12_0.add_default_buying_selling_terms_in_company erpnext.patches.v12_0.update_ewaybill_field_position erpnext.patches.v12_0.create_accounting_dimensions_in_missing_doctypes erpnext.patches.v11_1.set_status_for_material_request_type_manufacture +execute:frappe.reload_doc('desk', 'doctype','dashboard_chart_link') +execute:frappe.reload_doc('desk', 'doctype','dashboard') +execute:frappe.reload_doc('desk', 'doctype','dashboard_chart_source') +execute:frappe.reload_doc('desk', 'doctype','dashboard_chart') +erpnext.patches.v12_0.add_default_dashboards erpnext.patches.v12_0.remove_bank_remittance_custom_fields erpnext.patches.v12_0.generate_leave_ledger_entries diff --git a/erpnext/patches/v12_0/add_default_dashboards.py b/erpnext/patches/v12_0/add_default_dashboards.py new file mode 100644 index 0000000000..ab92fbaa69 --- /dev/null +++ b/erpnext/patches/v12_0/add_default_dashboards.py @@ -0,0 +1,8 @@ +# Copyright (c) 2019, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +import frappe +from erpnext.setup.setup_wizard.operations.install_fixtures import add_dashboards + +def execute(): + add_dashboards() diff --git a/erpnext/setup/setup_wizard/data/dashboard_charts.py b/erpnext/setup/setup_wizard/data/dashboard_charts.py new file mode 100644 index 0000000000..41cfcb529e --- /dev/null +++ b/erpnext/setup/setup_wizard/data/dashboard_charts.py @@ -0,0 +1,107 @@ +from __future__ import unicode_literals +from frappe import _ +import frappe +import json + +def get_default_dashboards(): + company = frappe.get_doc("Company", frappe.defaults.get_defaults().company) + income_account = company.default_income_account or get_account("Income Account", company.name) + expense_account = company.default_expense_account or get_account("Expense Account", company.name) + bank_account = company.default_bank_account or get_account("Bank", company.name) + + return { + "Dashboards": [ + { + "doctype": "Dashboard", + "dashboard_name": "Accounts", + "charts": [ + { "chart": "Outgoing Bills (Sales Invoice)" }, + { "chart": "Incoming Bills (Purchase Invoice)" }, + { "chart": "Bank Balance" }, + { "chart": "Income" }, + { "chart": "Expenses" } + ] + } + ], + "Charts": [ + { + "doctype": "Dashboard Chart", + "time_interval": "Quarterly", + "chart_name": "Income", + "timespan": "Last Year", + "color": None, + "filters_json": json.dumps({"company": company.name, "account": income_account}), + "source": "Account Balance Timeline", + "chart_type": "Custom", + "timeseries": 1, + "owner": "Administrator", + "type": "Line", + "width": "Half" + }, + { + "doctype": "Dashboard Chart", + "time_interval": "Quarterly", + "chart_name": "Expenses", + "timespan": "Last Year", + "color": None, + "filters_json": json.dumps({"company": company.name, "account": expense_account}), + "source": "Account Balance Timeline", + "chart_type": "Custom", + "timeseries": 1, + "owner": "Administrator", + "type": "Line", + "width": "Half" + }, + { + "doctype": "Dashboard Chart", + "time_interval": "Quarterly", + "chart_name": "Bank Balance", + "timespan": "Last Year", + "color": "#ffb868", + "filters_json": json.dumps({"company": company.name, "account": bank_account}), + "source": "Account Balance Timeline", + "chart_type": "Custom", + "timeseries": 1, + "owner": "Administrator", + "type": "Line", + "width": "Half" + }, + { + "doctype": "Dashboard Chart", + "time_interval": "Monthly", + "chart_name": "Incoming Bills (Purchase Invoice)", + "timespan": "Last Year", + "color": "#a83333", + "value_based_on": "base_grand_total", + "filters_json": json.dumps({}), + "chart_type": "Sum", + "timeseries": 1, + "based_on": "posting_date", + "owner": "Administrator", + "document_type": "Purchase Invoice", + "type": "Bar", + "width": "Half" + }, + { + "doctype": "Dashboard Chart", + "time_interval": "Monthly", + "chart_name": "Outgoing Bills (Sales Invoice)", + "timespan": "Last Year", + "color": "#7b933d", + "value_based_on": "base_grand_total", + "filters_json": json.dumps({}), + "chart_type": "Sum", + "timeseries": 1, + "based_on": "posting_date", + "owner": "Administrator", + "document_type": "Sales Invoice", + "type": "Bar", + "width": "Half" + } + ] + } + +def get_account(account_type, company): + accounts = frappe.get_list("Account", filters={"account_type": account_type, "company": company}) + if accounts: + return accounts[0].name \ No newline at end of file diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index 4b734df61d..7123021d1e 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -475,13 +475,14 @@ def install_defaults(args=None): frappe.db.set_value("Company", args.company_name, "default_bank_account", bank_account.name, update_modified=False) - return doc except RootNotEditable: frappe.throw(_("Bank account cannot be named as {0}").format(args.bank_account)) except frappe.DuplicateEntryError: # bank account same as a CoA entry pass + add_dashboards() + # Now, with fixtures out of the way, onto concrete stuff records = [ @@ -499,6 +500,13 @@ def install_defaults(args=None): make_records(records) +def add_dashboards(): + from erpnext.setup.setup_wizard.data.dashboard_charts import get_default_dashboards + dashboard_data = get_default_dashboards() + + make_records(dashboard_data["Charts"]) + make_records(dashboard_data["Dashboards"]) + def get_fy_details(fy_start_date, fy_end_date): start_year = getdate(fy_start_date).year From d03d8204ab797e2b4cb3a46e4fda64a5e4f91f1e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 28 Aug 2019 16:56:07 +0530 Subject: [PATCH 4/5] fix: incorrect valuation rate calculated because of string replacement issue --- erpnext/stock/stock_ledger.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py index 920fc272f7..f7deac3591 100644 --- a/erpnext/stock/stock_ledger.py +++ b/erpnext/stock/stock_ledger.py @@ -227,9 +227,9 @@ class update_entries_after(object): elif actual_qty < 0: # In case of delivery/stock issue, get average purchase rate # of serial nos of current entry - stock_value_change = -1 * flt(frappe.db.sql("""select sum(purchase_rate) - from `tabSerial No` where name in (%s)""" % (", ".join(["%s"]*len(serial_no))), - tuple(serial_no))[0][0]) + stock_value_change = -1 * flt(frappe.get_all("Serial No", + fields=["sum(purchase_rate)"], + filters = {'name': ('in', serial_no)}, as_list=1)[0][0]) new_stock_qty = self.qty_after_transaction + actual_qty From 354d0af44e138b9bb84c36bbbd51448ccce56af3 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 28 Aug 2019 17:51:31 +0530 Subject: [PATCH 5/5] fix: added purchase invoice in buying module --- erpnext/config/buying.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py index f5d8da74c5..6f5ab32b63 100644 --- a/erpnext/config/buying.py +++ b/erpnext/config/buying.py @@ -14,6 +14,12 @@ def get_data(): "dependencies": ["Item", "Supplier"], "description": _("Purchase Orders given to Suppliers."), }, + { + "type": "doctype", + "name": "Purchase Invoice", + "onboard": 1, + "dependencies": ["Item", "Supplier"] + }, { "type": "doctype", "name": "Material Request",