From 8908543a9cfe1cf34d8381a80df2960874fbe969 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 29 May 2015 16:26:07 +0530 Subject: [PATCH 1/4] In standard print format, item name will now honour 'Print Hide' property --- erpnext/accounts/general_ledger.py | 1 - erpnext/accounts/report/gross_profit/gross_profit.py | 2 -- erpnext/config/learn.py | 4 ++-- erpnext/config/stock.py | 2 +- .../print_formats/includes/item_table_description.html | 4 ++-- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index 76b530998d..75dcbbf603 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -101,7 +101,6 @@ def round_off_debit_credit(gl_map): debit_credit_diff += entry.debit - entry.credit debit_credit_diff = flt(debit_credit_diff, precision) - print debit_credit_diff, 1.0 / (10**precision) if abs(debit_credit_diff) >= (2.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)) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 98a121ace7..dd7def8bd6 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -183,8 +183,6 @@ class GrossProfitGenerator(object): my_sle = self.sle.get((item_code, row.warehouse)) for i, sle in enumerate(my_sle): # find the stock valution rate from stock ledger entry - print sle.voucher_type, row.parenttype, sle.voucher_no, row.parent, \ - sle.voucher_detail_no, row.item_row if sle.voucher_type == row.parenttype and row.parent == sle.voucher_no and \ sle.voucher_detail_no == row.item_row: previous_stock_value = len(my_sle) > i+1 and \ diff --git a/erpnext/config/learn.py b/erpnext/config/learn.py index 146bb21b2d..ffcd76ef48 100644 --- a/erpnext/config/learn.py +++ b/erpnext/config/learn.py @@ -31,7 +31,7 @@ def get_data(): { "type": "help", "label": _("Opening Stock Balance"), - "youtube_id": "yPgrtfeCTs" + "youtube_id": "0yPgrtfeCTs" }, { "type": "help", @@ -106,7 +106,7 @@ def get_data(): { "type": "help", "label": _("Opening Stock Balance"), - "youtube_id": "yPgrtfeCTs" + "youtube_id": "0yPgrtfeCTs" }, { "type": "help", diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index 86ec45800c..70bb258af9 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -266,7 +266,7 @@ def get_data(): { "type": "help", "label": _("Opening Stock Balance"), - "youtube_id": "yPgrtfeCTs" + "youtube_id": "0yPgrtfeCTs" }, { "type": "help", diff --git a/erpnext/templates/print_formats/includes/item_table_description.html b/erpnext/templates/print_formats/includes/item_table_description.html index 34f95b9f27..107abe03c0 100644 --- a/erpnext/templates/print_formats/includes/item_table_description.html +++ b/erpnext/templates/print_formats/includes/item_table_description.html @@ -7,8 +7,8 @@ {% if doc.in_format_data("item_code") and not doc.is_print_hide("item_code") -%}
{{ doc.item_code }}
{%- endif %} - {% if (doc.in_format_data("item_name") and - (not doc.in_format_data("item_code") or doc.is_print_hide("item_code") + {% if (doc.in_format_data("item_name") and not doc.is_print_hide("item_name") and + (not doc.in_format_data("item_code") or doc.is_print_hide("item_code") or doc.item_code != doc.item_name)) -%}
{{ doc.get_formatted("item_name") }}
{%- endif %} From 4a6c178795e783066f6730c7791ec54731061acb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 29 May 2015 17:31:31 +0530 Subject: [PATCH 2/4] On selection of item, set default qty as 1 --- erpnext/stock/get_item_details.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 3f73932c5f..399946b812 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -163,8 +163,8 @@ def get_basic_details(args, item): "uom": item.stock_uom, "min_order_qty": flt(item.min_order_qty) if args.parenttype == "Material Request" else "", "conversion_factor": 1.0, - "qty": args.qty or 0.0, - "stock_qty": 0.0, + "qty": args.qty or 1.0, + "stock_qty": 1.0, "price_list_rate": 0.0, "base_price_list_rate": 0.0, "rate": 0.0, From c7ef8dda79c0df5434c5c115d003ead344b1868a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 29 May 2015 17:31:51 +0530 Subject: [PATCH 3/4] [fix] Pricing Rule based on qty --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 0ed4433a1d..70d6fb9c14 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -205,9 +205,9 @@ def get_pricing_rules(args): def filter_pricing_rules(args, pricing_rules): # filter for qty - if pricing_rules and args.get("qty"): - pricing_rules = filter(lambda x: (args.qty>=flt(x.min_qty) - and (args.qty<=x.max_qty if x.max_qty else True)), pricing_rules) + if pricing_rules: + pricing_rules = filter(lambda x: (flt(args.get("qty"))>=flt(x.min_qty) + and (flt(args.get("qty"))<=x.max_qty if x.max_qty else True)), pricing_rules) # find pricing rule with highest priority if pricing_rules: From 3ebfad711572dc629d3f2aed4a4c36c9e7a08181 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Jun 2015 14:01:43 +0530 Subject: [PATCH 4/4] minor fixes --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 3 ++- erpnext/hr/doctype/leave_allocation/leave_allocation.py | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 1e2b352d4e..1f296e5fa7 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -81,7 +81,8 @@ class JournalEntry(AccountsController): frappe.throw(_("Row {0}: Party Type and Party is only applicable against Receivable / Payable account").format(d.idx)) def check_credit_limit(self): - customers = list(set([d.party for d in self.get("accounts") if d.party_type=="Customer" and flt(d.debit) > 0])) + customers = list(set([d.party for d in self.get("accounts") + if d.party_type=="Customer" and d.party and flt(d.debit) > 0])) if customers: from erpnext.selling.doctype.customer.customer import check_credit_limit for customer in customers: diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.py b/erpnext/hr/doctype/leave_allocation/leave_allocation.py index 272ec3996b..4e74b2846d 100755 --- a/erpnext/hr/doctype/leave_allocation/leave_allocation.py +++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.py @@ -23,9 +23,6 @@ class LeaveAllocation(Document): def on_update(self): self.get_total_allocated_leaves() - def on_cancel(self): - self.check_for_leave_application() - def validate_new_leaves_allocated_value(self): """validate that leave allocation is in multiples of 0.5""" if flt(self.new_leaves_allocated) % 0.5: