Merge branch 'develop' into change-video-doctype-module

This commit is contained in:
Marica 2020-07-22 21:22:39 +05:30 committed by GitHub
commit f207f48a67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
104 changed files with 2157 additions and 1377 deletions

View File

@ -0,0 +1,58 @@
{
"cards": [
{
"card": "Total Outgoing Bills"
},
{
"card": "Total Incoming Bills"
},
{
"card": "Total Incoming Payment"
},
{
"card": "Total Outgoing Payment"
}
],
"charts": [
{
"chart": "Profit and Loss",
"width": "Full"
},
{
"chart": "Incoming Bills (Purchase Invoice)",
"width": "Half"
},
{
"chart": "Outgoing Bills (Sales Invoice)",
"width": "Half"
},
{
"chart": "Accounts Receivable Ageing",
"width": "Half"
},
{
"chart": "Accounts Payable Ageing",
"width": "Half"
},
{
"chart": "Budget Variance",
"width": "Full"
},
{
"chart": "Bank Balance",
"width": "Full"
}
],
"creation": "2020-07-17 11:25:34.796608",
"dashboard_name": "Accounts",
"docstatus": 0,
"doctype": "Dashboard",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"modified": "2020-07-22 13:07:34.540574",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts",
"owner": "Administrator"
}

View File

@ -0,0 +1,23 @@
{
"chart_name": "Accounts Payable Ageing",
"chart_type": "Report",
"creation": "2020-07-17 11:25:34.564015",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"report_date\":\"frappe.datetime.now_date()\"}",
"filters_json": "{\"ageing_based_on\":\"Due Date\",\"range1\":30,\"range2\":60,\"range3\":90,\"range4\":120,\"group_by_party\":0,\"based_on_payment_terms\":0}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 12:29:33.584419",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Payable Ageing",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Accounts Payable",
"timeseries": 0,
"type": "Donut",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,23 @@
{
"chart_name": "Accounts Receivable Ageing",
"chart_type": "Report",
"creation": "2020-07-17 11:25:34.535388",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"report_date\":\"frappe.datetime.now_date()\"}",
"filters_json": "{\"ageing_based_on\":\"Due Date\",\"range1\":30,\"range2\":60,\"range3\":90,\"range4\":120,\"group_by_party\":0,\"based_on_payment_terms\":0,\"show_future_payments\":0,\"show_delivery_notes\":0,\"show_sales_person\":0}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 12:28:42.743551",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Receivable Ageing",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Accounts Receivable",
"timeseries": 0,
"type": "Donut",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Bank Balance",
"chart_type": "Custom",
"creation": "2020-07-17 11:25:34.620221",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"account\":\"locals[\\\":Company\\\"][frappe.defaults.get_user_default(\\\"Company\\\")][\\\"default_bank_account\\\"]\"}",
"filters_json": "{}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 12:19:59.879476",
"modified": "2020-07-22 12:21:48.780513",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Balance",
"number_of_groups": 0,
"owner": "Administrator",
"source": "Account Balance Timeline",
"time_interval": "Quarterly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Line",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,23 @@
{
"chart_name": "Budget Variance",
"chart_type": "Report",
"creation": "2020-07-17 11:25:34.593061",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_fiscal_year\":\"frappe.sys_defaults.fiscal_year\",\"to_fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}",
"filters_json": "{\"period\":\"Monthly\",\"budget_against\":\"Cost Center\",\"show_cumulative\":0}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 12:24:49.144210",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Budget Variance",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Budget Variance Report",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,29 @@
{
"based_on": "posting_date",
"chart_name": "Incoming Bills (Purchase Invoice)",
"chart_type": "Sum",
"color": "#a83333",
"creation": "2020-07-17 11:25:34.479703",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Purchase Invoice",
"dynamic_filters_json": "",
"filters_json": "[[\"Purchase Invoice\",\"docstatus\",\"=\",1]]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-21 17:37:30.727306",
"modified": "2020-07-21 17:51:07.374917",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Incoming Bills (Purchase Invoice)",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"value_based_on": "base_net_total",
"y_axis": []
}

View File

@ -0,0 +1,28 @@
{
"based_on": "posting_date",
"chart_name": "Outgoing Bills (Sales Invoice)",
"chart_type": "Sum",
"color": "#7b933d",
"creation": "2020-07-17 11:25:34.507547",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Sales Invoice",
"filters_json": "[[\"Sales Invoice\",\"docstatus\",\"=\",1]]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-21 17:37:31.574666",
"modified": "2020-07-21 17:52:03.970530",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Outgoing Bills (Sales Invoice)",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"value_based_on": "base_net_total",
"y_axis": []
}

View File

@ -0,0 +1,23 @@
{
"chart_name": "Profit and Loss",
"chart_type": "Report",
"creation": "2020-07-17 11:25:34.448572",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_fiscal_year\":\"frappe.sys_defaults.fiscal_year\",\"to_fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}",
"filters_json": "{\"filter_based_on\":\"Fiscal Year\",\"period_start_date\":\"2020-04-01\",\"period_end_date\":\"2021-03-31\",\"periodicity\":\"Yearly\",\"include_default_book_entries\":1}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 12:33:48.888943",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Profit and Loss",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Profit and Loss Statement",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -1,284 +0,0 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import json
from frappe.utils import nowdate, add_months, get_date_str
from frappe import _
from erpnext.accounts.utils import get_fiscal_year, get_account_name, FiscalYearError
def _get_fiscal_year(date=None):
try:
fiscal_year = get_fiscal_year(date=nowdate(), as_dict=True)
return fiscal_year
except FiscalYearError:
#if no fiscal year for current date then get default fiscal year
try:
fiscal_year = get_fiscal_year(as_dict=True)
return fiscal_year
except FiscalYearError:
#if still no fiscal year found then no accounting data created, return
return None
def get_company_for_dashboards():
company = frappe.defaults.get_defaults().company
if company:
return company
else:
company_list = frappe.get_list("Company")
if company_list:
return company_list[0].name
return None
def get_data():
fiscal_year = _get_fiscal_year(nowdate())
if not fiscal_year:
return frappe._dict()
return frappe._dict({
"dashboards": get_dashboards(),
"charts": get_charts(fiscal_year),
"number_cards": get_number_cards(fiscal_year)
})
def get_dashboards():
return [{
"name": "Accounts",
"dashboard_name": "Accounts",
"doctype": "Dashboard",
"charts": [
{ "chart": "Profit and Loss" , "width": "Full"},
{ "chart": "Incoming Bills (Purchase Invoice)", "width": "Half"},
{ "chart": "Outgoing Bills (Sales Invoice)", "width": "Half"},
{ "chart": "Accounts Receivable Ageing", "width": "Half"},
{ "chart": "Accounts Payable Ageing", "width": "Half"},
{ "chart": "Budget Variance", "width": "Full"},
{ "chart": "Bank Balance", "width": "Full"}
],
"cards": [
{"card": "Total Outgoing Bills"},
{"card": "Total Incoming Bills"},
{"card": "Total Incoming Payment"},
{"card": "Total Outgoing Payment"}
]
}]
def get_charts(fiscal_year):
company = frappe.get_doc("Company", get_company_for_dashboards())
bank_account = company.default_bank_account or get_account_name("Bank", company=company.name)
default_cost_center = company.cost_center
return [
{
"doctype": "Dashboard Charts",
"name": "Profit and Loss",
"owner": "Administrator",
"report_name": "Profit and Loss Statement",
"filters_json": json.dumps({
"company": company.name,
"filter_based_on": "Fiscal Year",
"from_fiscal_year": fiscal_year.get('name'),
"to_fiscal_year": fiscal_year.get('name'),
"periodicity": "Monthly",
"include_default_book_entries": 1
}),
"type": "Bar",
'timeseries': 0,
"chart_type": "Report",
"chart_name": _("Profit and Loss"),
"is_custom": 1,
"is_public": 1
},
{
"doctype": "Dashboard Chart",
"time_interval": "Monthly",
"name": "Incoming Bills (Purchase Invoice)",
"chart_name": _("Incoming Bills (Purchase Invoice)"),
"timespan": "Last Year",
"color": "#a83333",
"value_based_on": "base_net_total",
"filters_json": json.dumps([["Purchase Invoice", "docstatus", "=", 1]]),
"chart_type": "Sum",
"timeseries": 1,
"based_on": "posting_date",
"owner": "Administrator",
"document_type": "Purchase Invoice",
"type": "Bar",
"width": "Half",
"is_public": 1
},
{
"doctype": "Dashboard Chart",
"name": "Outgoing Bills (Sales Invoice)",
"time_interval": "Monthly",
"chart_name": _("Outgoing Bills (Sales Invoice)"),
"timespan": "Last Year",
"color": "#7b933d",
"value_based_on": "base_net_total",
"filters_json": json.dumps([["Sales Invoice", "docstatus", "=", 1]]),
"chart_type": "Sum",
"timeseries": 1,
"based_on": "posting_date",
"owner": "Administrator",
"document_type": "Sales Invoice",
"type": "Bar",
"width": "Half",
"is_public": 1
},
{
"doctype": "Dashboard Charts",
"name": "Accounts Receivable Ageing",
"owner": "Administrator",
"report_name": "Accounts Receivable",
"filters_json": json.dumps({
"company": company.name,
"report_date": nowdate(),
"ageing_based_on": "Due Date",
"range1": 30,
"range2": 60,
"range3": 90,
"range4": 120
}),
"type": "Donut",
'timeseries': 0,
"chart_type": "Report",
"chart_name": _("Accounts Receivable Ageing"),
"is_custom": 1,
"is_public": 1
},
{
"doctype": "Dashboard Charts",
"name": "Accounts Payable Ageing",
"owner": "Administrator",
"report_name": "Accounts Payable",
"filters_json": json.dumps({
"company": company.name,
"report_date": nowdate(),
"ageing_based_on": "Due Date",
"range1": 30,
"range2": 60,
"range3": 90,
"range4": 120
}),
"type": "Donut",
'timeseries': 0,
"chart_type": "Report",
"chart_name": _("Accounts Payable Ageing"),
"is_custom": 1,
"is_public": 1
},
{
"doctype": "Dashboard Charts",
"name": "Budget Variance",
"owner": "Administrator",
"report_name": "Budget Variance Report",
"filters_json": json.dumps({
"company": company.name,
"from_fiscal_year": fiscal_year.get('name'),
"to_fiscal_year": fiscal_year.get('name'),
"period": "Monthly",
"budget_against": "Cost Center"
}),
"type": "Bar",
"timeseries": 0,
"chart_type": "Report",
"chart_name": _("Budget Variance"),
"is_custom": 1,
"is_public": 1
},
{
"doctype": "Dashboard Charts",
"name": "Bank Balance",
"time_interval": "Quarterly",
"chart_name": "Bank Balance",
"timespan": "Last Year",
"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",
"is_public": 1
},
]
def get_number_cards(fiscal_year):
year_start_date = get_date_str(fiscal_year.get("year_start_date"))
year_end_date = get_date_str(fiscal_year.get("year_end_date"))
return [
{
"doctype": "Number Card",
"document_type": "Payment Entry",
"name": "Total Incoming Payment",
"filters_json": json.dumps([
['Payment Entry', 'docstatus', '=', 1],
['Payment Entry', 'posting_date', 'between', [year_start_date, year_end_date]],
['Payment Entry', 'payment_type', '=', 'Receive']
]),
"label": _("Total Incoming Payment"),
"function": "Sum",
"aggregate_function_based_on": "base_received_amount",
"is_public": 1,
"is_custom": 1,
"show_percentage_stats": 1,
"stats_time_interval": "Monthly"
},
{
"doctype": "Number Card",
"document_type": "Payment Entry",
"name": "Total Outgoing Payment",
"filters_json": json.dumps([
['Payment Entry', 'docstatus', '=', 1],
['Payment Entry', 'posting_date', 'between', [year_start_date, year_end_date]],
['Payment Entry', 'payment_type', '=', 'Pay']
]),
"label": _("Total Outgoing Payment"),
"function": "Sum",
"aggregate_function_based_on": "base_paid_amount",
"is_public": 1,
"is_custom": 1,
"show_percentage_stats": 1,
"stats_time_interval": "Monthly"
},
{
"doctype": "Number Card",
"document_type": "Sales Invoice",
"name": "Total Outgoing Bills",
"filters_json": json.dumps([
['Sales Invoice', 'docstatus', '=', 1],
['Sales Invoice', 'posting_date', 'between', [year_start_date, year_end_date]]
]),
"label": _("Total Outgoing Bills"),
"function": "Sum",
"aggregate_function_based_on": "base_net_total",
"is_public": 1,
"is_custom": 1,
"show_percentage_stats": 1,
"stats_time_interval": "Monthly"
},
{
"doctype": "Number Card",
"document_type": "Purchase Invoice",
"name": "Total Incoming Bills",
"filters_json": json.dumps([
['Purchase Invoice', 'docstatus', '=', 1],
['Purchase Invoice', 'posting_date', 'between', [year_start_date, year_end_date]]
]),
"label": _("Total Incoming Bills"),
"function": "Sum",
"aggregate_function_based_on": "base_net_total",
"is_public": 1,
"is_custom": 1,
"show_percentage_stats": 1,
"stats_time_interval": "Monthly"
}
]

View File

@ -13,7 +13,6 @@
"bank_name",
"swift_number",
"column_break_1",
"branch_code",
"website",
"address_and_contact",
"address_html",
@ -51,15 +50,6 @@
"fieldtype": "Column Break",
"search_index": 1
},
{
"allow_in_quick_entry": 1,
"fieldname": "branch_code",
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Branch Code",
"unique": 1
},
{
"fieldname": "address_and_contact",
"fieldtype": "Section Break",
@ -111,7 +101,7 @@
}
],
"links": [],
"modified": "2020-03-25 21:22:33.496264",
"modified": "2020-07-17 14:00:13.105433",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank",

View File

@ -23,6 +23,7 @@
"account_details_section",
"iban",
"column_break_12",
"branch_code",
"bank_account_no",
"address_and_contact",
"address_html",
@ -197,10 +198,16 @@
"fieldtype": "Data",
"label": "Mask",
"read_only": 1
},
{
"fieldname": "branch_code",
"fieldtype": "Data",
"in_global_search": 1,
"label": "Branch Code"
}
],
"links": [],
"modified": "2020-04-06 21:00:45.379804",
"modified": "2020-07-17 13:59:50.795412",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Bank Account",

