From 5ef121bc10ab2445a3c873e1458058a192969e03 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 8 Jun 2015 12:26:52 +0530 Subject: [PATCH 1/3] get party details only if party exists --- erpnext/accounts/party.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 00e595fcb3..08402f3a49 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -16,12 +16,16 @@ def get_party_details(party=None, account=None, party_type="Customer", company=N if not party: return {} + + if not frappe.db.exists(party_type, party): + frappe.throw(_("{0}: {1} does not exists").format(party_type, party)) return _get_party_details(party, account, party_type, company, posting_date, price_list, currency, doctype) def _get_party_details(party=None, account=None, party_type="Customer", company=None, posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False): + out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype)) party = out[party_type.lower()] From b63ad44b10b9d5be7607975d35c3b38643bfdd99 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 8 Jun 2015 14:15:02 +0530 Subject: [PATCH 2/3] Book in round-off account upto max 0.05 --- erpnext/accounts/general_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index d2ea4cd316..8fc785c88b 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -102,7 +102,7 @@ def round_off_debit_credit(gl_map): debit_credit_diff += entry.debit - entry.credit debit_credit_diff = flt(debit_credit_diff, precision) - if abs(debit_credit_diff) >= (2.0 / (10**precision)): + if abs(debit_credit_diff) >= (5.0 / (10**precision)): frappe.throw(_("Debit and Credit not equal for {0} #{1}. Difference is {2}.") .format(gl_map[0].voucher_type, gl_map[0].voucher_no, debit_credit_diff)) From 686ef8308a6b1faa150838a5dd761cbc22e55ab8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 8 Jun 2015 14:22:56 +0530 Subject: [PATCH 3/3] Show item name in item grid view based 'In List View' property --- erpnext/templates/form_grid/includes/visible_cols.html | 2 +- erpnext/templates/form_grid/item_grid.html | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/templates/form_grid/includes/visible_cols.html b/erpnext/templates/form_grid/includes/visible_cols.html index e9be40ceb2..c26f279337 100644 --- a/erpnext/templates/form_grid/includes/visible_cols.html +++ b/erpnext/templates/form_grid/includes/visible_cols.html @@ -1,6 +1,6 @@ {% $.each(visible_columns || [], function(i, df) { %} {% var val = doc.get_formatted(df.fieldname); - if((df.fieldname !== "description") && val) { %} + if((df.fieldname !== "description" && df.fieldname !== "item_name") && val) { %}
{%= __(df.label) %}: diff --git a/erpnext/templates/form_grid/item_grid.html b/erpnext/templates/form_grid/item_grid.html index 8ea3e7d72a..d2db463dcb 100644 --- a/erpnext/templates/form_grid/item_grid.html +++ b/erpnext/templates/form_grid/item_grid.html @@ -1,4 +1,4 @@ -{% var visible_columns = row.get_visible_columns(["item_code", "item_name", "qty", "rate", "amount", "stock_uom", "uom", "discount_percentage", "schedule_date", "warehouse", "against_sales_order", "sales_order"]); %} +{% var visible_columns = row.get_visible_columns(["item_code", "qty", "rate", "amount", "stock_uom", "uom", "discount_percentage", "schedule_date", "warehouse", "against_sales_order", "sales_order"]); %} {% if(!doc) { %}
@@ -8,6 +8,7 @@
{%= __("Amount") %}
{% } else { %} + {% var visible_column_fieldnames = $.map(visible_columns, function(x, i) {return x.fieldname}); %}
{% if(doc.warehouse) { @@ -45,11 +46,11 @@ {%= doc.item_code %} {% } %} - {% if(doc.item_name != doc.item_code) { %} + {% if(doc.item_name != doc.item_code && in_list(visible_column_fieldnames, "item_name")) { %}
{%= doc.item_name %}{% } %} {% if((doc.description != doc.item_code != doc.item_name) && - in_list($.map(visible_columns, function(x, i) {return x.fieldname}), "description")) { %} + in_list(visible_column_fieldnames, "description")) { %}
Description: {%= doc.get_formatted("description") %}{% } %}