From 5cf7a0bf721079f12a092b0328524983a177e17e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 26 Nov 2015 15:11:18 +0530 Subject: [PATCH 1/8] [fix] Show Item Name in re-order email. Fixes #4381 --- erpnext/stock/reorder_item.py | 16 +++++------- erpnext/templates/emails/reorder_item.html | 29 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 erpnext/templates/emails/reorder_item.html diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py index a7f4630c2f..9b51bfd131 100644 --- a/erpnext/stock/reorder_item.py +++ b/erpnext/stock/reorder_item.py @@ -3,6 +3,7 @@ import frappe from frappe.utils import flt, cstr, nowdate, add_days, cint +from frappe import _ def reorder_item(): """ Reorder item if stock reaches reorder level""" @@ -162,17 +163,12 @@ def send_email_notification(mr_list): and r.role in ('Purchase Manager','Stock Manager') and p.name not in ('Administrator', 'All', 'Guest')""") - msg="""

Following Material Requests has been raised automatically \ - based on item reorder level:

""" - for mr in mr_list: - msg += "

" + mr.name + """

- """ - for item in mr.get("items"): - msg += "" - msg += "
Item CodeWarehouseQtyUOM
" + item.item_code + "" + item.warehouse + "" + \ - cstr(item.qty) + "" + cstr(item.uom) + "
" + msg = frappe.render_template("templates/emails/reorder_item.html", { + "mr_list": mr_list + }) + frappe.sendmail(recipients=email_list, - subject='Auto Material Request Generation Notification', message = msg) + subject=_('Auto Material Requests Generated'), message = msg) def notify_errors(exceptions_list): subject = "[Important] [ERPNext] Auto Reorder Errors" diff --git a/erpnext/templates/emails/reorder_item.html b/erpnext/templates/emails/reorder_item.html new file mode 100644 index 0000000000..c4039e3ee0 --- /dev/null +++ b/erpnext/templates/emails/reorder_item.html @@ -0,0 +1,29 @@ +

{{ _("Following Material Requests have been raised automatically based on Item's re-order level") + ":" }}

+{% for mr in mr_list -%} +

+

{{ frappe.utils.get_link_to_form("Material Request", mr.name) }}

+ + + + + + + + + + + {% for item in mr.get("items") -%} + + + + + + + {%- endfor %} + +
{{ _("Item") }}{{ _("Warehouse") }}{{ _("Quantity") }}{{ _("UOM") }}
+ {{ item.item_code }} + {% if item.item_code != item.item_name -%}
{{ item.item_name }} {%- endif %} +
{{ item.warehouse }}{{ item.qty }}{{ item.uom }}
+
+{%- endfor %} From f942d97a18f474559d7c772bb6bfbdea849cd217 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 26 Nov 2015 16:07:02 +0530 Subject: [PATCH 2/8] [fix] removed UOM Replace Utility from message --- erpnext/config/stock.py | 5 ----- erpnext/stock/doctype/item/item.py | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index a4a7202008..9b47e580d7 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -77,11 +77,6 @@ def get_data(): "type": "doctype", "name": "Landed Cost Voucher", "description": _("Update additional costs to calculate landed cost of items"), - }, - { - "type": "doctype", - "name": "Stock UOM Replace Utility", - "description": _("Change UOM for an Item."), } ] }, diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 1cbb33d95e..b11603eaa7 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -662,7 +662,5 @@ def check_stock_uom_with_bin(item, stock_uom): frappe.db.sql("""update tabBin set stock_uom=%s where item_code=%s""", (stock_uom, item)) if not matched: - frappe.throw(_("Default Unit of Measure for Item {0} cannot be changed directly because \ - you have already made some transaction(s) with another UOM. To change default UOM, \ - use 'UOM Replace Utility' tool under Stock module.").format(item)) + frappe.throw(_("Default Unit of Measure for Item {0} cannot be changed directly because you have already made some transaction(s) with another UOM. You will need to create a new Item to use a different Default UOM.").format(item)) From 4b12740e8d8ffc4bd90b5b447ea2b87035c482f9 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 26 Nov 2015 18:22:03 +0530 Subject: [PATCH 3/8] [fix] Shipment in portal. Fixes #4291 --- erpnext/hooks.py | 2 +- erpnext/templates/pages/order.html | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index b6b7456df9..8ca6acab50 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -64,7 +64,7 @@ website_route_rules = [ {"from_route": "/shipments", "to_route": "Delivery Note"}, {"from_route": "/shipments/", "to_route": "order", "defaults": { - "doctype": "Delivery Notes", + "doctype": "Delivery Note", "parents": [{"title": _("Shipments"), "name": "shipments"}] } } diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html index 046e6f6f04..45f6af087a 100644 --- a/erpnext/templates/pages/order.html +++ b/erpnext/templates/pages/order.html @@ -46,15 +46,14 @@
{{ d.qty }} - {% if d.delivered_qty != None %} + {% if d.delivered_qty is defined and d.delivered_qty != None %}

{{ _("Delivered: {0}").format(d.delivered_qty) }}

{% endif %}
{{ d.get_formatted("amount") }} - + {# output of get_formatted("rate") is unicode, to replace unicode use _("text {0}").decode("utf8").format(val) #}

{{ _("Rate: {0}").decode("utf8").format(d.get_formatted("rate")) }}

From 2d70887aaf62932726f31bddd18799662e2642d7 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 27 Nov 2015 11:35:35 +0530 Subject: [PATCH 4/8] [enhancement] bulk edit in bank reconciliation, #4356 --- .../bank_reconciliation.js | 37 ++++++++++--------- erpnext/accounts/party.py | 2 +- .../change_log/current/bulk-edit-bank-reco.md | 1 + sponsors.md | 8 ++++ 4 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 erpnext/change_log/current/bulk-edit-bank-reco.md diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js index cd9d9d0f7e..9ffed717ae 100644 --- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js +++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js @@ -2,10 +2,29 @@ // License: GNU General Public License v3. See license.txt frappe.ui.form.on("Bank Reconciliation", { + setup: function(frm) { + frm.get_docfield("journal_entries").allow_bulk_edit = 1; + frm.add_fetch("bank_account", "company", "company"); + }, + + onload: function(frm) { + frm.set_query("bank_account", function() { + return { + "filters": { + "account_type": "Bank", + "is_group": 0 + } + }; + }); + + frm.set_value("from_date", frappe.datetime.month_start()); + frm.set_value("to_date", frappe.datetime.month_end()); + }, + refresh: function(frm) { frm.disable_save(); }, - + update_clearance_date: function(frm) { return frappe.call({ method: "update_details", @@ -22,19 +41,3 @@ frappe.ui.form.on("Bank Reconciliation", { }); } }); - -cur_frm.cscript.onload = function(doc, cdt, cdn) { - cur_frm.add_fetch("bank_account", "company", "company"); - - cur_frm.set_query("bank_account", function() { - return { - "filters": { - "account_type": "Bank", - "is_group": 0 - } - }; - }); - - cur_frm.set_value("from_date", frappe.datetime.month_start()); - cur_frm.set_value("to_date", frappe.datetime.month_end()); -} \ No newline at end of file diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 2f0c0e54b5..d1e2cdcd69 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -35,7 +35,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company= party = out[party_type.lower()] if not ignore_permissions and not frappe.has_permission(party_type, "read", party): - frappe.throw(_("Not permitted"), frappe.PermissionError) + frappe.throw(_("Not permitted for {0}").format(party), frappe.PermissionError) party = frappe.get_doc(party_type, party) diff --git a/erpnext/change_log/current/bulk-edit-bank-reco.md b/erpnext/change_log/current/bulk-edit-bank-reco.md new file mode 100644 index 0000000000..7b10dcf8b8 --- /dev/null +++ b/erpnext/change_log/current/bulk-edit-bank-reco.md @@ -0,0 +1 @@ +- Update Clearance date via Upload and Download like Stock Reconciliation. Sponsored by [AG Techologies, Singapore](http://agtech.com.sg) diff --git a/sponsors.md b/sponsors.md index bfa9e51ae6..125b3588e2 100644 --- a/sponsors.md +++ b/sponsors.md @@ -53,5 +53,13 @@ Leave Allocation based on Arbitrary Dates #1938 + + + AG Technologies, Singapore + + + Bulk edit via export-import in Bank Reconciliation #4356 + + From 70f57eb7f0089f1936d0520e352bb6dd6a617c39 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Nov 2015 14:37:40 +0530 Subject: [PATCH 5/8] [fix] call apply price list, apply pricing rule only if price list is mentioned or there are items in the table --- erpnext/public/js/controllers/transaction.js | 15 ++++++++++++--- erpnext/setup/utils.py | 9 ++++----- erpnext/stock/get_item_details.py | 5 ++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 87cc2f6591..49f47e07cb 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -76,7 +76,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ if(this.frm.doc.__islocal && !(this.frm.doc.taxes || []).length && !(this.frm.doc.__onload ? this.frm.doc.__onload.load_after_mapping : false)) { this.apply_default_taxes(); - } else if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc["items"] + } else if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc["items"] && !this.frm.doc.is_pos) { me.calculate_taxes_and_totals(); } @@ -507,7 +507,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } if(this.frm.fields_dict["advances"]) { - setup_field_label_map(["advance_amount", "allocated_amount"], + setup_field_label_map(["advance_amount", "allocated_amount"], this.frm.doc.party_account_currency, "advances"); } @@ -558,9 +558,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ apply_pricing_rule: function(item, calculate_taxes_and_totals) { var me = this; + var args = this._get_args(item); + if (!(args.item_list && args.item_list.length)) { + if(calculate_taxes_and_totals) me.calculate_taxes_and_totals(); + return; + } + return this.frm.call({ method: "erpnext.accounts.doctype.pricing_rule.pricing_rule.apply_pricing_rule", - args: { args: this._get_args(item) }, + args: { args: args }, callback: function(r) { if (!r.exc && r.message) { me._set_values_for_item_list(r.message); @@ -648,6 +654,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ apply_price_list: function(item) { var me = this; var args = this._get_args(item); + if (!((args.item_list && args.item_list.length) || args.price_list)) { + return; + } return this.frm.call({ method: "erpnext.stock.get_item_details.apply_price_list", diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py index 5b8dd044c8..e44a53fa2d 100644 --- a/erpnext/setup/utils.py +++ b/erpnext/setup/utils.py @@ -72,21 +72,20 @@ def get_exchange_rate(from_currency, to_currency): key = "currency_exchange_rate:{0}:{1}".format(from_currency, to_currency) value = cache.get(key) - print value - if not value: import requests response = requests.get("http://api.fixer.io/latest", params={ "base": from_currency, "symbols": to_currency }) - # expire in 24 hours + # expire in 6 hours response.raise_for_status() value = response.json()["rates"][to_currency] - cache.setex(key, value, 24 * 60 * 60) + cache.setex(key, value, 6 * 60 * 60) + return flt(value) except: - frappe.msgprint(_("Unable to find exchange rate")) + frappe.msgprint(_("Unable to find exchange rate for {0} to {1}").format(from_currency, to_currency)) return 0.0 else: return value diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 6c6f84ba38..71bc64a2c9 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -69,7 +69,7 @@ def get_item_details(args): if args.get("is_subcontracted") == "Yes": out.bom = get_default_bom(args.item_code) - + return out def process_args(args): @@ -427,6 +427,9 @@ def get_price_list_currency(price_list): return result.currency def get_price_list_currency_and_exchange_rate(args): + if not args.price_list: + return {} + price_list_currency = get_price_list_currency(args.price_list) plc_conversion_rate = args.plc_conversion_rate From 9785cd35dc20c7b9ad938d2c9fd92b5b7b565ec1 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 27 Nov 2015 12:23:31 +0530 Subject: [PATCH 6/8] [minor] quote optional in email digest --- erpnext/patches.txt | 1 + .../v6_10/email_digest_default_quote.py | 5 ++ .../doctype/email_digest/email_digest.json | 70 ++++++++++++++++++- .../email_digest/templates/default.html | 2 + 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v6_10/email_digest_default_quote.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 89bf7c4f73..37c69a55a1 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -236,3 +236,4 @@ erpnext.patches.v6_8.make_webform_standard #2015-11-23 erpnext.patches.v6_8.move_drop_ship_to_po_items erpnext.patches.v6_10.fix_ordered_received_billed erpnext.patches.v6_10.fix_jv_total_amount +erpnext.patches.v6_10.email_digest_default_quote diff --git a/erpnext/patches/v6_10/email_digest_default_quote.py b/erpnext/patches/v6_10/email_digest_default_quote.py new file mode 100644 index 0000000000..003b317ad8 --- /dev/null +++ b/erpnext/patches/v6_10/email_digest_default_quote.py @@ -0,0 +1,5 @@ +import frappe + +def execute(): + frappe.reload_doctype("Email Digest") + frappe.db.sql("update `tabEmail Digest` set add_quote = 1") diff --git a/erpnext/setup/doctype/email_digest/email_digest.json b/erpnext/setup/doctype/email_digest/email_digest.json index c47ebae542..21371f153f 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.json +++ b/erpnext/setup/doctype/email_digest/email_digest.json @@ -25,6 +25,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -46,6 +47,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -68,6 +70,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -91,6 +94,7 @@ "options": "Company", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -114,6 +118,7 @@ "options": "Daily\nWeekly\nMonthly", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -137,6 +142,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -158,6 +164,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -181,6 +188,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 1, @@ -203,6 +211,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -225,6 +234,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -247,6 +257,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -270,6 +281,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -293,6 +305,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -316,6 +329,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -338,6 +352,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -361,6 +376,7 @@ "permlevel": 0, "precision": "", "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -384,6 +400,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -407,6 +424,7 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -430,6 +448,55 @@ "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": "other", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Other", + "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, + "ignore_user_permissions": 0, + "in_filter": 0, + "in_list_view": 0, + "label": "Add Quote", + "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, @@ -448,7 +515,8 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-11-16 06:29:46.135437", + "menu_index": 0, + "modified": "2015-11-27 01:48:34.725037", "modified_by": "Administrator", "module": "Setup", "name": "Email Digest", diff --git a/erpnext/setup/doctype/email_digest/templates/default.html b/erpnext/setup/doctype/email_digest/templates/default.html index a931fbb2c0..44c0490eca 100644 --- a/erpnext/setup/doctype/email_digest/templates/default.html +++ b/erpnext/setup/doctype/email_digest/templates/default.html @@ -115,9 +115,11 @@ {% endif %} +{% if add_quote %}
{{ quote.text }}
- {{ quote.author }}
+{% endif %} From a5f0a7ce067afbb24fbcfab44bc93a4776ef902d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Nov 2015 15:08:36 +0530 Subject: [PATCH 7/8] [change-log] --- .../change_log/{current/bulk-edit-bank-reco.md => v6/v6_11_1.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename erpnext/change_log/{current/bulk-edit-bank-reco.md => v6/v6_11_1.md} (100%) diff --git a/erpnext/change_log/current/bulk-edit-bank-reco.md b/erpnext/change_log/v6/v6_11_1.md similarity index 100% rename from erpnext/change_log/current/bulk-edit-bank-reco.md rename to erpnext/change_log/v6/v6_11_1.md From b8591da62cc025eb3afd6e43e621430810773df9 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 27 Nov 2015 15:38:57 +0600 Subject: [PATCH 8/8] bumped to version 6.11.1 --- erpnext/__version__.py | 2 +- erpnext/hooks.py | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/__version__.py b/erpnext/__version__.py index 9c5fffae59..aad7276df4 100644 --- a/erpnext/__version__.py +++ b/erpnext/__version__.py @@ -1,2 +1,2 @@ from __future__ import unicode_literals -__version__ = '6.11.0' +__version__ = '6.11.1' diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 8ca6acab50..d8d2b341a6 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd." app_description = """ERP made simple""" app_icon = "icon-th" app_color = "#e74c3c" -app_version = "6.11.0" +app_version = "6.11.1" app_email = "info@erpnext.com" app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" diff --git a/setup.py b/setup.py index 72b69b6348..a3bf6eaefb 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -version = "6.11.0" +version = "6.11.1" with open("requirements.txt", "r") as f: install_requires = f.readlines()