View File

@ -4,7 +4,7 @@
cur_frm.add_fetch('bank_account','account','account');
cur_frm.add_fetch('bank_account','bank_account_no','bank_account_no');
cur_frm.add_fetch('bank_account','iban','iban');
cur_frm.add_fetch('bank','branch_code','branch_code');
cur_frm.add_fetch('bank_account','branch_code','branch_code');
cur_frm.add_fetch('bank','swift_number','swift_number');
frappe.ui.form.on('Bank Guarantee', {

View File

@ -73,6 +73,10 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
};
}
});
this.frm.set_value('party_type', '');
this.frm.set_value('party', '');
this.frm.set_value('receivable_payable_account', '');
},
refresh: function() {

View File

@ -48,7 +48,8 @@ class PaymentReconciliation(Document):
select
"Journal Entry" as reference_type, t1.name as reference_name,
t1.posting_date, t1.remark as remarks, t2.name as reference_row,
{dr_or_cr} as amount, t2.is_advance
{dr_or_cr} as amount, t2.is_advance,
t2.account_currency as currency
from
`tabJournal Entry` t1, `tabJournal Entry Account` t2
where
@ -88,7 +89,8 @@ class PaymentReconciliation(Document):
if self.party_type == 'Customer' else "Purchase Invoice")
return frappe.db.sql(""" SELECT `tab{doc}`.name as reference_name, %(voucher_type)s as reference_type,
(sum(`tabGL Entry`.{dr_or_cr}) - sum(`tabGL Entry`.{reconciled_dr_or_cr})) as amount
(sum(`tabGL Entry`.{dr_or_cr}) - sum(`tabGL Entry`.{reconciled_dr_or_cr})) as amount,
account_currency as currency
FROM `tab{doc}`, `tabGL Entry`
WHERE
(`tab{doc}`.name = `tabGL Entry`.against_voucher or `tab{doc}`.name = `tabGL Entry`.voucher_no)
@ -141,6 +143,7 @@ class PaymentReconciliation(Document):
ent.invoice_number = e.get('voucher_no')
ent.invoice_date = e.get('posting_date')
ent.amount = flt(e.get('invoice_amount'))
ent.currency = e.get('currency')
ent.outstanding_amount = e.get('outstanding_amount')
def reconcile(self, args):
@ -269,11 +272,14 @@ def reconcile_dr_cr_note(dr_cr_notes, company):
reconcile_dr_or_cr = ('debit_in_account_currency'
if d.dr_or_cr == 'credit_in_account_currency' else 'credit_in_account_currency')
company_currency = erpnext.get_company_currency(company)
jv = frappe.get_doc({
"doctype": "Journal Entry",
"voucher_type": voucher_type,
"posting_date": today(),
"company": company,
"multi_currency": 1 if d.currency != company_currency else 0,
"accounts": [
{
'account': d.account,

View File

@ -1,183 +1,80 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"actions": [],
"creation": "2014-07-09 16:14:23.672922",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"invoice_type",
"invoice_number",
"invoice_date",
"col_break1",
"amount",
"outstanding_amount",
"currency"
],
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "invoice_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice Type",
"length": 0,
"no_copy": 0,
"options": "Sales Invoice\nPurchase Invoice\nJournal Entry",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
"read_only": 1
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "invoice_number",
"fieldtype": "Dynamic Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice Number",
"length": 0,
"no_copy": 0,
"options": "invoice_type",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
"read_only": 1
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "invoice_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Invoice Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
"read_only": 1
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
"fieldtype": "Column Break"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
"options": "currency",
"read_only": 1
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "outstanding_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Outstanding Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
"options": "currency",
"read_only": 1
},
{
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 1,
"label": "Currency",
"options": "Currency"
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:28:03.588476",
"links": [],
"modified": "2020-07-19 18:12:27.964073",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Invoice",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_seen": 0
"track_changes": 1
}

View File

@ -1,7 +1,9 @@
{
"actions": [],
"creation": "2014-07-09 16:13:35.452759",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"reference_type",
"reference_name",
@ -16,7 +18,8 @@
"difference_account",
"difference_amount",
"sec_break1",
"remark"
"remark",
"currency"
],
"fields": [
{
@ -73,6 +76,7 @@
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"options": "currency",
"read_only": 1
},
{
@ -81,6 +85,7 @@
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Allocated amount",
"options": "currency",
"reqd": 1
},
{
@ -106,16 +111,25 @@
"fieldname": "difference_amount",
"fieldtype": "Currency",
"label": "Difference Amount",
"options": "currency",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "section_break_10",
"fieldtype": "Section Break"
},
{
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 1,
"label": "Currency",
"options": "Currency"
}
],
"istable": 1,
"modified": "2019-06-24 00:08:11.150796",
"links": [],
"modified": "2020-07-19 18:12:41.682347",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Payment",

View File

@ -211,7 +211,7 @@
"label": "IBAN"
},
{
"fetch_from": "bank.branch_code",
"fetch_from": "bank_account.branch_code",
"fetch_if_empty": 1,
"fieldname": "branch_code",
"fieldtype": "Read Only",
@ -352,7 +352,7 @@
"in_create": 1,
"is_submittable": 1,
"links": [],
"modified": "2020-05-29 17:38:49.392713",
"modified": "2020-07-17 14:06:42.185763",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",

View File

@ -795,7 +795,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2020-03-11 12:24:41.749986",
"modified": "2020-07-18 12:24:41.749986",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@ -0,0 +1,21 @@
{
"aggregate_function_based_on": "base_net_total",
"creation": "2020-07-17 11:25:34.748329",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Purchase Invoice",
"filters_json": "[[\"Purchase Invoice\",\"docstatus\",\"=\",\"1\",false],[\"Purchase Invoice\",\"posting_date\",\"Timespan\",\"this year\",false]]",
"function": "Sum",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Incoming Bills",
"modified": "2020-07-22 13:06:46.045344",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Total Incoming Bills",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"aggregate_function_based_on": "base_received_amount",
"creation": "2020-07-17 11:25:34.673195",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Payment Entry",
"filters_json": "[[\"Payment Entry\",\"docstatus\",\"=\",\"1\",false],[\"Payment Entry\",\"posting_date\",\"Timespan\",\"this year\",false],[\"Payment Entry\",\"payment_type\",\"=\",\"Receive\",false]]",
"function": "Sum",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Incoming Payment",
"modified": "2020-07-22 13:06:20.237689",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Total Incoming Payment",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"aggregate_function_based_on": "base_net_total",
"creation": "2020-07-17 11:25:34.725416",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Sales Invoice",
"filters_json": "[[\"Sales Invoice\",\"docstatus\",\"=\",\"1\",false],[\"Sales Invoice\",\"posting_date\",\"Timespan\",\"this year\",false]]",
"function": "Sum",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Outgoing Bills",
"modified": "2020-07-22 13:07:19.633101",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Total Outgoing Bills",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"aggregate_function_based_on": "base_paid_amount",
"creation": "2020-07-17 11:25:34.700137",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Payment Entry",
"filters_json": "[[\"Payment Entry\",\"docstatus\",\"=\",\"1\",false],[\"Payment Entry\",\"posting_date\",\"Timespan\",\"this year\",false],[\"Payment Entry\",\"payment_type\",\"=\",\"Pay\",false]]",
"function": "Sum",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Outgoing Payment",
"modified": "2020-07-22 12:49:34.942896",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Total Outgoing Payment",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@ -676,7 +676,8 @@ def get_outstanding_invoices(party_type, party, account, condition=None, filters
invoice_list = frappe.db.sql("""
select
voucher_no, voucher_type, posting_date, due_date,
ifnull(sum({dr_or_cr}), 0) as invoice_amount
ifnull(sum({dr_or_cr}), 0) as invoice_amount,
account_currency as currency
from
`tabGL Entry`
where
@ -733,7 +734,8 @@ def get_outstanding_invoices(party_type, party, account, condition=None, filters
'invoice_amount': flt(d.invoice_amount),
'payment_amount': payment_amount,
'outstanding_amount': outstanding_amount,
'due_date': d.due_date
'due_date': d.due_date,
'currency': d.currency
})
)

View File

