Merge pull request #6416 from KanchanChauhan/minor-fix
[Fix] filters_by_name changed to query_report_filters_by_name
diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js
index db15eef..bd0b8f2 100644
--- a/erpnext/accounts/doctype/account/account_tree.js
+++ b/erpnext/accounts/doctype/account/account_tree.js
@@ -48,5 +48,5 @@
+ " " + dr_or_cr
+ '</span>').insertBefore(node.$ul);
}
- }
+ },
}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset/asset.py b/erpnext/accounts/doctype/asset/asset.py
index b28aaa9..da73218 100644
--- a/erpnext/accounts/doctype/asset/asset.py
+++ b/erpnext/accounts/doctype/asset/asset.py
@@ -80,7 +80,7 @@
frappe.throw(_("Number of Depreciations Booked cannot be greater than Total Number of Depreciations"))
if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(nowdate()):
- frappe.throw(_("Next Depreciation Date must be on or after today"))
+ frappe.msgprint(_("Next Depreciation Date is entered as past date"))
if (flt(self.value_after_depreciation) > flt(self.expected_value_after_useful_life)
and not self.next_depreciation_date):
diff --git a/erpnext/accounts/doctype/cost_center/cost_center_tree.js b/erpnext/accounts/doctype/cost_center/cost_center_tree.js
index d8d45c5..8c049d0 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center_tree.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center_tree.js
@@ -22,5 +22,5 @@
{fieldtype:'Data', fieldname:'cost_center_name', label:__('New Cost Center Name'), reqd:true},
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
description:__('Further cost centers can be made under Groups but entries can be made against non-Groups')}
- ]
+ ],
}
\ No newline at end of file
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index 15fd299..00c17e8 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -91,6 +91,7 @@
_("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":160",
_("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150",
_("Project") + ":Link/Project:100", _("Cost Center") + ":Link/Cost Center:100",
+ _("Against Voucher Type") + "::120", _("Against Voucher") + ":Dynamic Link/"+_("Against Voucher Type")+":160",
_("Remarks") + "::400"
]
@@ -118,6 +119,7 @@
posting_date, account, party_type, party,
sum(debit) as debit, sum(credit) as credit,
voucher_type, voucher_no, cost_center, project,
+ against_voucher_type, against_voucher,
remarks, against, is_opening {select_fields}
from `tabGL Entry`
where company=%(company)s {conditions}
@@ -290,7 +292,7 @@
row += [d.get("debit_in_account_currency"), d.get("credit_in_account_currency")]
row += [d.get("voucher_type"), d.get("voucher_no"), d.get("against"),
- d.get("party_type"), d.get("party"), d.get("project"), d.get("cost_center"), d.get("remarks")
+ d.get("party_type"), d.get("party"), d.get("project"), d.get("cost_center"), d.get("against_voucher_type"), d.get("against_voucher"), d.get("remarks")
]
result.append(row)
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 9b28cbd..eefdc1d 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -127,6 +127,83 @@
# if bal is None, return 0
return flt(bal)
+def get_count_on(account, fieldname, date):
+
+ cond = []
+ if date:
+ cond.append("posting_date <= '%s'" % frappe.db.escape(cstr(date)))
+ else:
+ # get balance of all entries that exist
+ date = nowdate()
+
+ try:
+ year_start_date = get_fiscal_year(date, verbose=0)[1]
+ except FiscalYearError:
+ if getdate(date) > getdate(nowdate()):
+ # if fiscal year not found and the date is greater than today
+ # get fiscal year for today's date and its corresponding year start date
+ year_start_date = get_fiscal_year(nowdate(), verbose=1)[1]
+ else:
+ # this indicates that it is a date older than any existing fiscal year.
+ # hence, assuming balance as 0.0
+ return 0.0
+
+ if account:
+ acc = frappe.get_doc("Account", account)
+
+ if not frappe.flags.ignore_account_permission:
+ acc.check_permission("read")
+
+ # for pl accounts, get balance within a fiscal year
+ if acc.report_type == 'Profit and Loss':
+ cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \
+ % year_start_date)
+
+ # different filter for group and ledger - improved performance
+ if acc.is_group:
+ cond.append("""exists (
+ select name from `tabAccount` ac where ac.name = gle.account
+ and ac.lft >= %s and ac.rgt <= %s
+ )""" % (acc.lft, acc.rgt))
+
+ # If group and currency same as company,
+ # always return balance based on debit and credit in company currency
+ if acc.account_currency == frappe.db.get_value("Company", acc.company, "default_currency"):
+ in_account_currency = False
+ else:
+ cond.append("""gle.account = "%s" """ % (frappe.db.escape(account, percent=False), ))
+
+ entries = frappe.db.sql("""
+ SELECT name, posting_date, account, party_type, party,debit,credit,
+ voucher_type, voucher_no, against_voucher_type, against_voucher
+ FROM `tabGL Entry` gle
+ WHERE {0}""".format(" and ".join(cond)), as_dict=True)
+
+ count = 0
+ for gle in entries:
+ if fieldname not in ('invoiced_amount','payables'):
+ count += 1
+ else:
+ dr_or_cr = "debit" if fieldname == "invoiced_amount" else "credit"
+ cr_or_dr = "credit" if fieldname == "invoiced_amount" else "debit"
+ select_fields = "ifnull(sum(credit-debit),0)" if fieldname == "invoiced_amount" else "ifnull(sum(debit-credit),0)"
+
+ if ((not gle.against_voucher) or (gle.against_voucher_type in ["Sales Order", "Purchase Order"]) or
+ (gle.against_voucher==gle.voucher_no and gle.get(dr_or_cr) > 0)):
+ payment_amount = frappe.db.sql("""
+ SELECT {0}
+ FROM `tabGL Entry` gle
+ WHERE docstatus < 2 and posting_date <= %(date)s and against_voucher = %(voucher_no)s
+ and party = %(party)s and name != %(name)s""".format(select_fields),
+ {"date": date, "voucher_no": gle.voucher_no, "party": gle.party, "name": gle.name})[0][0]
+
+ outstanding_amount = flt(gle.get(dr_or_cr)) - flt(gle.get(cr_or_dr)) - payment_amount
+ currency_precision = get_currency_precision() or 2
+ if abs(flt(outstanding_amount)) > 0.1/10**currency_precision:
+ count += 1
+
+ return count
+
@frappe.whitelist()
def add_ac(args=None):
if not args:
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index cd13a72..b176e00 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -2,6 +2,19 @@
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Supplier", {
+ setup: function(frm) {
+ frm.set_query('default_price_list', { 'buying': 1});
+ frm.set_query('account', 'accounts', function(doc, cdt, cdn) {
+ var d = locals[cdt][cdn];
+ return {
+ filters: {
+ 'account_type': 'Payable',
+ 'company': d.company,
+ "is_group": 0
+ }
+ }
+ });
+ },
refresh: function(frm) {
if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
frm.toggle_display("naming_series", false);
@@ -16,23 +29,18 @@
else {
unhide_field(['address_html','contact_html']);
erpnext.utils.render_address_and_contact(frm);
+
+ // custom buttons
+ frm.add_custom_button(__('Accounting Ledger'), function() {
+ frappe.set_route('query-report', 'General Ledger',
+ {party_type:'Supplier', party:frm.doc.name});
+ });
+ frm.add_custom_button(__('Accounts Payable'), function() {
+ frappe.set_route('query-report', 'Accounts Payable', {supplier:frm.doc.name});
+ });
+
+ // indicators
+ erpnext.utils.set_party_dashboard_indicators(frm);
}
},
});
-
-cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
- return{
- filters:{'buying': 1}
- }
-}
-
-cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
- var d = locals[cdt][cdn];
- return {
- filters: {
- 'account_type': 'Payable',
- 'company': d.company,
- "is_group": 0
- }
- }
-}
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index a4ee326..3677ee2 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -18,6 +18,26 @@
def onload(self):
"""Load address and contacts in `__onload`"""
load_address_and_contact(self, "supplier")
+ self.load_dashboard_info()
+
+ def load_dashboard_info(self):
+ billing_this_year = frappe.db.sql("""
+ select sum(credit_in_account_currency) - sum(debit_in_account_currency)
+ from `tabGL Entry`
+ where voucher_type='Purchase Invoice' and party_type = 'Supplier'
+ and party=%s and fiscal_year = %s""",
+ (self.name, frappe.db.get_default("fiscal_year")))
+
+ total_unpaid = frappe.db.sql("""select sum(outstanding_amount)
+ from `tabPurchase Invoice`
+ where supplier=%s and docstatus = 1""", self.name)
+
+
+ info = {}
+ info["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
+ info["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
+
+ self.set_onload('dashboard_info', info)
def autoname(self):
supp_master_name = frappe.defaults.get_global_default('supp_master_name')
diff --git a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
index 08d5657..782acfd 100644
--- a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
+++ b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
@@ -1,11 +1,14 @@
from frappe import _
data = {
- 'fieldname': 'prevdoc_docname',
+ 'fieldname': 'opportunity',
+ 'non_standard_fieldnames': {
+ 'Quotation': 'prevdoc_docname'
+ },
'transactions': [
{
'label': _('Related'),
- 'items': ['Quotation']
+ 'items': ['Quotation', 'Supplier Quotation']
},
]
}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.py b/erpnext/hr/doctype/leave_allocation/leave_allocation.py
index 331a82b..86ed187 100755
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.py
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.py
@@ -87,7 +87,10 @@
self.from_date, self.to_date)
if flt(leaves_taken) > flt(self.total_leaves_allocated):
- frappe.throw(_("Total allocated leaves {0} cannot be less than already approved leaves {1} for the period").format(self.total_leaves_allocated, leaves_taken), LessAllocationError)
+ if frappe.db.get_value("Leave Type", self.leave_type, "allow_negative"):
+ frappe.msgprint(_("Note: Total allocated leaves {0} shouldn't be less than already approved leaves {1} for the period").format(self.total_leaves_allocated, leaves_taken), LessAllocationError)
+ else:
+ frappe.throw(_("Total allocated leaves {0} cannot be less than already approved leaves {1} for the period").format(self.total_leaves_allocated, leaves_taken), LessAllocationError)
@frappe.whitelist()
def get_carry_forwarded_leaves(employee, leave_type, date, carry_forward=None):
@@ -113,4 +116,4 @@
def validate_carry_forward(leave_type):
if not frappe.db.get_value("Leave Type", leave_type, "is_carry_forward"):
frappe.throw(_("Leave Type {0} cannot be carry-forwarded").format(leave_type))
-
\ No newline at end of file
+
diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.json b/erpnext/hr/doctype/process_payroll/process_payroll.json
index 7285765..8d8124b 100644
--- a/erpnext/hr/doctype/process_payroll/process_payroll.json
+++ b/erpnext/hr/doctype/process_payroll/process_payroll.json
@@ -333,6 +333,32 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "default": "Today",
+ "fieldname": "posting_date",
+ "fieldtype": "Date",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Posting Date",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
"fieldname": "process_payroll",
"fieldtype": "Section Break",
"hidden": 0,
@@ -560,7 +586,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-06-22 18:14:02.418857",
+ "modified": "2016-09-19 15:12:54.090381",
"modified_by": "Administrator",
"module": "HR",
"name": "Process Payroll",
diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.py b/erpnext/hr/doctype/process_payroll/process_payroll.py
index d17ab4e..3e6e3e0 100644
--- a/erpnext/hr/doctype/process_payroll/process_payroll.py
+++ b/erpnext/hr/doctype/process_payroll/process_payroll.py
@@ -81,6 +81,7 @@
"employee": emp[0],
"month": self.month,
"company": self.company,
+ "posting_date": self.posting_date,
})
ss.insert()
ss_list.append(ss.name)
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.json b/erpnext/hr/doctype/salary_slip/salary_slip.json
index a6f5266..c250cbd 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.json
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.json
@@ -40,6 +40,31 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "fieldname": "posting_date",
+ "fieldtype": "Date",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "posting Date",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
"fieldname": "employee",
"fieldtype": "Link",
"hidden": 0,
@@ -1173,7 +1198,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-08-10 15:57:59.944600",
+ "modified": "2016-09-19 15:15:06.809508",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Slip",
diff --git a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.html b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.html
new file mode 100644
index 0000000..c77e4e5
--- /dev/null
+++ b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.html
@@ -0,0 +1,39 @@
+<div style="margin-bottom: 7px;" class="text-center">
+ {%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")] %}
+</div>
+<h2 class="text-center">{%= __(report.report_name) %}</h2>
+<h5 class="text-center">Fiscal Year: {%= filters.fiscal_year %}</h5>
+<h5 class="text-center">Month: {%= filters.month %}</h5>
+<hr>
+<table class="table table-bordered">
+ <thead>
+ <tr>
+ {% for(var i=1, l=report.columns.length; i<l; i++) { %}
+ <th class="text-right">{%= report.columns[i].label %}</th>
+ {% } %}
+ </tr>
+ </thead>
+ <tbody>
+ {% for(var j=0, k=data.length; j<k; j++) { %}
+ {%
+ var row = data[j];
+ %}
+ <tr>
+ {% for(var i=1, l=report.columns.length; i<l; i++) { %}
+ <td class="text-right">
+ {% var fieldname = report.columns[i].field; %}
+ {% if (i > 10) { %}
+ {%= format_currency(row[fieldname]) %}
+ {% } else { %}
+ {% if (!is_null(row[fieldname])) { %}
+ {%= row[fieldname] %}
+ {% } %}
+ {% } %}
+ </td>
+ {% } %}
+ </tr>
+ {% } %}
+ </tbody>
+</table>
+<p class="text-right text-muted">Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>
+
diff --git a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
index f384917..33f3784 100644
--- a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
+++ b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
@@ -17,7 +17,7 @@
data = []
for ss in salary_slips:
- row = [ss.employee, ss.employee_name, ss.branch, ss.department, ss.designation,
+ row = [ss.name, ss.employee, ss.employee_name, ss.branch, ss.department, ss.designation,
ss.company, ss.month, ss.leave_withut_pay, ss.payment_days]
for e in earning_types:
@@ -36,7 +36,7 @@
def get_columns(salary_slips):
columns = [
- _("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:120",
+ _("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:120",
_("Department") + ":Link/Department:120", _("Designation") + ":Link/Designation:120",
_("Company") + ":Link/Company:120", _("Month") + "::80", _("Leave Without Pay") + ":Float:130",
_("Payment Days") + ":Float:120"
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json
index d1dc0c2..28c1176 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.json
+++ b/erpnext/manufacturing/doctype/production_order/production_order.json
@@ -15,6 +15,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "item",
"fieldtype": "Section Break",
"hidden": 0,
@@ -40,6 +41,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "PRO-",
"fieldname": "naming_series",
"fieldtype": "Select",
@@ -66,6 +68,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Draft",
"depends_on": "eval:!doc.__islocal",
"fieldname": "status",
@@ -80,7 +83,7 @@
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
- "options": "\nDraft\nSubmitted\nNot Started\nStopped\nIn Process\nCompleted\nCancelled",
+ "options": "\nDraft\nSubmitted\nNot Started\nStopped\nUnstopped\nIn Process\nCompleted\nCancelled",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -95,6 +98,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "production_item",
"fieldtype": "Link",
"hidden": 0,
@@ -122,6 +126,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"description": "",
"fieldname": "bom_no",
@@ -151,6 +156,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "1",
"description": "Plan material for sub-assemblies",
"fieldname": "use_multi_level_bom",
@@ -177,6 +183,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -202,6 +209,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "sales_order",
"fieldtype": "Link",
@@ -228,6 +236,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "qty",
"fieldtype": "Float",
@@ -255,6 +264,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "0",
"depends_on": "eval:doc.docstatus==1",
"description": "",
@@ -283,6 +293,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "0",
"depends_on": "eval:doc.docstatus==1",
"description": "",
@@ -312,6 +323,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "warehouses",
"fieldtype": "Section Break",
"hidden": 0,
@@ -337,6 +349,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "Warehouse for reserving items",
"fieldname": "source_warehouse",
"fieldtype": "Link",
@@ -364,6 +377,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "wip_warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -389,6 +403,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_12",
"fieldtype": "Column Break",
"hidden": 0,
@@ -412,6 +427,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"description": "",
"fieldname": "fg_warehouse",
@@ -439,6 +455,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "time",
"fieldtype": "Section Break",
"hidden": 0,
@@ -465,6 +482,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "expected_delivery_date",
"fieldtype": "Date",
@@ -490,6 +508,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "now",
"fieldname": "planned_start_date",
"fieldtype": "Datetime",
@@ -516,6 +535,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "planned_end_date",
"fieldtype": "Datetime",
"hidden": 0,
@@ -541,6 +561,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_13",
"fieldtype": "Column Break",
"hidden": 0,
@@ -565,6 +586,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "actual_start_date",
"fieldtype": "Datetime",
"hidden": 0,
@@ -590,6 +612,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "actual_end_date",
"fieldtype": "Datetime",
"hidden": 0,
@@ -615,6 +638,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "operations_section",
"fieldtype": "Section Break",
@@ -642,6 +666,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "operations",
"fieldtype": "Table",
@@ -669,6 +694,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "operations",
"fieldname": "section_break_22",
"fieldtype": "Section Break",
@@ -696,6 +722,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "planned_operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@@ -722,6 +749,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "actual_operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@@ -748,6 +776,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "additional_operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@@ -774,6 +803,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_24",
"fieldtype": "Column Break",
"hidden": 0,
@@ -798,6 +828,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@@ -824,6 +855,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
@@ -849,6 +881,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "description",
"fieldtype": "Small Text",
"hidden": 0,
@@ -873,6 +906,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "stock_uom",
"fieldtype": "Link",
@@ -901,6 +935,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@@ -928,6 +963,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -952,6 +988,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
@@ -979,6 +1016,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "Manufacture against Material Request",
"fieldname": "material_request",
"fieldtype": "Link",
@@ -1006,6 +1044,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "material_request_item",
"fieldtype": "Data",
"hidden": 1,
@@ -1031,6 +1070,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@@ -1058,6 +1098,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "required_items",
"fieldtype": "Table",
"hidden": 1,
@@ -1092,7 +1133,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-07-08 07:09:06.847763",
+ "modified": "2016-09-19 02:48:09.412858",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order",
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 40441c8..73d1f83 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -328,3 +328,5 @@
erpnext.patches.v7_1.move_sales_invoice_from_parent_to_child_timesheet
execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null")
erpnext.patches.v7_1.update_lead_source
+erpnext.patches.v7_1.fix_link_for_customer_from_lead
+erpnext.patches.v7_0.update_mode_of_payment_type
diff --git a/erpnext/patches/v7_0/update_mode_of_payment_type.py b/erpnext/patches/v7_0/update_mode_of_payment_type.py
new file mode 100644
index 0000000..9292a1b
--- /dev/null
+++ b/erpnext/patches/v7_0/update_mode_of_payment_type.py
@@ -0,0 +1,29 @@
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import flt
+
+def execute():
+ frappe.reload_doc('accounts', 'doctype', 'mode_of_payment')
+
+ frappe.db.sql(""" update `tabMode of Payment` set type = 'Cash' where (type is null or type = '') and name = 'Cash'""")
+
+ for data in frappe.db.sql("""select name from `tabSales Invoice` where is_pos=1 and docstatus<2 and
+ (ifnull(paid_amount, 0) - ifnull(change_amount, 0)) > ifnull(grand_total, 0) and modified > '2016-05-01'""", as_dict=1):
+ if data.name:
+ si_doc = frappe.get_doc("Sales Invoice", data.name)
+ remove_payment = []
+ mode_of_payment = [d.mode_of_payment for d in si_doc.payments if flt(d.amount) > 0]
+ if mode_of_payment != set(mode_of_payment):
+ for payment_data in si_doc.payments:
+ if payment_data.idx != 1 and payment_data.amount == si_doc.grand_total:
+ remove_payment.append(payment_data)
+ frappe.db.sql(""" delete from `tabSales Invoice Payment`
+ where name = %(name)s""", {'name': payment_data.name})
+
+ if len(remove_payment) > 0:
+ for d in remove_payment:
+ si_doc.remove(d)
+
+ si_doc.set_paid_amount()
+ si_doc.db_set("paid_amount", si_doc.paid_amount, update_modified = False)
+ si_doc.db_set("base_paid_amount", si_doc.base_paid_amount, update_modified = False)
\ No newline at end of file
diff --git a/erpnext/patches/v7_1/fix_link_for_customer_from_lead.py b/erpnext/patches/v7_1/fix_link_for_customer_from_lead.py
new file mode 100644
index 0000000..cbb3ea4
--- /dev/null
+++ b/erpnext/patches/v7_1/fix_link_for_customer_from_lead.py
@@ -0,0 +1,6 @@
+import frappe
+
+def execute():
+ for c in frappe.db.sql('select name from tabCustomer where ifnull(lead_name,"")!=""'):
+ customer = frappe.get_doc('Customer', c[0])
+ customer.update_lead_status()
\ No newline at end of file
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 7330889..6c8898d 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -108,6 +108,17 @@
}
},
+ set_party_dashboard_indicators: function(frm) {
+ if(frm.doc.__onload && frm.doc.__onload.dashboard_info) {
+ var info = frm.doc.__onload.dashboard_info;
+ frm.dashboard.add_indicator(__('Annual Billing: {0}',
+ [format_currency(info.billing_this_year, frm.doc.default_currency)]), 'blue');
+ frm.dashboard.add_indicator(__('Total Unpaid: {0}',
+ [format_currency(info.total_unpaid, frm.doc.default_currency)]),
+ info.total_unpaid ? 'orange' : 'green');
+ }
+ },
+
copy_value_in_all_row: function(doc, dt, dn, table_fieldname, fieldname) {
var d = locals[dt][dn];
if(d[fieldname]){
diff --git a/erpnext/schools/doctype/instructor/instructor.json b/erpnext/schools/doctype/instructor/instructor.json
index c6029d1..e461980 100644
--- a/erpnext/schools/doctype/instructor/instructor.json
+++ b/erpnext/schools/doctype/instructor/instructor.json
@@ -1,6 +1,6 @@
{
"allow_copy": 0,
- "allow_import": 0,
+ "allow_import": 1,
"allow_rename": 0,
"autoname": "naming_series:",
"beta": 0,
@@ -15,6 +15,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "instructor_name",
"fieldtype": "Data",
"hidden": 0,
@@ -40,6 +41,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "employee",
"fieldtype": "Link",
"hidden": 0,
@@ -66,6 +68,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_5",
"fieldtype": "Column Break",
"hidden": 0,
@@ -90,6 +93,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@@ -116,6 +120,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "department",
"fieldtype": "Link",
"hidden": 0,
@@ -142,6 +147,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "image",
"fieldtype": "Attach Image",
"hidden": 1,
@@ -176,7 +182,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2016-07-25 01:26:44.111375",
+ "modified": "2016-09-19 03:51:10.877110",
"modified_by": "Administrator",
"module": "Schools",
"name": "Instructor",
@@ -192,7 +198,7 @@
"email": 1,
"export": 1,
"if_owner": 0,
- "import": 0,
+ "import": 1,
"permlevel": 0,
"print": 1,
"read": 1,
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 20ecc7b..ea88e8b 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -2,6 +2,29 @@
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on("Customer", {
+ setup: function(frm) {
+ frm.add_fetch('lead_name', 'company_name', 'customer_name');
+ frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
+
+ frm.set_query('customer_group', {'is_group': 0});
+ frm.set_query('default_price_list', { 'selling': 1});
+ frm.set_query('account', 'accounts', function(doc, cdt, cdn) {
+ var d = locals[cdt][cdn];
+ var filters = {
+ 'account_type': 'Receivable',
+ 'company': d.company,
+ "is_group": 0
+ };
+
+ if(doc.party_account_currency) {
+ $.extend(filters, {"account_currency": doc.party_account_currency});
+ }
+
+ return {
+ filters: filters
+ }
+ });
+ },
refresh: function(frm) {
if(frappe.defaults.get_default("cust_master_name")!="Naming Series") {
frm.toggle_display("naming_series", false);
@@ -13,6 +36,20 @@
if(!frm.doc.__islocal) {
erpnext.utils.render_address_and_contact(frm);
+
+ // custom buttons
+ frm.add_custom_button(__('Accounting Ledger'), function() {
+ frappe.set_route('query-report', 'General Ledger',
+ {party_type:'Customer', party:frm.doc.name});
+ });
+
+ frm.add_custom_button(__('Accounts Receivable'), function() {
+ frappe.set_route('query-report', 'Accounts Receivable', {customer:frm.doc.name});
+ });
+
+ // indicator
+ erpnext.utils.set_party_dashboard_indicators(frm);
+
} else {
erpnext.utils.clear_address_and_contact(frm);
}
@@ -23,55 +60,5 @@
},
validate: function(frm) {
if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
- }
+ },
});
-
-cur_frm.cscript.onload = function(doc, dt, dn) {
- cur_frm.cscript.load_defaults(doc, dt, dn);
-}
-
-cur_frm.cscript.load_defaults = function(doc, dt, dn) {
- doc = locals[doc.doctype][doc.name];
- if(!(doc.__islocal && doc.lead_name)) { return; }
-
- var fields_to_refresh = frappe.model.set_default_values(doc);
- if(fields_to_refresh) { refresh_many(fields_to_refresh); }
-}
-
-cur_frm.add_fetch('lead_name', 'company_name', 'customer_name');
-cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
-
-cur_frm.fields_dict['customer_group'].get_query = function(doc, dt, dn) {
- return{
- filters:{'is_group': 0}
- }
-}
-
-cur_frm.fields_dict.lead_name.get_query = function(doc, cdt, cdn) {
- return{
- query: "erpnext.controllers.queries.lead_query"
- }
-}
-
-cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
- return{
- filters:{'selling': 1}
- }
-}
-
-cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
- var d = locals[cdt][cdn];
- var filters = {
- 'account_type': 'Receivable',
- 'company': d.company,
- "is_group": 0
- };
-
- if(doc.party_account_currency) {
- $.extend(filters, {"account_currency": doc.party_account_currency});
- }
-
- return {
- filters: filters
- }
-}
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index ee3f6e6..82dbba7 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -20,6 +20,26 @@
def onload(self):
"""Load address and contacts in `__onload`"""
load_address_and_contact(self, "customer")
+ self.load_dashboard_info()
+
+ def load_dashboard_info(self):
+ billing_this_year = frappe.db.sql("""
+ select sum(debit_in_account_currency) - sum(credit_in_account_currency)
+ from `tabGL Entry`
+ where voucher_type='Sales Invoice' and party_type = 'Customer'
+ and party=%s and fiscal_year = %s""",
+ (self.name, frappe.db.get_default("fiscal_year")))
+
+ total_unpaid = frappe.db.sql("""select sum(outstanding_amount)
+ from `tabSales Invoice`
+ where customer=%s and docstatus = 1""", self.name)
+
+ info = {}
+ info["billing_this_year"] = billing_this_year[0][0] if billing_this_year else 0
+ info["total_unpaid"] = total_unpaid[0][0] if total_unpaid else 0
+
+ self.set_onload('dashboard_info', info)
+
def autoname(self):
cust_master_name = frappe.defaults.get_global_default('cust_master_name')
@@ -40,14 +60,37 @@
return self.customer_name
+ def after_insert(self):
+ '''If customer created from Lead, update customer id in quotations, opportunities'''
+ self.update_lead_status()
+
def validate(self):
self.flags.is_new_doc = self.is_new()
+ self.flags.old_lead = self.lead_name
validate_party_accounts(self)
self.status = get_party_status(self)
+ def on_update(self):
+ self.validate_name_with_customer_group()
+
+ if self.flags.old_lead != self.lead_name:
+ self.update_lead_status()
+
+ self.update_address()
+ self.update_contact()
+
+ if self.flags.is_new_doc:
+ self.create_lead_address_contact()
+
def update_lead_status(self):
+ '''If Customer created from Lead, update lead status to "Converted"
+ update Customer link in Quotation, Opportunity'''
if self.lead_name:
- frappe.db.sql("update `tabLead` set status='Converted' where name = %s", self.lead_name)
+ frappe.db.set_value('Lead', self.lead_name, 'status', 'Converted', update_modified=False)
+
+ for doctype in ('Opportunity', 'Quotation'):
+ for d in frappe.get_all(doctype, {'lead': self.lead_name}):
+ frappe.db.set_value(doctype, d.name, 'customer', self.name, update_modified=False)
def update_address(self):
frappe.db.sql("""update `tabAddress` set customer_name=%s, modified=NOW()
@@ -78,16 +121,6 @@
if not frappe.db.exists("Contact", c.name):
c.insert()
- def on_update(self):
- self.validate_name_with_customer_group()
-
- self.update_lead_status()
- self.update_address()
- self.update_contact()
-
- if self.flags.is_new_doc:
- self.create_lead_address_contact()
-
def validate_name_with_customer_group(self):
if frappe.db.exists("Customer Group", self.name):
frappe.throw(_("A Customer Group exists with same name please change the Customer name or rename the Customer Group"), frappe.NameError)
diff --git a/erpnext/setup/doctype/email_digest/email_digest.json b/erpnext/setup/doctype/email_digest/email_digest.json
index dfc5edb..00fac42 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.json
+++ b/erpnext/setup/doctype/email_digest/email_digest.json
@@ -264,7 +264,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Income / Expense",
+ "label": "Profit & Loss",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -289,7 +289,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Income",
+ "label": "New Income",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -314,32 +314,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Expense",
- "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
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "description": "",
- "fieldname": "bank_balance",
- "fieldtype": "Check",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "label": "Bank Balance",
+ "label": "New Expenses",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -387,7 +362,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Annual Expense",
+ "label": "Annual Expenses",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -413,7 +388,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Receivables / Payables",
+ "label": "Balance Sheet",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -431,6 +406,56 @@
"bold": 0,
"collapsible": 0,
"description": "",
+ "fieldname": "bank_balance",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Bank Balance",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "credit_balance",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Credit Balance",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "description": "",
"fieldname": "invoiced_amount",
"fieldtype": "Check",
"hidden": 0,
@@ -480,6 +505,280 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "fieldname": "operation",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Operations",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "column_break_21",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "sales_order",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "New Sales Orders",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "pending_sales_orders",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Pending Sales Orders",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "purchase_order",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "New Purchase Orders",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "pending_purchase_orders",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Pending Purchase Orders",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "column_break_operation",
+ "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,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "new_quotations",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "New Quotations",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "pending_quotations",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Pending Quotations",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "issue",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Open Issues",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "project",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Open Projects",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
"fieldname": "other",
"fieldtype": "Section Break",
"hidden": 0,
@@ -505,6 +804,131 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "fieldname": "tools",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Tools",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "calendar_events",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Upcoming Calendar Events",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "todo_list",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Open To Do",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "notifications",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Open Notifications",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "fieldname": "column_break_32",
+ "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,
+ "precision": "",
+ "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
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
"fieldname": "add_quote",
"fieldtype": "Check",
"hidden": 0,
@@ -538,7 +962,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2016-02-22 09:22:28.877187",
+ "modified": "2016-06-23 11:38:50.729998",
"modified_by": "Administrator",
"module": "Setup",
"name": "Email Digest",
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 4f70cd8..7ec04c8 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -10,7 +10,7 @@
from dateutil.relativedelta import relativedelta
from frappe.core.doctype.user.user import STANDARD_USERS
import frappe.desk.notifications
-from erpnext.accounts.utils import get_balance_on
+from erpnext.accounts.utils import get_balance_on, get_count_on, get_currency_precision
user_specific_content = ["calendar_events", "todo_list"]
@@ -77,10 +77,20 @@
self.set_title(context)
self.set_style(context)
self.set_accounting_cards(context)
-
- context.events = self.get_calendar_events()
- context.todo_list = self.get_todo_list()
- context.notifications = self.get_notifications()
+
+ if self.get("calendar_events"):
+ context.events, context.event_count = self.get_calendar_events()
+ if self.get("todo_list"):
+ context.todo_list = self.get_todo_list()
+ context.todo_count = self.get_todo_count()
+ if self.get("notifications"):
+ context.notifications = self.get_notifications()
+ if self.get("issue"):
+ context.issue_list = self.get_issue_list()
+ context.issue_count = self.get_issue_count()
+ if self.get("project"):
+ context.project_list = self.get_project_list()
+ context.project_count = self.get_project_count()
quote = get_random_quote()
context.quote = {"text": quote[0], "author": quote[1]}
@@ -136,14 +146,16 @@
from frappe.desk.doctype.event.event import get_events
events = get_events(self.future_from_date.strftime("%Y-%m-%d"),
self.future_to_date.strftime("%Y-%m-%d")) or []
-
+
+ event_count = 0
for i, e in enumerate(events):
e.starts_on_label = format_time(e.starts_on)
e.ends_on_label = format_time(e.ends_on) if e.ends_on else None
e.date = formatdate(e.starts)
e.link = get_url_to_form("Event", e.name)
+ event_count += 1
- return events
+ return events, event_count
def get_todo_list(self, user_id=None):
"""Get to-do list"""
@@ -159,14 +171,67 @@
t.link = get_url_to_form("ToDo", t.name)
return todo_list
+
+ def get_todo_count(self, user_id=None):
+ """Get count of Todo"""
+ if not user_id:
+ user_id = frappe.session.user
+
+ return frappe.db.sql("""select count(*) from `tabToDo`
+ where status='Open' and (owner=%s or assigned_by=%s)""",
+ (user_id, user_id))[0][0]
+
+ def get_issue_list(self, user_id=None):
+ """Get issue list"""
+ if not user_id:
+ user_id = frappe.session.user
+
+ meta = frappe.get_meta("Issue")
+ role_permissions = frappe.permissions.get_role_permissions(meta, user_id)
+ if not role_permissions.get("read"):
+ return None
+
+ issue_list = frappe.db.sql("""select *
+ from `tabIssue` where status in ("Replied","Open")
+ order by modified asc limit 10""", as_dict=True)
+
+ for t in issue_list:
+ t.link = get_url_to_form("Issue", t.name)
+
+ return issue_list
+
+ def get_issue_count(self):
+ """Get count of Issue"""
+ return frappe.db.sql("""select count(*) from `tabIssue`
+ where status in ('Open','Replied') """)[0][0]
+
+ def get_project_list(self, user_id=None):
+ """Get project list"""
+ if not user_id:
+ user_id = frappe.session.user
+
+ project_list = frappe.db.sql("""select *
+ from `tabProject` where status='Open' and project_type='External'
+ order by modified asc limit 10""", as_dict=True)
+
+ for t in project_list:
+ t.link = get_url_to_form("Issue", t.name)
+
+ return project_list
+
+ def get_project_count(self):
+ """Get count of Project"""
+ return frappe.db.sql("""select count(*) from `tabProject`
+ where status='Open' and project_type='External'""")[0][0]
def set_accounting_cards(self, context):
"""Create accounting cards if checked"""
cache = frappe.cache()
context.cards = []
- for key in ("income", "expenses_booked", "income_year_to_date", "expense_year_to_date",
- "invoiced_amount", "payables", "bank_balance"):
+ for key in ("income", "expenses_booked", "income_year_to_date","expense_year_to_date",
+ "new_quotations","pending_quotations","sales_order","purchase_order","pending_sales_orders","pending_purchase_orders",
+ "invoiced_amount", "payables", "bank_balance", "credit_balance"):
if self.get(key):
cache_key = "email_digest:card:{0}:{1}".format(self.company, key)
card = cache.get(cache_key)
@@ -187,9 +252,25 @@
card.diff = "+" + str(card.diff)
card.gain = True
- card.last_value = self.fmt_money(card.last_value)
+ if key == "credit_balance":
+ card.last_value = card.last_value * -1
+ card.last_value = self.fmt_money(card.last_value,False if key in ("bank_balance", "credit_balance") else True)
- card.value = self.fmt_money(card.value)
+
+ if card.billed_value:
+ card.billed = int(flt(card.billed_value) / card.value * 100)
+ card.billed = "% Billed " + str(card.billed)
+
+ if card.delivered_value:
+ card.delivered = int(flt(card.delivered_value) / card.value * 100)
+ if key == "pending_sales_orders":
+ card.delivered = "% Delivered " + str(card.delivered)
+ else:
+ card.delivered = "% Received " + str(card.delivered)
+
+ if key =="credit_balance":
+ card.value = card.value *-1
+ card.value = self.fmt_money(card.value,False if key in ("bank_balance", "credit_balance") else True)
cache.setex(cache_key, card, 24 * 60 * 60)
@@ -197,37 +278,45 @@
def get_income(self):
"""Get income for given period"""
- income, past_income = self.get_period_amounts(self.get_root_type_accounts("income"))
+ income, past_income, count = self.get_period_amounts(self.get_root_type_accounts("income"),'income')
return {
"label": self.meta.get_label("income"),
"value": income,
- "last_value": past_income
+ "last_value": past_income,
+ "count": count
}
def get_income_year_to_date(self):
"""Get income to date"""
- return self.get_year_to_date_balance("income")
+ return self.get_year_to_date_balance("income", "income")
def get_expense_year_to_date(self):
"""Get income to date"""
- return self.get_year_to_date_balance("expense")
+ return self.get_year_to_date_balance("expense","expenses_booked")
- def get_year_to_date_balance(self, root_type):
+ def get_year_to_date_balance(self, root_type, fieldname):
"""Get income to date"""
balance = 0.0
+ count = 0
for account in self.get_root_type_accounts(root_type):
balance += get_balance_on(account, date = self.future_to_date)
+ count += get_count_on(account, fieldname, date = self.future_to_date)
return {
"label": self.meta.get_label(root_type + "_year_to_date"),
- "value": balance
+ "value": balance,
+ "count": count
}
def get_bank_balance(self):
- # account is of type "Bank" or "Cash"
- return self.get_type_balance('bank_balance', 'Bank')
+ # account is of type "Bank" and root_type is Asset
+ return self.get_type_balance('bank_balance', 'Bank', root_type='Asset')
+
+ def get_credit_balance(self):
+ # account is of type "Bank" and root_type is Liability
+ return self.get_type_balance('credit_balance', 'Bank', root_type='Liability')
def get_payables(self):
return self.get_type_balance('payables', 'Payable')
@@ -236,41 +325,62 @@
return self.get_type_balance('invoiced_amount', 'Receivable')
def get_expenses_booked(self):
- expense, past_expense = self.get_period_amounts(self.get_root_type_accounts("expense"))
+ expense, past_expense, count = self.get_period_amounts(self.get_root_type_accounts("expense"), 'expenses_booked')
return {
"label": self.meta.get_label("expenses_booked"),
"value": expense,
- "last_value": past_expense
+ "last_value": past_expense,
+ "count": count
}
- def get_period_amounts(self, accounts):
+ def get_period_amounts(self, accounts, fieldname):
"""Get amounts for current and past periods"""
balance = past_balance = 0.0
+ count = 0
for account in accounts:
balance += (get_balance_on(account, date = self.future_to_date)
- get_balance_on(account, date = self.future_from_date))
+ count += (get_count_on(account,fieldname, date = self.future_to_date )
+ - get_count_on(account,fieldname, date = self.future_from_date))
+
past_balance += (get_balance_on(account, date = self.past_to_date)
- get_balance_on(account, date = self.past_from_date))
- return balance, past_balance
+ return balance, past_balance, count
- def get_type_balance(self, fieldname, account_type):
- accounts = [d.name for d in \
- frappe.db.get_all("Account", filters={"account_type": account_type,
+ def get_type_balance(self, fieldname, account_type, root_type=None):
+
+ if root_type:
+ accounts = [d.name for d in \
+ frappe.db.get_all("Account", filters={"account_type": account_type,
+ "company": self.company, "is_group": 0, "root_type": root_type})]
+ else:
+ accounts = [d.name for d in \
+ frappe.db.get_all("Account", filters={"account_type": account_type,
"company": self.company, "is_group": 0})]
balance = prev_balance = 0.0
+ count = 0
for account in accounts:
- balance += get_balance_on(account, date=self.future_from_date)
- prev_balance += get_balance_on(account, date=self.past_from_date)
-
- return {
- 'label': self.meta.get_label(fieldname),
- 'value': balance,
- 'last_value': prev_balance
- }
+ balance += get_balance_on(account, date=self.future_to_date)
+ count += get_count_on(account, fieldname, date=self.future_to_date)
+ prev_balance += get_balance_on(account, date=self.past_to_date)
+
+ if fieldname in ("bank_balance","credit_balance"):
+ return {
+ 'label': self.meta.get_label(fieldname),
+ 'value': balance,
+ 'last_value': prev_balance }
+ else:
+ return {
+ 'label': self.meta.get_label(fieldname),
+ 'value': balance,
+ 'last_value': prev_balance,
+ 'count': count
+ }
+
def get_root_type_accounts(self, root_type):
if not root_type in self._accounts:
@@ -279,6 +389,83 @@
"company": self.company, "is_group": 0})]
return self._accounts[root_type]
+ def get_purchase_order(self):
+
+ return self.get_summary_of_doc("Purchase Order","purchase_order")
+
+ def get_sales_order(self):
+
+ return self.get_summary_of_doc("Sales Order","sales_order")
+
+ def get_pending_purchase_orders(self):
+
+ return self.get_summary_of_pending("Purchase Order","pending_purchase_orders","per_received")
+
+ def get_pending_sales_orders(self):
+
+ return self.get_summary_of_pending("Sales Order","pending_sales_orders","per_delivered")
+
+ def get_new_quotations(self):
+
+ return self.get_summary_of_doc("Quotation","new_quotations")
+
+ def get_pending_quotations(self):
+
+ return self.get_summary_of_pending_quotations("pending_quotations")
+
+ def get_summary_of_pending(self, doc_type, fieldname, getfield):
+
+ value, count, billed_value, delivered_value = frappe.db.sql("""select ifnull(sum(grand_total),0), count(*),
+ ifnull(sum(grand_total*per_billed/100),0), ifnull(sum(grand_total*{0}/100),0) from `tab{1}`
+ where (transaction_date <= %(to_date)s)
+ and status not in ('Closed','Cancelled', 'Completed') """.format(getfield, doc_type),
+ {"to_date": self.future_to_date})[0]
+
+ return {
+ "label": self.meta.get_label(fieldname),
+ "value": value,
+ "billed_value": billed_value,
+ "delivered_value": delivered_value,
+ "count": count
+ }
+
+ def get_summary_of_pending_quotations(self, fieldname):
+
+ value, count = frappe.db.sql("""select ifnull(sum(grand_total),0), count(*) from `tabQuotation`
+ where (transaction_date <= %(to_date)s)
+ and status not in ('Ordered','Cancelled', 'Lost') """,{"to_date": self.future_to_date})[0]
+
+ last_value = frappe.db.sql("""select ifnull(sum(grand_total),0) from `tabQuotation`
+ where (transaction_date <= %(to_date)s)
+ and status not in ('Ordered','Cancelled', 'Lost') """,{"to_date": self.past_to_date})[0][0]
+
+ return {
+ "label": self.meta.get_label(fieldname),
+ "value": value,
+ "last_value": last_value,
+ "count": count
+ }
+
+ def get_summary_of_doc(self, doc_type, fieldname):
+
+ value = self.get_total_on(doc_type, self.future_from_date, self.future_to_date)[0]
+ count = self.get_total_on(doc_type, self.future_from_date, self.future_to_date)[1]
+
+ last_value =self.get_total_on(doc_type, self.past_from_date, self.past_to_date)[0]
+
+ return {
+ "label": self.meta.get_label(fieldname),
+ "value": value,
+ "last_value": last_value,
+ "count": count
+ }
+
+ def get_total_on(self, doc_type, from_date, to_date):
+
+ return frappe.db.sql("""select ifnull(sum(grand_total),0), count(*) from `tab{0}`
+ where (transaction_date between %(from_date)s and %(to_date)s) and status not in ('Cancelled')""".format(doc_type),
+ {"from_date": from_date, "to_date": to_date})[0]
+
def get_from_to_date(self):
today = now_datetime().date()
@@ -332,8 +519,11 @@
def onload(self):
self.get_next_sending()
- def fmt_money(self, value):
- return fmt_money(abs(value), currency = self.currency)
+ def fmt_money(self, value,absol=True):
+ if absol:
+ return fmt_money(abs(value), currency = self.currency)
+ else:
+ return fmt_money(value, currency=self.currency)
def send():
now_date = now_datetime().date()
diff --git a/erpnext/setup/doctype/email_digest/templates/default.html b/erpnext/setup/doctype/email_digest/templates/default.html
index 7ed9d1f..0500dc1 100644
--- a/erpnext/setup/doctype/email_digest/templates/default.html
+++ b/erpnext/setup/doctype/email_digest/templates/default.html
@@ -1,10 +1,20 @@
{% macro show_card(card) %}
<div style="width: 50%; float:left; min-height: 80px; padding-top: 20px;">
- <h6 style="color: {{ text_muted }}; font-size: 12px; margin-bottom: 0px; margin-top: 0px;">{{ card.label }}</h6>
+ <h6 style="color: {{ text_muted }}; font-size: 12px; margin-bottom: 0px; margin-top: 0px;">{{ card.label }}
+ {% if card.count %}
+ <span class="badge">({{ card.count }})</span>
+ {% endif %}</h6>
<h4 style="margin-top: 7px; font-size: 16px; margin-botom: 5px;">{{ card.value }}</h4>
{% if card.diff %}
<p style="color: {{ text_muted }}; font-size: 12px; margin-top: 0px;">{{ card.diff }}%</p>
{% endif %}
+ {% if card.billed %}
+ <p style="color: {{ text_muted }}; font-size: 12px; margin-top: 0px;">{{ card.billed }}%</p>
+ {% endif %}
+ {% if card.delivered %}
+ <p style="color: {{ text_muted }}; font-size: 12px; margin-top: 0px;">{{ card.delivered }}%</p>
+ {% endif %}
+
</div>
{% endmacro %}
@@ -31,13 +41,58 @@
<div style="clear: both"></div>
{% endif %}
+<!-- issue list -->
+{% if issue_list %}
+<h4 style="{{ section_head }}">{{ _("Open Issues ") }}<span class="badge">({{ issue_count }})</span></h4>
+<div>
+{% for t in issue_list %}
+ <div style="{{ line_item }}">
+ <table style="width: 100%;">
+ <tr>
+ <td>
+ <a style="{{ link_css }}" href="{{ t.link }}">{{ _(t.subject) }}</a>
+ </td>
+ <td style="width: 25%; text-align: right">
+ <span style="{{ label_css }}">
+ {{ _(t.status) }}
+ </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+{% endfor %}
+</div>
+{% endif %}
+
+<!-- project list -->
+{% if project_list %}
+<h4 style="{{ section_head }}">{{ _("Open Projects ") }}<span class="badge">({{ project_count }})</span></h4>
+<div>
+{% for t in project_list %}
+ <div style="{{ line_item }}">
+ <table style="width: 100%;">
+ <tr>
+ <td>
+ <a style="{{ link_css }}" href="{{ t.link }}">{{ _(t.project_name) }}</a>
+ </td>
+ <td style="width: 25%; text-align: right">
+ <span style="{{ label_css }}">
+ {{ _(t.status) }}
+ </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+{% endfor %}
+</div>
+{% endif %}
{% if events or todo_list or notifications %}
<h1 style="{{ h1 }}">{{ _("Pending Activities") }}</h1>
<!-- events -->
{% if events %}
-<h4 style="{{ section_head }}">{{ _("Upcoming Events") }}</h4>
+<h4 style="{{ section_head }}">{{ _("Upcoming Calendar Events ") }}<span class="badge">({{ event_count }})</span></h4>
<div>
{% for e in events %}
{% if loop.index==1 or events[loop.index-1].date != e.date %}
@@ -69,7 +124,7 @@
<!-- todo list -->
{% if todo_list %}
-<h4 style="{{ section_head }}">{{ _("To Do List") }}</h4>
+<h4 style="{{ section_head }}">{{ _("Open To Do ") }}<span class="badge">({{ todo_count }})</span></h4>
<div>
{% for t in todo_list %}
<div style="{{ line_item }}">
diff --git a/erpnext/setup/doctype/sales_person/sales_person_tree.js b/erpnext/setup/doctype/sales_person/sales_person_tree.js
index 077cf3b..38d4478 100644
--- a/erpnext/setup/doctype/sales_person/sales_person_tree.js
+++ b/erpnext/setup/doctype/sales_person/sales_person_tree.js
@@ -1,6 +1,6 @@
frappe.treeview_settings["Sales Person"] = {
fields: [
- {fieldtype:'Data', fieldname: 'name_field',
+ {fieldtype:'Data', fieldname: 'sales_person_name',
label:__('New Sales Person Name'), reqd:true},
{fieldtype:'Link', fieldname:'employee',
label:__('Employee'), options:'Employee',
diff --git a/erpnext/stock/doctype/material_request/material_request_dashboard.py b/erpnext/stock/doctype/material_request/material_request_dashboard.py
index 8547df1..eab38b2 100644
--- a/erpnext/stock/doctype/material_request/material_request_dashboard.py
+++ b/erpnext/stock/doctype/material_request/material_request_dashboard.py
@@ -7,5 +7,9 @@
'label': _('Related'),
'items': ['Request for Quotation', 'Supplier Quotation', 'Purchase Order']
},
+ {
+ 'label': _('Manufacturing'),
+ 'items': ['Production Order']
+ },
]
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 938e73c..e371d70 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -278,7 +278,7 @@
parent = None
doc.update({
- name_field: frappe.form_dict['name_field'],
+ name_field: frappe.form_dict['warehouse_name'],
parent_field: parent,
"is_group": frappe.form_dict['is_group'],
"company": company
diff --git a/erpnext/stock/doctype/warehouse/warehouse_tree.js b/erpnext/stock/doctype/warehouse/warehouse_tree.js
index 0baed4d..0b8106b 100644
--- a/erpnext/stock/doctype/warehouse/warehouse_tree.js
+++ b/erpnext/stock/doctype/warehouse/warehouse_tree.js
@@ -11,7 +11,7 @@
default: frappe.defaults.get_default('company') ? frappe.defaults.get_default('company'): ""
}],
fields:[
- {fieldtype:'Data', fieldname: 'name_field',
+ {fieldtype:'Data', fieldname: 'warehouse_name',
label:__('New Warehouse Name'), reqd:true},
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
description: __("Child nodes can be only created under 'Group' type nodes")}