Merge pull request #2122 from neilLasrado/print-templates-fix
[Cosmetics] Print Templates Layout Improved
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 3e3a249..d744fee 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -78,3 +78,4 @@
erpnext.patches.v4_2.add_currency_turkish_lira #2014-08-08
execute:frappe.delete_doc("DocType", "Landed Cost Wizard")
erpnext.patches.v4_2.default_website_style
+erpnext.patches.v4_2.set_company_country
diff --git a/erpnext/patches/v4_2/set_company_country.py b/erpnext/patches/v4_2/set_company_country.py
new file mode 100644
index 0000000..6992f02
--- /dev/null
+++ b/erpnext/patches/v4_2/set_company_country.py
@@ -0,0 +1,15 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ country = frappe.db.get_single_value("Global Defaults", "country")
+ if not country:
+ print "Country not specified in Global Defaults"
+ return
+
+ for company in frappe.db.sql_list("""select name from `tabCompany`
+ where ifnull(country, '')=''"""):
+ frappe.db.set_value("Company", company, "country", country)
diff --git a/erpnext/templates/form_grid/item_grid.html b/erpnext/templates/form_grid/item_grid.html
index c2e5d56..715d4dc 100644
--- a/erpnext/templates/form_grid/item_grid.html
+++ b/erpnext/templates/form_grid/item_grid.html
@@ -72,17 +72,26 @@
<!-- rate -->
<div class="col-sm-2 text-right">
- {%= doc.get_formatted("rate") %}
- {% if(doc.discount_percentage) { %}
- <br><span class="label label-default pull-right"
- title="{%= __("Discount") %}">
- {%= -1 * doc.discount_percentage %}%</span>
- {% }%}
+ {% if (frappe.perm.is_visible("rate", doc, frm.perm)) { %}
+ <span class="text-muted">{%= __("hidden") %}</span>
+ {% } else { %}
+ {%= doc.get_formatted("rate") %}
+ {% if(doc.discount_percentage) { %}
+ <br><span class="label label-default pull-right"
+ title="{%= __("Discount") %}">
+ {%= -1 * doc.discount_percentage %}%</span>
+ {% }%}
+ {% } %}
</div>
<!-- amount -->
<div class="col-sm-2 text-right">
- {%= doc.get_formatted("amount") %}
+ {% if (frappe.perm.is_visible("amount", doc, frm.perm)) { %}
+ <span class="text-muted">{%= __("hidden") %}</span>
+ {% } else { %}
+ {%= doc.get_formatted("amount") %}
+ {% } %}
+
{% if(in_list(["Sales Order Item", "Purchase Order Item"],
doc.doctype) && frm.doc.docstatus===1 && doc.amount) {
var completed =