@ -2,7 +2,7 @@
// For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["Requested Items to Order"] = {
frappe.query_reports["Requested Items to Order and Receive"] = {
"filters": [
{
"fieldname": "company",

View File

@ -1,21 +1,21 @@
{
"add_total_row": 1,
"creation": "2020-05-04 20:23:57.750719",
"creation": "2020-07-10 14:28:21.041310",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"modified": "2020-05-05 13:05:51.723951",
"modified": "2020-07-10 14:28:21.041310",
"modified_by": "Administrator",
"module": "Buying",
"name": "Requested Items to Order",
"name": "Requested Items to Order and Receive",
"owner": "Administrator",
"prepared_report": 0,
"query": "",
"ref_doctype": "Material Request",
"report_name": "Requested Items to Order",
"report_name": "Requested Items to Order and Receive",
"report_type": "Script Report",
"roles": [
{

View File

@ -59,8 +59,11 @@ def get_data(filters, conditions):
sum(ifnull(mr_item.stock_qty, 0)) as qty,
ifnull(mr_item.stock_uom, '') as uom,
sum(ifnull(mr_item.ordered_qty, 0)) as ordered_qty,
(sum(mr_item.stock_qty) - sum(ifnull(mr_item.ordered_qty, 0))) as qty_to_order,
sum(ifnull(mr_item.received_qty, 0)) as received_qty,
(sum(ifnull(mr_item.stock_qty, 0)) - sum(ifnull(mr_item.received_qty, 0))) as qty_to_receive,
(sum(ifnull(mr_item.stock_qty, 0)) - sum(ifnull(mr_item.ordered_qty, 0))) as qty_to_order,
mr_item.item_name as item_name,
mr_item.description as "description",
mr.company as company
from
`tabMaterial Request` mr, `tabMaterial Request Item` mr_item
@ -78,7 +81,7 @@ def get_data(filters, conditions):
return data
def update_qty_columns(row_to_update, data_row):
fields = ["qty", "ordered_qty", "qty_to_order"]
fields = ["qty", "ordered_qty", "received_qty", "qty_to_receive", "qty_to_order"]
for field in fields:
row_to_update[field] += flt(data_row[field])
@ -92,7 +95,9 @@ def prepare_data(data, filters):
item_qty_map[row["item_code"]] = {
"qty" : row["qty"],
"ordered_qty" : row["ordered_qty"],
"qty_to_order" : row["qty_to_order"]
"received_qty": row["received_qty"],
"qty_to_receive": row["qty_to_receive"],
"qty_to_order" : row["qty_to_order"],
}
else:
item_entry = item_qty_map[row["item_code"]]
@ -122,7 +127,7 @@ def prepare_data(data, filters):
return data, chart_data
def prepare_chart_data(item_data):
labels, qty_to_order, ordered_qty = [], [], []
labels, qty_to_order, ordered_qty, received_qty, qty_to_receive = [], [], [], [], []
if len(item_data) > 30:
item_data = dict(list(item_data.items())[:30])
@ -132,6 +137,8 @@ def prepare_chart_data(item_data):
labels.append(row)
qty_to_order.append(mr_row["qty_to_order"])
ordered_qty.append(mr_row["ordered_qty"])
received_qty.append(mr_row["received_qty"])
qty_to_receive.append(mr_row["qty_to_receive"])
chart_data = {
"data" : {
@ -144,6 +151,14 @@ def prepare_chart_data(item_data):
{
'name': _('Ordered Qty'),
'values': ordered_qty
},
{
'name': _('Received Qty'),
'values': received_qty
},
{
'name': _('Qty to Receive'),
'values': qty_to_receive
}
]
},
@ -193,7 +208,13 @@ def get_columns(filters):
"width": 100
},
{
"label": _("UOM"),
"label": _("Description"),
"fieldname": "description",
"fieldtype": "Data",
"width": 200
},
{
"label": _("Stock UOM"),
"fieldname": "uom",
"fieldtype": "Data",
"width": 100,
@ -201,7 +222,7 @@ def get_columns(filters):
columns.extend([
{
"label": _("Qty"),
"label": _("Stock Qty"),
"fieldname": "qty",
"fieldtype": "Float",
"width": 120,
@ -214,6 +235,20 @@ def get_columns(filters):
"width": 120,
"convertible": "qty"
},
{
"label": _("Received Qty"),
"fieldname": "received_qty",
"fieldtype": "Float",
"width": 120,
"convertible": "qty"
},
{
"label": _("Qty to Receive"),
"fieldname": "qty_to_receive",
"fieldtype": "Float",
"width": 120,
"convertible": "qty"
},
{
"label": _("Qty to Order"),
"fieldname": "qty_to_order",

View File

@ -1014,6 +1014,7 @@ def get_advance_journal_entries(party_type, party, party_account, amount_field,
def get_advance_payment_entries(party_type, party, party_account, order_doctype,
order_list=None, include_unallocated=True, against_all_orders=False, limit=None):
party_account_field = "paid_from" if party_type == "Customer" else "paid_to"
currency_field = "paid_from_account_currency" if party_type == "Customer" else "paid_to_account_currency"
payment_type = "Receive" if party_type == "Customer" else "Pay"
payment_entries_against_order, unallocated_payment_entries = [], []
limit_cond = "limit %s" % limit if limit else ""
@ -1030,14 +1031,15 @@ def get_advance_payment_entries(party_type, party, party_account, order_doctype,
select
"Payment Entry" as reference_type, t1.name as reference_name,
t1.remarks, t2.allocated_amount as amount, t2.name as reference_row,
t2.reference_name as against_order, t1.posting_date
t2.reference_name as against_order, t1.posting_date,
t1.{0} as currency
from `tabPayment Entry` t1, `tabPayment Entry Reference` t2
where
t1.name = t2.parent and t1.{0} = %s and t1.payment_type = %s
t1.name = t2.parent and t1.{1} = %s and t1.payment_type = %s
and t1.party_type = %s and t1.party = %s and t1.docstatus = 1
and t2.reference_doctype = %s {1}
order by t1.posting_date {2}
""".format(party_account_field, reference_condition, limit_cond),
and t2.reference_doctype = %s {2}
order by t1.posting_date {3}
""".format(currency_field, party_account_field, reference_condition, limit_cond),
[party_account, payment_type, party_type, party,
order_doctype] + order_list, as_dict=1)

View File

@ -0,0 +1,58 @@
{
"cards": [
{
"card": "New Lead (Last 1 Month)"
},
{
"card": "New Opportunity (Last 1 Month)"
},
{
"card": "Won Opportunity (Last 1 Month)"
},
{
"card": "Open Opportunity"
}
],
"charts": [
{
"chart": "Incoming Leads",
"width": "Full"
},
{
"chart": "Opportunity Trends",
"width": "Full"
},
{
"chart": "Won Opportunities",
"width": "Full"
},
{
"chart": "Territory Wise Opportunity Count",
"width": "Half"
},
{
"chart": "Opportunities via Campaigns",
"width": "Half"
},
{
"chart": "Territory Wise Sales",
"width": "Full"
},
{
"chart": "Lead Source",
"width": "Half"
}
],
"creation": "2020-07-20 20:17:15.985657",
"dashboard_name": "CRM",
"docstatus": 0,
"doctype": "Dashboard",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"modified": "2020-07-21 18:56:47.230053",
"modified_by": "Administrator",
"module": "CRM",
"name": "CRM",
"owner": "Administrator"
}

View File

@ -0,0 +1,28 @@
{
"based_on": "creation",
"chart_name": "Incoming Leads",
"chart_type": "Count",
"creation": "2020-07-20 20:17:15.639164",
"custom_options": "{\"type\": \"line\", \"axisOptions\": {\"shortenYAxisNumbers\": 1}, \"tooltipOptions\": {}, \"lineOptions\": {\"regionFill\": 1}}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Lead",
"dynamic_filters_json": "[[\"Lead\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 15:49:19.896501",
"modified": "2020-07-22 16:06:34.941729",
"modified_by": "Administrator",
"module": "CRM",
"name": "Incoming Leads",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Weekly",
"timeseries": 1,
"timespan": "Last Quarter",
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,27 @@
{
"chart_name": "Lead Source",
"chart_type": "Group By",
"creation": "2020-07-20 20:17:15.842106",
"custom_options": "{\"truncateLegends\": 1, \"maxSlices\": 8}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Lead",
"dynamic_filters_json": "[[\"Lead\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[]",
"group_by_based_on": "source",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 16:11:14.170636",
"modified": "2020-07-22 16:13:38.696710",
"modified_by": "Administrator",
"module": "CRM",
"name": "Lead Source",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Donut",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,27 @@
{
"chart_name": "Opportunities via Campaigns",
"chart_type": "Group By",
"creation": "2020-07-20 20:17:15.705402",
"custom_options": "{\"truncateLegends\": 1, \"maxSlices\": 8}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Opportunity",
"dynamic_filters_json": "[[\"Opportunity\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[]",
"group_by_based_on": "campaign",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 15:45:32.572011",
"modified": "2020-07-22 16:10:02.497726",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunities via Campaigns",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Pie",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,28 @@
{
"based_on": "creation",
"chart_name": "Opportunity Trends",
"chart_type": "Count",
"creation": "2020-07-20 20:17:15.672124",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Opportunity",
"dynamic_filters_json": "[[\"Opportunity\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 15:45:32.590967",
"modified": "2020-07-22 16:08:33.100532",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity Trends",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Weekly",
"timeseries": 1,
"timespan": "Last Quarter",
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,27 @@
{
"chart_name": "Territory Wise Opportunity Count",
"chart_type": "Group By",
"creation": "2020-07-20 20:17:15.774176",
"custom_options": "{\"truncateLegends\": 1, \"maxSlices\": 8}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Opportunity",
"dynamic_filters_json": "[[\"Opportunity\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[]",
"group_by_based_on": "territory",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 15:45:32.134026",
"modified": "2020-07-22 16:09:42.921547",
"modified_by": "Administrator",
"module": "CRM",
"name": "Territory Wise Opportunity Count",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Donut",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,28 @@
{
"aggregate_function_based_on": "opportunity_amount",
"chart_name": "Territory Wise Sales",
"chart_type": "Group By",
"creation": "2020-07-20 20:17:15.809008",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Opportunity",
"dynamic_filters_json": "[[\"Opportunity\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Opportunity\",\"status\",\"=\",\"Converted\",false]]",
"group_by_based_on": "territory",
"group_by_type": "Sum",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 15:45:32.501313",
"modified": "2020-07-22 16:10:28.308110",
"modified_by": "Administrator",
"module": "CRM",
"name": "Territory Wise Sales",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,27 @@
{
"based_on": "modified",
"chart_name": "Won Opportunities",
"chart_type": "Count",
"creation": "2020-07-20 20:17:15.738889",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Opportunity",
"dynamic_filters_json": "[[\"Opportunity\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Opportunity\",\"status\",\"=\",\"Converted\",false]]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 15:45:32.575964",
"modified": "2020-07-22 16:09:14.265231",
"modified_by": "Administrator",
"module": "CRM",
"name": "Won Opportunities",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -1,221 +0,0 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe, erpnext, json
from frappe import _
def get_data():
return frappe._dict({
"dashboards": get_dashboards(),
"charts": get_charts(),
"number_cards": get_number_cards()
})
def get_dashboards():
return [{
"doctype": "Dashboard",
"name": "CRM",
"dashboard_name": "CRM",
"charts": [
{ "chart": "Incoming Leads", "width": "Full" },
{ "chart": "Opportunity Trends", "width": "Full"},
{ "chart": "Won Opportunities", "width": "Full" },
{ "chart": "Territory Wise Opportunity Count", "width": "Half"},
{ "chart": "Opportunities via Campaigns", "width": "Half" },
{ "chart": "Territory Wise Sales", "width": "Full"},
{ "chart": "Lead Source", "width": "Half"}
],
"cards": [
{ "card": "New Lead (Last 1 Month)" },
{ "card": "New Opportunity (Last 1 Month)" },
{ "card": "Won Opportunity (Last 1 Month)" },
{ "card": "Open Opportunity"},
]
}]
def get_company_for_dashboards():
company = frappe.defaults.get_defaults().company
if company:
return company
else:
company_list = frappe.get_list("Company")
if company_list:
return company_list[0].name
return None
def get_charts():
company = get_company_for_dashboards()
return [{
"name": "Incoming Leads",
"doctype": "Dashboard Chart",
"time_interval": "Yearly",
"chart_type": "Count",
"chart_name": _("Incoming Leads"),
"timespan": "Last Quarter",
"time_interval": "Weekly",
"document_type": "Lead",
"based_on": "creation",
'is_public': 1,
'timeseries': 1,
"owner": "Administrator",
"filters_json": json.dumps([]),
"type": "Bar"
},
{
"name": "Opportunity Trends",
"doctype": "Dashboard Chart",
"time_interval": "Yearly",
"chart_type": "Count",
"chart_name": _("Opportunity Trends"),
"timespan": "Last Quarter",
"time_interval": "Weekly",
"document_type": "Opportunity",
"based_on": "creation",
'is_public': 1,
'timeseries': 1,
"owner": "Administrator",
"filters_json": json.dumps([["Opportunity", "company", "=", company, False]]),
"type": "Bar"
},
{
"name": "Opportunities via Campaigns",
"chart_name": _("Opportunities via Campaigns"),
"doctype": "Dashboard Chart",
"chart_type": "Group By",
"group_by_type": "Count",
"group_by_based_on": "campaign",
"document_type": "Opportunity",
'is_public': 1,
'timeseries': 1,
"owner": "Administrator",
"filters_json": json.dumps([["Opportunity", "company", "=", company, False]]),
"type": "Pie",
"custom_options": json.dumps({
"truncateLegends": 1,
"maxSlices": 8
})
},
{
"name": "Won Opportunities",
"doctype": "Dashboard Chart",
"time_interval": "Yearly",
"chart_type": "Count",
"chart_name": _("Won Opportunities"),
"timespan": "Last Year",
"time_interval": "Monthly",
"document_type": "Opportunity",
"based_on": "modified",
'is_public': 1,
'timeseries': 1,
"owner": "Administrator",
"filters_json": json.dumps([
["Opportunity", "company", "=", company, False],
["Opportunity", "status", "=", "Converted", False]]),
"type": "Bar"
},
{
"name": "Territory Wise Opportunity Count",
"doctype": "Dashboard Chart",
"chart_type": "Group By",
"group_by_type": "Count",
"group_by_based_on": "territory",
"chart_name": _("Territory Wise Opportunity Count"),
"document_type": "Opportunity",
'is_public': 1,
"filters_json": json.dumps([
["Opportunity", "company", "=", company, False]
]),
"owner": "Administrator",
"type": "Donut",
"custom_options": json.dumps({
"truncateLegends": 1,
"maxSlices": 8
})
},
{
"name": "Territory Wise Sales",
"doctype": "Dashboard Chart",
"chart_type": "Group By",
"group_by_type": "Sum",
"group_by_based_on": "territory",
"chart_name": _("Territory Wise Sales"),
"aggregate_function_based_on": "opportunity_amount",
"document_type": "Opportunity",
'is_public': 1,
"owner": "Administrator",
"filters_json": json.dumps([
["Opportunity", "company", "=", company, False],
["Opportunity", "status", "=", "Converted", False]
]),
"type": "Bar"
},
{
"name": "Lead Source",
"doctype": "Dashboard Chart",
"chart_type": "Group By",
"group_by_type": "Count",
"group_by_based_on": "source",
"chart_name": _("Lead Source"),
"document_type": "Lead",
'is_public': 1,
"owner": "Administrator",
"type": "Pie",
"custom_options": json.dumps({
"truncateLegends": 1,
"maxSlices": 8
})
}]
def get_number_cards():
return [{
"doctype": "Number Card",
"document_type": "Lead",
"name": "New Lead (Last 1 Month)",
"filters_json": json.dumps([
["Lead", "creation", "Timespan", "last month"]
]),
"function": "Count",
"is_public": 1,
"label": _("New Lead (Last 1 Month)"),
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"doctype": "Number Card",
"document_type": "Opportunity",
"name": "New Opportunity (Last 1 Month)",
"filters_json": json.dumps([
["Opportunity", "creation", "Timespan", "last month"]
]),
"function": "Count",
"is_public": 1,
"label": _("New Opportunity (Last 1 Month)"),
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"doctype": "Number Card",
"document_type": "Opportunity",
"name": "Won Opportunity (Last 1 Month)",
"filters_json": json.dumps([
["Opportunity", "status", "=", "Converted",False],
["Opportunity", "creation", "Timespan", "last month"]
]),
"function": "Count",
"is_public": 1,
"label": _("Won Opportunity (Last 1 Month)"),
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"doctype": "Number Card",
"document_type": "Opportunity",
"name": "Open Opportunity",
"filters_json": json.dumps([["Opportunity","status","=","Open",False]]),
"function": "Count",
"is_public": 1,
"label": _("Open Opportunity"),
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
}]

View File

@ -76,6 +76,11 @@ frappe.ui.form.on("Opportunity", {
function() {
frm.trigger("make_supplier_quotation")
}, __('Create'));
frm.add_custom_button(__('Request For Quotation'),
function() {
frm.trigger("make_request_for_quotation")
}, __('Create'));
}
frm.add_custom_button(__('Quotation'),
@ -122,7 +127,14 @@ frappe.ui.form.on("Opportunity", {
make_supplier_quotation: function(frm) {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.opportunity.opportunity.make_supplier_quotation",
frm: cur_frm
frm: frm
})
},
make_request_for_quotation: function(frm) {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.opportunity.opportunity.make_request_for_quotation",
frm: frm
})
},

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-20 20:17:15.870736",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Lead",
"dynamic_filters_json": "[[\"Lead\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Lead\",\"creation\",\"Timespan\",\"last month\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "New Lead (Last 1 Month)",
"modified": "2020-07-22 16:15:17.274972",
"modified_by": "Administrator",
"module": "CRM",
"name": "New Lead (Last 1 Month)",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-20 20:17:15.897112",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Opportunity",
"dynamic_filters_json": "[[\"Opportunity\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Opportunity\",\"creation\",\"Timespan\",\"last month\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "New Opportunity (Last 1 Month)",
"modified": "2020-07-22 16:07:27.910432",
"modified_by": "Administrator",
"module": "CRM",
"name": "New Opportunity (Last 1 Month)",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-20 20:17:15.948113",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Opportunity",
"dynamic_filters_json": "[[\"Opportunity\",\"status\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Opportunity\",\"company\",\"=\",null,false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Open Opportunity",
"modified": "2020-07-22 16:16:16.420446",
"modified_by": "Administrator",
"module": "CRM",
"name": "Open Opportunity",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-20 20:17:15.922486",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Opportunity",
"dynamic_filters_json": "[[\"Opportunity\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Opportunity\",\"creation\",\"Timespan\",\"last month\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Won Opportunity (Last 1 Month)",
"modified": "2020-07-22 16:15:53.088837",
"modified_by": "Administrator",
"module": "CRM",
"name": "Won Opportunity (Last 1 Month)",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily",
"type": "Document Type"
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Clinical Procedures",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.601236",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Clinical Procedure",
"dynamic_filters_json": "[[\"Clinical Procedure\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Clinical Procedure\",\"docstatus\",\"=\",\"1\",false]]",
"group_by_based_on": "procedure_template",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:47.008622",
"modified": "2020-07-22 13:36:48.114479",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedures",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Percentage",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Clinical Procedure Status",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.654325",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Clinical Procedure",
"dynamic_filters_json": "[[\"Clinical Procedure\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Clinical Procedure\",\"docstatus\",\"=\",\"1\",false]]",
"group_by_based_on": "status",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:46.691764",
"modified": "2020-07-22 13:40:17.215775",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedures Status",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Pie",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,25 @@
{
"chart_name": "Department wise Patient Appointments",
"chart_type": "Custom",
"creation": "2020-07-17 11:25:37.190130",
"custom_options": "{\"colors\": [\"#7CD5FA\", \"#5F62F6\", \"#7544E2\", \"#EE5555\"], \"barOptions\": {\"stacked\": 1}, \"height\": 300}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\"}",
"filters_json": "{}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 15:32:05.827566",
"modified": "2020-07-22 15:35:12.798035",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Department wise Patient Appointments",
"number_of_groups": 0,
"owner": "Administrator",
"source": "Department wise Patient Appointments",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,25 @@
{
"chart_name": "Diagnoses",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.705698",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Patient Encounter Diagnosis",
"filters_json": "[]",
"group_by_based_on": "diagnosis",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:47.895521",
"modified": "2020-07-22 13:43:32.369481",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Diagnoses",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Percentage",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "In-Patient Status",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.629199",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Inpatient Record",
"dynamic_filters_json": "[[\"Inpatient Record\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[]",
"group_by_based_on": "status",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:46.792131",
"modified": "2020-07-22 13:33:16.008150",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "In-Patient Status",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Lab Tests",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.574903",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Lab Test",
"dynamic_filters_json": "[[\"Lab Test\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Lab Test\",\"docstatus\",\"=\",\"1\",false]]",
"group_by_based_on": "template",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:47.344055",
"modified": "2020-07-22 13:37:34.490129",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Lab Tests",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Percentage",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,27 @@
{
"based_on": "appointment_datetime",
"chart_name": "Patient Appointments",
"chart_type": "Count",
"creation": "2020-07-14 18:17:54.525082",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Patient Appointment",
"dynamic_filters_json": "[[\"Patient Appointment\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Patient Appointment\",\"status\",\"!=\",\"Cancelled\",false]]",
"idx": 0,
"is_public": 0,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:46.830491",
"modified": "2020-07-22 13:38:02.254190",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Patient Appointments",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Daily",
"timeseries": 1,
"timespan": "Last Month",
"type": "Line",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Symptoms",
"chart_type": "Group By",
"creation": "2020-07-14 18:17:54.680852",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Patient Encounter Symptom",
"dynamic_filters_json": "",
"filters_json": "[]",
"group_by_based_on": "complaint",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-22 13:22:47.296748",
"modified": "2020-07-22 13:40:59.655129",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Symptoms",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
"type": "Percentage",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -1,245 +0,0 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import json
from frappe import _
def get_data():
return frappe._dict({
"dashboards": get_dashboards(),
"charts": get_charts(),
"number_cards": get_number_cards(),
})
def get_company():
company = frappe.defaults.get_defaults().company
if company:
return company
else:
company = frappe.get_list("Company", limit=1)
if company:
return company[0].name
return None
def get_dashboards():
return [{
"name": "Healthcare",
"dashboard_name": "Healthcare",
"charts": [
{ "chart": "Patient Appointments", "width": "Full"},
{ "chart": "In-Patient Status", "width": "Half"},
{ "chart": "Clinical Procedures Status", "width": "Half"},
{ "chart": "Lab Tests", "width": "Half"},
{ "chart": "Clinical Procedures", "width": "Half"},
{ "chart": "Symptoms", "width": "Half"},
{ "chart": "Diagnoses", "width": "Half"},
{ "chart": "Department wise Patient Appointments", "width": "Full"}
],
"cards": [
{ "card": "Total Patients" },
{ "card": "Total Patient Admitted" },
{ "card": "Open Appointments" },
{ "card": "Appointments to Bill" }
]
}]
def get_charts():
company = get_company()
return [
{
"doctype": "Dashboard Chart",
"time_interval": "Daily",
"name": "Patient Appointments",
"chart_name": _("Patient Appointments"),
"timespan": "Last Month",
"filters_json": json.dumps([
["Patient Appointment", "company", "=", company, False],
["Patient Appointment", "status", "!=", "Cancelled"]
]),
"chart_type": "Count",
"timeseries": 1,
"based_on": "appointment_datetime",
"owner": "Administrator",
"document_type": "Patient Appointment",
"type": "Line",
"width": "Half"
},
{
"doctype": "Dashboard Chart",
"name": "Department wise Patient Appointments",
"chart_name": _("Department wise Patient Appointments"),
"chart_type": "Custom",
"source": "Department wise Patient Appointments",
"filters_json": json.dumps([]),
'is_public': 1,
"owner": "Administrator",
"type": "Bar",
"width": "Full",
"custom_options": json.dumps({
"colors": ["#7CD5FA", "#5F62F6", "#7544E2", "#EE5555"],
"barOptions":{
"stacked":1
},
"height": 300
})
},
{
"doctype": "Dashboard Chart",
"name": "Lab Tests",
"chart_name": _("Lab Tests"),
"chart_type": "Group By",
"document_type": "Lab Test",
"group_by_type": "Count",
"group_by_based_on": "template",
"filters_json": json.dumps([
["Lab Test", "company", "=", company, False],
["Lab Test", "docstatus", "=", 1]
]),
'is_public': 1,
"owner": "Administrator",
"type": "Percentage",
"width": "Half",
},
{
"doctype": "Dashboard Chart",
"name": "Clinical Procedures",
"chart_name": _("Clinical Procedures"),
"chart_type": "Group By",
"document_type": "Clinical Procedure",
"group_by_type": "Count",
"group_by_based_on": "procedure_template",
"filters_json": json.dumps([
["Clinical Procedure", "company", "=", company, False],
["Clinical Procedure", "docstatus", "=", 1]
]),
'is_public': 1,
"owner": "Administrator",
"type": "Percentage",
"width": "Half",
},
{
"doctype": "Dashboard Chart",
"name": "In-Patient Status",
"chart_name": _("In-Patient Status"),
"chart_type": "Group By",
"document_type": "Inpatient Record",
"group_by_type": "Count",
"group_by_based_on": "status",
"filters_json": json.dumps([
["Inpatient Record", "company", "=", company, False]
]),
'is_public': 1,
"owner": "Administrator",
"type": "Bar",
"width": "Half",
},
{
"doctype": "Dashboard Chart",
"name": "Clinical Procedures Status",
"chart_name": _("Clinical Procedure Status"),
"chart_type": "Group By",
"document_type": "Clinical Procedure",
"group_by_type": "Count",
"group_by_based_on": "status",
"filters_json": json.dumps([
["Clinical Procedure", "company", "=", company, False],
["Clinical Procedure", "docstatus", "=", 1]
]),
'is_public': 1,
"owner": "Administrator",
"type": "Pie",
"width": "Half",
},
{
"doctype": "Dashboard Chart",
"name": "Symptoms",
"chart_name": _("Symptoms"),
"chart_type": "Group By",
"document_type": "Patient Encounter Symptom",
"group_by_type": "Count",
"group_by_based_on": "complaint",
"filters_json": json.dumps([]),
'is_public': 1,
"owner": "Administrator",
"type": "Percentage",
"width": "Half",
},
{
"doctype": "Dashboard Chart",
"name": "Diagnoses",
"chart_name": _("Diagnoses"),
"chart_type": "Group By",
"document_type": "Patient Encounter Diagnosis",
"group_by_type": "Count",
"group_by_based_on": "diagnosis",
"filters_json": json.dumps([]),
'is_public': 1,
"owner": "Administrator",
"type": "Percentage",
"width": "Half",
}
]
def get_number_cards():
company = get_company()
return [
{
"name": "Total Patients",
"label": _("Total Patients"),
"function": "Count",
"doctype": "Number Card",
"document_type": "Patient",
"filters_json": json.dumps(
[["Patient","status","=","Active",False]]
),
"is_public": 1,
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"name": "Total Patients Admitted",
"label": _("Total Patients Admitted"),
"function": "Count",
"doctype": "Number Card",
"document_type": "Patient",
"filters_json": json.dumps(
[["Patient","inpatient_status","=","Admitted",False]]
),
"is_public": 1,
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"name": "Open Appointments",
"label": _("Open Appointments"),
"function": "Count",
"doctype": "Number Card",
"document_type": "Patient Appointment",
"filters_json": json.dumps(
[["Patient Appointment","company","=",company,False],
["Patient Appointment","status","=","Open",False]]
),
"is_public": 1,
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
},
{
"name": "Appointments to Bill",
"label": _("Appointments To Bill"),
"function": "Count",
"doctype": "Number Card",
"document_type": "Patient Appointment",
"filters_json": json.dumps(
[["Patient Appointment","company","=",company,False],
["Patient Appointment","invoiced","=",0,False]]
),
"is_public": 1,
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
}
]

View File

@ -0,0 +1,62 @@
{
"cards": [
{
"card": "Total Patients"
},
{
"card": "Total Patients Admitted"
},
{
"card": "Open Appointments"
},
{
"card": "Appointments to Bill"
}
],
"charts": [
{
"chart": "Patient Appointments",
"width": "Full"
},
{
"chart": "In-Patient Status",
"width": "Half"
},
{
"chart": "Clinical Procedures Status",
"width": "Half"
},
{
"chart": "Lab Tests",
"width": "Half"
},
{
"chart": "Clinical Procedures",
"width": "Half"
},
{
"chart": "Symptoms",
"width": "Half"
},
{
"chart": "Diagnoses",
"width": "Half"
},
{
"chart": "Department wise Patient Appointments",
"width": "Full"
}
],
"creation": "2020-07-14 18:17:54.823311",
"dashboard_name": "Healthcare",
"docstatus": 0,
"doctype": "Dashboard",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"modified": "2020-07-22 15:36:34.220387",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare",
"owner": "Administrator"
}

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-14 18:17:54.792773",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Patient Appointment",
"dynamic_filters_json": "[[\"Patient Appointment\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Patient Appointment\",\"invoiced\",\"=\",0,false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Appointments To Bill",
"modified": "2020-07-22 13:27:58.038577",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Appointments to Bill",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-14 18:17:54.771092",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Patient Appointment",
"dynamic_filters_json": "[[\"Patient Appointment\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Patient Appointment\",\"status\",\"=\",\"Open\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Open Appointments",
"modified": "2020-07-22 13:27:09.542122",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Open Appointments",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily",
"type": "Document Type"
}

View File

@ -0,0 +1,20 @@
{
"creation": "2020-07-14 18:17:54.727946",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Patient",
"filters_json": "[[\"Patient\",\"status\",\"=\",\"Active\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Patients",
"modified": "2020-07-22 13:26:02.643534",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Total Patients",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily",
"type": "Document Type"
}

View File

@ -0,0 +1,20 @@
{
"creation": "2020-07-14 18:17:54.749754",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Patient",
"filters_json": "[[\"Patient\",\"inpatient_status\",\"=\",\"Admitted\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Patients Admitted",
"modified": "2020-07-22 13:26:20.027788",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Total Patients Admitted",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily",
"type": "Document Type"
}

View File

@ -0,0 +1,28 @@
{
"based_on": "creation",
"chart_name": "Completed Operation",
"chart_type": "Sum",
"creation": "2020-07-08 22:40:22.441658",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Work Order Operation",
"filters_json": "[[\"Work Order Operation\",\"docstatus\",\"=\",1,false]]",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-21 16:57:09.767009",
"modified": "2020-07-21 16:57:55.719802",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Completed Operation",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Quarterly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Line",
"use_report_chart": 0,
"value_based_on": "completed_qty",
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Job Card Analysis",
"chart_type": "Report",
"creation": "2020-07-08 22:40:22.549096",
"custom_options": "{\"barOptions\": {\"stacked\": 1}}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_date\":\"frappe.defaults.get_user_default(\\\"year_start_date\\\")\",\"to_date\":\"frappe.defaults.get_user_default(\\\"year_end_date\\\")\"}",
"filters_json": "{\"docstatus\":1,\"range\":\"Monthly\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-21 17:47:06.537924",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Job Card Analysis",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Job Card Summary",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Last Month Downtime Analysis",
"chart_type": "Report",
"creation": "2020-07-08 22:40:22.516460",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{}",
"filters_json": "{\"from_date\":\"2020-06-21 00:00:00\",\"to_date\":\"2020-07-21 18:46:45\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-21 18:46:50.767333",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Last Month Downtime Analysis",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Downtime Analysis",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Pending Work Order",
"chart_type": "Report",
"creation": "2020-07-08 22:40:22.499217",
"custom_options": "{\"axisOptions\": {\"shortenYAxisNumbers\": 1}, \"height\": 300}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_date\":\"frappe.defaults.get_user_default(\\\"year_start_date\\\")\",\"to_date\":\"frappe.defaults.get_user_default(\\\"year_end_date\\\")\"}",
"filters_json": "{\"charts_based_on\":\"Age\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-21 17:46:42.917598",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Pending Work Order",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Work Order Summary",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Donut",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,30 @@
{
"based_on": "modified",
"chart_name": "Produced Quantity",
"chart_type": "Sum",
"creation": "2020-07-08 22:40:22.416285",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Work Order",
"dynamic_filters_json": "[[\"Work Order\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Work Order\",\"docstatus\",\"=\",\"1\",false]]",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2020-07-21 17:46:34.058882",
"modified": "2020-07-21 17:54:11.233531",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Produced Quantity",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Line",
"use_report_chart": 0,
"value_based_on": "produced_qty",
"y_axis": []
}

View File

@ -0,0 +1,25 @@
{
"chart_name": "Quality Inspection Analysis",
"chart_type": "Report",
"creation": "2020-07-08 22:40:22.483617",
"custom_options": "{\"axisOptions\": {\"shortenYAxisNumbers\": 1}, \"height\": 300}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"filters_json": "{\"from_date\":\"2019-07-09\",\"to_date\":\"2020-07-09\"}",
"idx": 0,
"use_report_chart": 1,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-09 12:15:51.564487",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Quality Inspection Analysis",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Quality Inspection Summary",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Donut",
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Work Order Analysis",
"chart_type": "Report",
"creation": "2020-07-08 22:40:22.465459",
"custom_options": "{\"axisOptions\": {\"shortenYAxisNumbers\": 1}, \"height\": 300}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_date\":\"frappe.defaults.get_user_default(\\\"year_start_date\\\")\",\"to_date\":\"frappe.defaults.get_user_default(\\\"year_end_date\\\")\"}",
"filters_json": "{\"charts_based_on\":\"Status\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-21 17:50:23.806007",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order Analysis",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Work Order Summary",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Donut",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,26 @@
{
"chart_name": "Work Order Qty Analysis",
"chart_type": "Report",
"creation": "2020-07-08 22:40:22.532889",
"custom_options": "{\"barOptions\": {\"stacked\": 1}}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"from_date\":\"frappe.defaults.get_user_default(\\\"year_start_date\\\")\",\"to_date\":\"frappe.defaults.get_user_default(\\\"year_end_date\\\")\"}",
"filters_json": "{\"charts_based_on\":\"Quantity\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-21 17:46:59.020709",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order Qty Analysis",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Work Order Summary",
"time_interval": "Yearly",
"timeseries": 0,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,62 @@
{
"cards": [
{
"card": "Monthly Total Work Order"
},
{
"card": "Monthly Completed Work Order"
},
{
"card": "Ongoing Job Card"
},
{
"card": "Monthly Quality Inspection"
}
],
"charts": [
{
"chart": "Produced Quantity",
"width": "Half"
},
{
"chart": "Completed Operation",
"width": "Half"
},
{
"chart": "Work Order Analysis",
"width": "Half"
},
{
"chart": "Quality Inspection Analysis",
"width": "Half"
},
{
"chart": "Pending Work Order",
"width": "Half"
},
{
"chart": "Last Month Downtime Analysis",
"width": "Half"
},
{
"chart": "Work Order Qty Analysis",
"width": "Full"
},
{
"chart": "Job Card Analysis",
"width": "Full"
}
],
"creation": "2020-07-08 22:40:22.626607",
"dashboard_name": "Manufacturing",
"docstatus": 0,
"doctype": "Dashboard",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"modified": "2020-07-09 12:39:39.455039",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Manufacturing",
"owner": "Administrator"
}

View File

@ -0,0 +1,19 @@
{
"creation": "2020-07-08 22:40:22.575086",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Work Order",
"filters_json": "[[\"Work Order\",\"status\",\"=\",\"Completed\"],[\"Work Order\",\"docstatus\",\"=\",1],[\"Work Order\",\"creation\",\"between\",[\"2020-06-08\",\"2020-07-08\"]]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Monthly Completed Work Orders",
"modified": "2020-07-09 12:22:54.809813",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Monthly Completed Work Order",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Weekly"
}

View File

@ -0,0 +1,19 @@
{
"creation": "2020-07-08 22:40:22.606867",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Quality Inspection",
"filters_json": "[[\"Quality Inspection\",\"docstatus\",\"=\",1],[\"Quality Inspection\",\"creation\",\"between\",[\"2020-06-08\",\"2020-07-08\"]]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Monthly Quality Inspections",
"modified": "2020-07-09 12:23:34.838154",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Monthly Quality Inspection",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Weekly"
}

View File

@ -0,0 +1,19 @@
{
"creation": "2020-07-08 22:40:22.562715",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Work Order",
"filters_json": "[[\"Work Order\",\"docstatus\",\"=\",1],[\"Work Order\",\"creation\",\"between\",[\"2020-06-08\",\"2020-07-08\"]]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Monthly Total Work Orders",
"modified": "2020-07-09 12:22:25.698795",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Monthly Total Work Order",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Weekly"
}

View File

@ -0,0 +1,19 @@
{
"creation": "2020-07-08 22:40:22.592042",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Job Card",
"filters_json": "[[\"Job Card\",\"status\",\"!=\",\"Completed\"],[\"Job Card\",\"docstatus\",\"=\",1]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Ongoing Job Cards",
"modified": "2020-07-09 12:23:18.218233",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Ongoing Job Card",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Weekly"
}

View File

@ -708,4 +708,6 @@ erpnext.patches.v13_0.move_doctype_reports_and_notification_from_hr_to_payroll #
erpnext.patches.v13_0.move_payroll_setting_separately_from_hr_settings #22-06-2020
erpnext.patches.v13_0.check_is_income_tax_component #22-06-2020
erpnext.patches.v12_0.add_taxjar_integration_field
erpnext.patches.v13_0.delete_report_requested_items_to_order
erpnext.patches.v12_0.update_item_tax_template_company
erpnext.patches.v13_0.move_branch_code_to_bank_account

View File

@ -7,8 +7,7 @@ def execute():
if frappe.db.table_exists('Bank') and frappe.db.table_exists('Bank Account') and frappe.db.has_column('Bank Account', 'swift_number'):
frappe.db.sql("""
UPDATE `tabBank` b, `tabBank Account` ba
SET b.swift_number = ba.swift_number, b.branch_code = ba.branch_code
WHERE b.name = ba.bank
SET b.swift_number = ba.swift_number WHERE b.name = ba.bank
""")
frappe.reload_doc('accounts', 'doctype', 'bank_account')

View File

@ -100,6 +100,8 @@ def get_item_tax_template(item_tax_templates, item_tax_map, item_code, parenttyp
tax_type = None
else:
company = get_company(parts[-1], parenttype, parent)
parent_account = frappe.get_value("Account", {"account_name": account_name, "company": company}, "parent_account")
if not parent_account:
parent_account = frappe.db.get_value("Account",
filters={"account_type": "Tax", "root_type": "Liability", "is_group": 0, "company": company}, fieldname="parent_account")
if not parent_account:
@ -115,8 +117,11 @@ def get_item_tax_template(item_tax_templates, item_tax_map, item_code, parenttyp
if not tax_type:
account = frappe.new_doc("Account")
account.update(filters)
try:
account.insert()
tax_type = account.name
except frappe.DuplicateEntryError:
tax_type = frappe.db.get_value("Account", {"account_name": account_name, "company": company}, "name")
account_type = frappe.get_cached_value("Account", tax_type, "account_type")

View File

@ -0,0 +1,12 @@
import frappe
def execute():
""" Check for one or multiple Auto Email Reports and delete """
auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": "Requested Items to Order"}, ["name"])
for auto_email_report in auto_email_reports:
frappe.delete_doc("Auto Email Report", auto_email_report[0])
frappe.db.sql("""
DELETE FROM `tabReport`
WHERE name = 'Requested Items to Order'
""")

View File

@ -0,0 +1,17 @@
# Copyright (c) 2019, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('accounts', 'doctype', 'bank_account')
frappe.reload_doc('accounts', 'doctype', 'bank')
if frappe.db.has_column('Bank', 'branch_code') and frappe.db.has_column('Bank Account', 'branch_code'):
frappe.db.sql("""UPDATE `tabBank` b, `tabBank Account` ba
SET ba.branch_code = b.branch_code
WHERE ba.bank = b.name AND
ifnull(b.branch_code, '') != '' AND ifnull(ba.branch_code, '') = ''""")

View File

@ -88,21 +88,30 @@ def create_customer_or_supplier():
party.flags.ignore_mandatory = True
party.insert(ignore_permissions=True)
alternate_doctype = "Customer" if doctype == "Supplier" else "Supplier"
if party_exists(alternate_doctype, user):
# if user is both customer and supplier, alter fullname to avoid contact name duplication
fullname += "-" + doctype
create_party_contact(doctype, fullname, user, party.name)
return party
def create_party_contact(doctype, fullname, user, party_name):
contact = frappe.new_doc("Contact")
contact.update({
"first_name": fullname,
"email_id": user
})
contact.append('links', dict(link_doctype=doctype, link_name=party.name))
contact.append('links', dict(link_doctype=doctype, link_name=party_name))
contact.append('email_ids', dict(email_id=user))
contact.flags.ignore_mandatory = True
contact.insert(ignore_permissions=True)
return party
def party_exists(doctype, user):
# check if contact exists against party and if it is linked to the doctype
contact_name = frappe.db.get_value("Contact", {"email_id": user})
if contact_name:
contact = frappe.get_doc('Contact', contact_name)
doctypes = [d.link_doctype for d in contact.links]

View File

@ -3,7 +3,7 @@ frappe.provide("erpnext.financial_statements");
erpnext.financial_statements = {
"filters": get_filters(),
"formatter": function(value, row, column, data, default_formatter) {
if (column.fieldname=="account") {
if (data && column.fieldname=="account") {
value = data.account_name || value;
column.link_onclick =
@ -13,7 +13,7 @@ erpnext.financial_statements = {
value = default_formatter(value, row, column, data);
if (!data.parent_account) {
if (data && !data.parent_account) {
value = $(`<span>${value}</span>`);
var $value = $(value).css("font-weight", "bold");

View File

@ -0,0 +1,24 @@
{
"chart_name": "Item-wise Annual Sales",
"chart_type": "Report",
"creation": "2020-07-20 20:17:16.474566",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"to_date\":\"frappe.datetime.nowdate()\"}",
"filters_json": "{\"from_date\":\"2020-06-22\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 14:42:25.512675",
"modified_by": "Administrator",
"module": "Selling",
"name": "Item-wise Annual Sales",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Item-wise Sales History",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,24 @@
{
"chart_name": "Sales Order Analysis",
"chart_type": "Report",
"creation": "2020-07-20 20:17:16.440393",
"custom_options": "{\"type\": \"donut\", \"height\": 300, \"axisOptions\": {\"shortenYAxisNumbers\": 1}}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"to_date\":\"frappe.datetime.nowdate()\"}",
"filters_json": "{\"status\":[\"To Bill\",\"To Deliver\"],\"group_by_so\":0,\"from_date\":\"2020-06-22\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 17:06:05.750660",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Analysis",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Sales Order Analysis",
"timeseries": 0,
"type": "Donut",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,24 @@
{
"chart_name": "Sales Order Trends",
"chart_type": "Report",
"creation": "2020-07-20 20:17:16.508240",
"custom_options": "{\"type\": \"line\", \"axisOptions\": {\"shortenYAxisNumbers\": 1}, \"tooltipOptions\": {}, \"lineOptions\": {\"regionFill\": 1}}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}",
"filters_json": "{\"period\":\"Monthly\",\"based_on\":\"Item\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 16:24:45.726270",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Trends",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Sales Order Trends",
"timeseries": 0,
"type": "Line",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,24 @@
{
"chart_name": "Top Customers",
"chart_type": "Report",
"creation": "2020-07-20 20:17:16.539281",
"custom_options": "",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"fiscal_year\":\"frappe.sys_defaults.fiscal_year\"}",
"filters_json": "{\"period\":\"Yearly\",\"based_on\":\"Customer\"}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 17:03:10.320147",
"modified_by": "Administrator",
"module": "Selling",
"name": "Top Customers",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Delivery Note Trends",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -1,198 +0,0 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import json
from frappe import _
from frappe.utils import nowdate
from erpnext.accounts.utils import get_fiscal_year
def get_data():
return frappe._dict({
"dashboards": get_dashboards(),
"charts": get_charts(),
"number_cards": get_number_cards(),
})
def get_company_for_dashboards():
company = frappe.defaults.get_defaults().company
if company:
return company
else:
company_list = frappe.get_list("Company")
if company_list:
return company_list[0].name
return None
company = frappe.get_doc("Company", get_company_for_dashboards())
fiscal_year = get_fiscal_year(nowdate(), as_dict=1)
fiscal_year_name = fiscal_year.get("name")
start_date = str(fiscal_year.get("year_start_date"))
end_date = str(fiscal_year.get("year_end_date"))
def get_dashboards():
return [{
"name": "Selling",
"dashboard_name": "Selling",
"charts": [
{ "chart": "Sales Order Trends", "width": "Full"},
{ "chart": "Top Customers", "width": "Half"},
{ "chart": "Sales Order Analysis", "width": "Half"},
{ "chart": "Item-wise Annual Sales", "width": "Full"}
],
"cards": [
{ "card": "Annual Sales"},
{ "card": "Sales Orders to Deliver"},
{ "card": "Sales Orders to Bill"},
{ "card": "Active Customers"}
]
}]
def get_charts():
return [
{
"name": "Sales Order Analysis",
"chart_name": _("Sales Order Analysis"),
"chart_type": "Report",
"custom_options": json.dumps({
"type": "donut",
"height": 300,
"axisOptions": {"shortenYAxisNumbers": 1}
}),
"doctype": "Dashboard Chart",
"filters_json": json.dumps({
"company": company.name,
"from_date": start_date,
"to_date": end_date
}),
"is_custom": 1,
"is_public": 1,
"owner": "Administrator",
"report_name": "Sales Order Analysis",
"type": "Donut"
},
{
"name": "Item-wise Annual Sales",
"chart_name": _("Item-wise Annual Sales"),
"chart_type": "Report",
"doctype": "Dashboard Chart",
"filters_json": json.dumps({
"company": company.name,
"from_date": start_date,
"to_date": end_date
}),
"is_custom": 1,
"is_public": 1,
"owner": "Administrator",
"report_name": "Item-wise Sales History",
"type": "Bar"
},
{
"name": "Sales Order Trends",
"chart_name": _("Sales Order Trends"),
"chart_type": "Report",
"custom_options": json.dumps({
"type": "line",
"axisOptions": {"shortenYAxisNumbers": 1},
"tooltipOptions": {},
"lineOptions": {
"regionFill": 1
}
}),
"doctype": "Dashboard Chart",
"filters_json": json.dumps({
"company": company.name,
"period": "Monthly",
"fiscal_year": fiscal_year_name,
"based_on": "Item"
}),
"is_custom": 1,
"is_public": 1,
"owner": "Administrator",
"report_name": "Sales Order Trends",
"type": "Line"
},
{
"name": "Top Customers",
"chart_name": _("Top Customers"),
"chart_type": "Report",
"doctype": "Dashboard Chart",
"filters_json": json.dumps({
"company": company.name,
"period": "Monthly",
"fiscal_year": fiscal_year_name,
"based_on": "Customer"
}),
"is_custom": 1,
"is_public": 1,
"owner": "Administrator",
"report_name": "Delivery Note Trends",
"type": "Bar"
}
]
def get_number_cards():
return [
{
"name": "Annual Sales",
"aggregate_function_based_on": "base_net_total",
"doctype": "Number Card",
"document_type": "Sales Order",
"filters_json": json.dumps([
["Sales Order", "transaction_date", "Between", [start_date, end_date], False],
["Sales Order", "status", "not in", ["Draft", "Cancelled", "Closed", None], False],
["Sales Order", "docstatus", "=", 1, False],
["Sales Order", "company", "=", company.name, False]
]),
"function": "Sum",
"is_public": 1,
"label": _("Annual Sales"),
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly"
},
{
"name": "Sales Orders to Deliver",
"doctype": "Number Card",
"document_type": "Sales Order",
"filters_json": json.dumps([
["Sales Order", "status", "in", ["To Deliver and Bill", "To Deliver", None], False],
["Sales Order", "docstatus", "=", 1, False],
["Sales Order", "company", "=", company.name, False]
]),
"function": "Count",
"is_public": 1,
"label": _("Sales Orders to Deliver"),
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Weekly"
},
{
"name": "Sales Orders to Bill",
"doctype": "Number Card",
"document_type": "Sales Order",
"filters_json": json.dumps([
["Sales Order", "status", "in", ["To Deliver and Bill", "To Bill", None], False],
["Sales Order", "docstatus", "=", 1, False],
["Sales Order", "company", "=", company.name, False]
]),
"function": "Count",
"is_public": 1,
"label": _("Sales Orders to Bill"),
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Weekly"
},
{
"name": "Active Customers",
"doctype": "Number Card",
"document_type": "Customer",
"filters_json": json.dumps([["Customer", "disabled", "=", "0"]]),
"function": "Count",
"is_public": 1,
"label": "Active Customers",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly"
}
]

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-20 20:17:16.653866",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Customer",
"dynamic_filters_json": "",
"filters_json": "[[\"Customer\",\"disabled\",\"=\",\"0\"]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Active Customers",
"modified": "2020-07-22 14:20:32.268103",
"modified_by": "Administrator",
"module": "Selling",
"name": "Active Customers",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@ -0,0 +1,22 @@
{
"aggregate_function_based_on": "base_net_total",
"creation": "2020-07-20 20:17:16.568132",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Sales Order",
"dynamic_filters_json": "[[\"Sales Order\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Sales Order\",\"status\",\"not in\",[\"Draft\",\"Cancelled\",\"Closed\",null],false],[\"Sales Order\",\"docstatus\",\"=\",\"1\",false],[\"Sales Order\",\"modified\",\"Timespan\",\"this year\",false]]",
"function": "Sum",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Annual Sales",
"modified": "2020-07-22 16:56:33.747156",
"modified_by": "Administrator",
"module": "Selling",
"name": "Annual Sales",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-20 20:17:16.625001",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Sales Order",
"dynamic_filters_json": "[[\"Sales Order\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Sales Order\",\"status\",\"in\",[\"To Deliver and Bill\",\"To Bill\",null],false],[\"Sales Order\",\"docstatus\",\"=\",\"1\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Sales Orders to Bill",
"modified": "2020-07-22 14:20:09.918626",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Orders to Bill",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Weekly",
"type": "Document Type"
}

View File

@ -0,0 +1,21 @@
{
"creation": "2020-07-20 20:17:16.596857",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Sales Order",
"dynamic_filters_json": "[[\"Sales Order\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]",
"filters_json": "[[\"Sales Order\",\"status\",\"in\",[\"To Deliver and Bill\",\"To Deliver\",null],false],[\"Sales Order\",\"docstatus\",\"=\",\"1\",false]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Sales Orders to Deliver",
"modified": "2020-07-22 14:19:28.833784",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Orders to Deliver",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Weekly",
"type": "Document Type"
}

View File

@ -191,7 +191,7 @@ def get_conditions(filters):
conditions += "AND so_item.item_code = '%s'" %frappe.db.escape(filters.item_code)
if filters.get("customer"):
conditions += "AND so.customer = '%s'" %frappe.db.escape(filters.customer)
conditions += "AND so.customer = %s" %frappe.db.escape(filters.customer)
return conditions

View File

@ -0,0 +1,46 @@
{
"cards": [
{
"card": "Annual Sales"
},
{
"card": "Sales Orders to Deliver"
},
{
"card": "Sales Orders to Bill"
},
{
"card": "Active Customers"
}
],
"charts": [
{
"chart": "Sales Order Trends",
"width": "Full"
},
{
"chart": "Top Customers",
"width": "Half"
},
{
"chart": "Sales Order Analysis",
"width": "Half"
},
{
"chart": "Item-wise Annual Sales",
"width": "Full"
}
],
"creation": "2020-07-20 20:17:16.688162",
"dashboard_name": "Selling",
"docstatus": 0,
"doctype": "Dashboard",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"modified": "2020-07-22 15:31:22.299903",
"modified_by": "Administrator",
"module": "Selling",
"name": "Selling",
"owner": "Administrator"
}

View File

@ -50,11 +50,12 @@ def get_leaderboards():
return leaderboards
@frappe.whitelist()
def get_all_customers(from_date, company, field, limit = None):
def get_all_customers(date_range, company, field, limit = None):
if field == "outstanding_amount":
filters = [['docstatus', '=', '1'], ['company', '=', company]]
if from_date:
filters.append(['posting_date', '>=', from_date])
if date_range:
date_range = frappe.parse_json(date_range)
filters.append(['posting_date', '>=', 'between', [date_range[0], date_range[1]]])
return frappe.db.get_all('Sales Invoice',
fields = ['customer as name', 'sum(outstanding_amount) as value'],
filters = filters,
@ -68,18 +69,20 @@ def get_all_customers(from_date, company, field, limit = None):
elif field == "total_qty_sold":
select_field = "sum(so_item.stock_qty)"
date_condition = get_date_condition(date_range, 'so.transaction_date')
return frappe.db.sql("""
select so.customer as name, {0} as value
FROM `tabSales Order` as so JOIN `tabSales Order Item` as so_item
ON so.name = so_item.parent
where so.docstatus = 1 and so.transaction_date >= %s and so.company = %s
where so.docstatus = 1 {1} and so.company = %s
group by so.customer
order by value DESC
limit %s
""".format(select_field), (from_date, company, cint(limit)), as_dict=1) #nosec
""".format(select_field, date_condition), (company, cint(limit)), as_dict=1)
@frappe.whitelist()
def get_all_items(from_date, company, field, limit = None):
def get_all_items(date_range, company, field, limit = None):
if field in ("available_stock_qty", "available_stock_value"):
select_field = "sum(actual_qty)" if field=="available_stock_qty" else "sum(stock_value)"
return frappe.db.get_all('Bin',
@ -102,23 +105,25 @@ def get_all_items(from_date, company, field, limit = None):
select_field = "sum(order_item.stock_qty)"
select_doctype = "Purchase Order"
date_condition = get_date_condition(date_range, 'sales_order.transaction_date')
return frappe.db.sql("""
select order_item.item_code as name, {0} as value
from `tab{1}` sales_order join `tab{1} Item` as order_item
on sales_order.name = order_item.parent
where sales_order.docstatus = 1
and sales_order.company = %s and sales_order.transaction_date >= %s
and sales_order.company = %s {2}
group by order_item.item_code
order by value desc
limit %s
""".format(select_field, select_doctype), (company, from_date, cint(limit)), as_dict=1) #nosec
""".format(select_field, select_doctype, date_condition), (company, cint(limit)), as_dict=1) #nosec
@frappe.whitelist()
def get_all_suppliers(from_date, company, field, limit = None):
def get_all_suppliers(date_range, company, field, limit = None):
if field == "outstanding_amount":
filters = [['docstatus', '=', '1'], ['company', '=', company]]
if from_date:
filters.append(['posting_date', '>=', from_date])
if date_range:
filters.append(['posting_date', 'between' [date_range[0], date_range[1]]])
return frappe.db.get_all('Purchase Invoice',
fields = ['supplier as name', 'sum(outstanding_amount) as value'],
filters = filters,
@ -132,18 +137,22 @@ def get_all_suppliers(from_date, company, field, limit = None):
elif field == "total_qty_purchased":
select_field = "sum(purchase_order_item.stock_qty)"
date_condition = get_date_condition(date_range, 'purchase_order.modified')
return frappe.db.sql("""
select purchase_order.supplier as name, {0} as value
FROM `tabPurchase Order` as purchase_order LEFT JOIN `tabPurchase Order Item`
as purchase_order_item ON purchase_order.name = purchase_order_item.parent
where purchase_order.docstatus = 1 and purchase_order.modified >= %s
where
purchase_order.docstatus = 1
{1}
and purchase_order.company = %s
group by purchase_order.supplier
order by value DESC
limit %s""".format(select_field), (from_date, company, cint(limit)), as_dict=1) #nosec
limit %s""".format(select_field, date_condition), (company, cint(limit)), as_dict=1) #nosec
@frappe.whitelist()
def get_all_sales_partner(from_date, company, field, limit = None):
def get_all_sales_partner(date_range, company, field, limit = None):
if field == "total_sales_amount":
select_field = "sum(`base_net_total`)"
elif field == "total_commission":
@ -154,8 +163,9 @@ def get_all_sales_partner(from_date, company, field, limit = None):
'docstatus': 1,
'company': company
}
if from_date:
filters['transaction_date'] = ['>=', from_date]
if date_range:
date_range = frappe.parse_json(date_range)
filters['transaction_date'] = ['between', [date_range[0], date_range[1]]]
return frappe.get_list('Sales Order', fields=[
'`sales_partner` as name',
@ -163,15 +173,27 @@ def get_all_sales_partner(from_date, company, field, limit = None):
], filters=filters, group_by='sales_partner', order_by='value DESC', limit=limit)
@frappe.whitelist()
def get_all_sales_person(from_date, company, field = None, limit = 0):
def get_all_sales_person(date_range, company, field = None, limit = 0):
date_condition = get_date_condition(date_range, 'sales_order.transaction_date')
return frappe.db.sql("""
select sales_team.sales_person as name, sum(sales_order.base_net_total) as value
from `tabSales Order` as sales_order join `tabSales Team` as sales_team
on sales_order.name = sales_team.parent and sales_team.parenttype = 'Sales Order'
where sales_order.docstatus = 1
and sales_order.transaction_date >= %s
and sales_order.company = %s
{date_condition}
group by sales_team.sales_person
order by value DESC
limit %s
""", (from_date, company, cint(limit)), as_dict=1)
""".format(date_condition=date_condition), (company, cint(limit)), as_dict=1)
def get_date_condition(date_range, field):
date_condition = ''
if date_range:
date_range = frappe.parse_json(date_range)
from_date, to_date = date_range
date_condition = "and {0} between {1} and {2}".format(
field, frappe.db.escape(from_date), frappe.db.escape(to_date)
)
return date_condition

View File

@ -0,0 +1,27 @@
{
"based_on": "posting_date",
"chart_name": "Delivery Trends",
"chart_type": "Sum",
"color": "#4d4da8",
"creation": "2020-07-20 21:01:04.255291",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Delivery Note",
"filters_json": "[[\"Delivery Note\",\"docstatus\",\"=\",1]]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 13:03:24.937045",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Trends",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"value_based_on": "base_net_total",
"y_axis": []
}

View File

@ -0,0 +1,23 @@
{
"chart_name": "Item Shortage Summary",
"chart_type": "Report",
"creation": "2020-07-20 21:01:04.383451",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\"}",
"filters_json": "{}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 13:07:01.905334",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Shortage Summary",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Item Shortage Report",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,24 @@
{
"chart_name": "Oldest Items",
"chart_type": "Report",
"creation": "2020-07-20 21:01:04.336845",
"custom_options": "{\"colors\": [\"#5e64ff\"]}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"dynamic_filters_json": "{\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\",\"to_date\":\"frappe.datetime.nowdate()\"}",
"filters_json": "{\"show_warehouse_wise_stock\":0}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 13:04:36.271198",
"modified_by": "Administrator",
"module": "Stock",
"name": "Oldest Items",
"number_of_groups": 0,
"owner": "Administrator",
"report_name": "Stock Ageing",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 1,
"y_axis": []
}

View File

@ -0,0 +1,27 @@
{
"based_on": "posting_date",
"chart_name": "Purchase Receipt Trends",
"chart_type": "Sum",
"color": "#78d6ff",
"creation": "2020-07-20 21:01:04.205230",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Purchase Receipt",
"filters_json": "[[\"Purchase Receipt\",\"docstatus\",\"=\",1]]",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 13:05:25.923130",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Trends",
"number_of_groups": 0,
"owner": "Administrator",
"time_interval": "Monthly",
"timeseries": 1,
"timespan": "Last Year",
"type": "Bar",
"use_report_chart": 0,
"value_based_on": "base_net_total",
"y_axis": []
}

View File

@ -0,0 +1,22 @@
{
"chart_name": "Warehouse wise Stock Value",
"chart_type": "Custom",
"creation": "2020-07-20 21:01:04.296157",
"docstatus": 0,
"doctype": "Dashboard Chart",
"filters_json": "{}",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"modified": "2020-07-22 13:01:01.815123",
"modified_by": "Administrator",
"module": "Stock",
"name": "Warehouse wise Stock Value",
"number_of_groups": 0,
"owner": "Administrator",
"source": "Warehouse wise Stock Value",
"timeseries": 0,
"type": "Bar",
"use_report_chart": 0,
"y_axis": []
}

View File

@ -1,170 +0,0 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import json
from frappe import _
from frappe.utils import nowdate
from erpnext.accounts.dashboard_fixtures import _get_fiscal_year
from erpnext.buying.dashboard_fixtures import get_company_for_dashboards
def get_data():
fiscal_year = _get_fiscal_year(nowdate())
if not fiscal_year:
return frappe._dict()
company = frappe.get_doc("Company", get_company_for_dashboards())
fiscal_year_name = fiscal_year.get("name")
start_date = str(fiscal_year.get("year_start_date"))
end_date = str(fiscal_year.get("year_end_date"))
return frappe._dict({
"dashboards": get_dashboards(),
"charts": get_charts(company, fiscal_year_name, start_date, end_date),
"number_cards": get_number_cards(company, fiscal_year_name, start_date, end_date),
})
def get_dashboards():
return [{
"name": "Stock",
"dashboard_name": "Stock",
"charts": [
{ "chart": "Warehouse wise Stock Value", "width": "Full"},
{ "chart": "Purchase Receipt Trends", "width": "Half"},
{ "chart": "Delivery Trends", "width": "Half"},
{ "chart": "Oldest Items", "width": "Half"},
{ "chart": "Item Shortage Summary", "width": "Half"}
],
"cards": [
{ "card": "Total Active Items"},
{ "card": "Total Warehouses"},
{ "card": "Total Stock Value"}
]
}]
def get_charts(company, fiscal_year_name, start_date, end_date):
return [
{
"doctype": "Dashboard Chart",
"name": "Purchase Receipt Trends",
"time_interval": "Monthly",
"chart_name": _("Purchase Receipt Trends"),
"timespan": "Last Year",
"color": "#7b933d",
"value_based_on": "base_net_total",
"filters_json": json.dumps([["Purchase Receipt", "docstatus", "=", 1]]),
"chart_type": "Sum",
"timeseries": 1,
"based_on": "posting_date",
"owner": "Administrator",
"document_type": "Purchase Receipt",
"type": "Bar",
"width": "Half",
"is_public": 1
},
{
"doctype": "Dashboard Chart",
"name": "Delivery Trends",
"time_interval": "Monthly",
"chart_name": _("Delivery Trends"),
"timespan": "Last Year",
"color": "#7b933d",
"value_based_on": "base_net_total",
"filters_json": json.dumps([["Delivery Note", "docstatus", "=", 1]]),
"chart_type": "Sum",
"timeseries": 1,
"based_on": "posting_date",
"owner": "Administrator",
"document_type": "Delivery Note",
"type": "Bar",
"width": "Half",
"is_public": 1
},
{
"name": "Warehouse wise Stock Value",
"chart_name": _("Warehouse wise Stock Value"),
"chart_type": "Custom",
"doctype": "Dashboard Chart",
"filters_json": json.dumps({}),
"is_custom": 0,
"is_public": 1,
"owner": "Administrator",
"source": "Warehouse wise Stock Value",
"type": "Bar"
},
{
"name": "Oldest Items",
"chart_name": _("Oldest Items"),
"chart_type": "Report",
"custom_options": json.dumps({
"colors": ["#5e64ff"]
}),
"doctype": "Dashboard Chart",
"filters_json": json.dumps({
"company": company.name,
"to_date": nowdate(),
"show_warehouse_wise_stock": 0
}),
"is_custom": 1,
"is_public": 1,
"owner": "Administrator",
"report_name": "Stock Ageing",
"type": "Bar"
},
{
"name": "Item Shortage Summary",
"chart_name": _("Item Shortage Summary"),
"chart_type": "Report",
"doctype": "Dashboard Chart",
"filters_json": json.dumps({
"company": company.name
}),
"is_custom": 1,
"is_public": 1,
"owner": "Administrator",
"report_name": "Item Shortage Report",
"type": "Bar"
}
]
def get_number_cards(company, fiscal_year_name, start_date, end_date):
return [
{
"name": "Total Active Items",
"label": _("Total Active Items"),
"function": "Count",
"doctype": "Number Card",
"document_type": "Item",
"filters_json": json.dumps([["Item", "disabled", "=", 0]]),
"is_public": 1,
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly"
},
{
"name": "Total Warehouses",
"label": _("Total Warehouses"),
"function": "Count",
"doctype": "Number Card",
"document_type": "Warehouse",
"filters_json": json.dumps([["Warehouse", "disabled", "=", 0]]),
"is_public": 1,
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly"
},
{
"name": "Total Stock Value",
"label": _("Total Stock Value"),
"function": "Sum",
"aggregate_function_based_on": "stock_value",
"doctype": "Number Card",
"document_type": "Bin",
"filters_json": json.dumps([]),
"is_public": 1,
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Daily"
}
]

View File

@ -13,7 +13,7 @@ from erpnext.controllers.item_variant import (ItemVariantExistsError,
from erpnext.setup.doctype.item_group.item_group import (get_parent_item_groups, invalidate_cache_for)
from frappe import _, msgprint
from frappe.utils import (cint, cstr, flt, formatdate, get_timestamp, getdate,
now_datetime, random_string, strip)
now_datetime, random_string, strip, get_link_to_form)
from frappe.utils.html_utils import clean_html
from frappe.website.doctype.website_slideshow.website_slideshow import \
get_slideshow
@ -634,6 +634,9 @@ class Item(WebsiteGenerator):
+ ": \n" + ", ".join([self.meta.get_label(fld) for fld in field_list]))
def after_rename(self, old_name, new_name, merge):
if merge:
self.validate_duplicate_item_in_stock_reconciliation(old_name, new_name)
if self.route:
invalidate_cache_for_item(self)
clear_cache(self.route)
@ -656,6 +659,27 @@ class Item(WebsiteGenerator):
frappe.db.set_value(dt, d.name, "item_wise_tax_detail",
json.dumps(item_wise_tax_detail), update_modified=False)
def validate_duplicate_item_in_stock_reconciliation(self, old_name, new_name):
records = frappe.db.sql(""" SELECT parent, COUNT(*) as records
FROM `tabStock Reconciliation Item`
WHERE item_code = %s and docstatus = 1
GROUP By item_code, warehouse, parent
HAVING records > 1
""", new_name, as_dict=1)
if not records: return
document = _("Stock Reconciliation") if len(records) == 1 else _("Stock Reconciliations")
msg = _("The items {0} and {1} are present in the following {2} : <br>"
.format(frappe.bold(old_name), frappe.bold(new_name), document))
msg += ', '.join([get_link_to_form("Stock Reconciliation", d.parent) for d in records]) + "<br><br>"
msg += _("Note: To merge the items, create a separate Stock Reconciliation for the old item {0}"
.format(frappe.bold(old_name)))
frappe.throw(_(msg), title=_("Merge not allowed"))
def set_last_purchase_rate(self, new_name):
last_purchase_rate = get_last_purchase_details(new_name).get("base_net_rate", 0)
frappe.db.set_value("Item", new_name, "last_purchase_rate", last_purchase_rate)

View File

@ -49,17 +49,21 @@ frappe.ui.form.on('Material Request', {
// set schedule_date
set_schedule_date(frm);
let filters = {'company': frm.doc.company}
frm.set_query("warehouse", "items", function() {
frm.set_query("warehouse", "items", function(doc) {
return {
filters: filters
filters: {'company': doc.company}
};
});
frm.set_query("set_warehouse", function(){
frm.set_query("set_warehouse", function(doc){
return {
filters: filters
filters: {'company': doc.company}
};
});
frm.set_query("set_from_warehouse", function(doc){
return {
filters: {'company': doc.company}
};
});
},

View File

@ -1,6 +1,7 @@
{
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:serial_no",
"creation": "2013-05-16 10:59:15",
"description": "Distinct unit of an Item",
@ -426,7 +427,7 @@
"icon": "fa fa-barcode",
"idx": 1,
"links": [],
"modified": "2020-06-25 15:53:50.900855",
"modified": "2020-07-20 20:50:16.660433",
"modified_by": "Administrator",
"module": "Stock",
"name": "Serial No",

View File

@ -190,6 +190,23 @@ class SerialNo(StockController):
if sle_exists:
frappe.throw(_("Cannot delete Serial No {0}, as it is used in stock transactions").format(self.name))
def before_rename(self, old, new, merge=False):
if merge:
frappe.throw(_("Sorry, Serial Nos cannot be merged"))
def after_rename(self, old, new, merge=False):
"""rename serial_no text fields"""
for dt in frappe.db.sql("""select parent from tabDocField
where fieldname='serial_no' and fieldtype in ('Text', 'Small Text', 'Long Text')"""):
for item in frappe.db.sql("""select name, serial_no from `tab%s`
where serial_no like %s""" % (dt[0], frappe.db.escape('%' + old + '%'))):
serial_nos = map(lambda i: new if i.upper()==old.upper() else i, item[1].split('\n'))
frappe.db.sql("""update `tab%s` set serial_no = %s
where name=%s""" % (dt[0], '%s', '%s'),
('\n'.join(list(serial_nos)), item[0]))
def update_serial_no_reference(self, serial_no=None):
last_sle = self.get_last_sle(serial_no)
self.set_purchase_details(last_sle.get("purchase_sle"))

View File

@ -10,12 +10,14 @@
"field_order": [
"warehouse_detail",
"warehouse_name",
"column_break_3",
"warehouse_type",
"parent_warehouse",
"is_group",
"company",
"disabled",
"column_break_4",
"account",
"warehouse_type",
"company",
"disabled",
"address_and_contact",
"address_html",
"column_break_10",
@ -31,7 +33,6 @@
"state",
"pin",
"tree_details",
"parent_warehouse",
"lft",
"rgt",
"old_parent"
@ -91,6 +92,7 @@
"options": "Account"
},
{
"depends_on": "eval:!doc.__islocal",
"fieldname": "address_and_contact",
"fieldtype": "Section Break",
"label": "Address and Contact"
@ -224,13 +226,17 @@
"fieldtype": "Link",
"label": "Warehouse Type",
"options": "Warehouse Type"
},
{
"fieldname": "column_break_3",
"fieldtype": "Section Break"
}
],
"icon": "fa fa-building",
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2020-03-18 18:11:53.282358",
"modified": "2020-07-16 15:43:50.653256",
"modified_by": "Administrator",
"module": "Stock",
"name": "Warehouse",

View File

@ -0,0 +1,20 @@
{
"creation": "2020-07-20 21:01:04.422436",
"docstatus": 0,
"doctype": "Number Card",
"document_type": "Item",
"filters_json": "[[\"Item\",\"disabled\",\"=\",0]]",
"function": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
"label": "Total Active Items",
"modified": "2020-07-22 13:08:30.430677",
"modified_by": "Administrator",
"module": "Stock",
"name": "Total Active Items",
"owner": "Administrator",
"show_percentage_stats": 1,
"stats_time_interval": "Monthly",
"type": "Document Type"
}

Some files were not shown because too many files have changed in this diff Show More