patch: update item tax rate in json format
diff --git a/accounts/report/gross_profit/gross_profit.py b/accounts/report/gross_profit/gross_profit.py
index 7f6354b..9300548 100644
--- a/accounts/report/gross_profit/gross_profit.py
+++ b/accounts/report/gross_profit/gross_profit.py
@@ -25,12 +25,12 @@
item_sales_bom.get(row.parenttype, {}).get(row.name, webnotes._dict()))
buying_amount = buying_amount > 0 and buying_amount or 0
-
+
+ gross_profit = selling_amount - buying_amount
if selling_amount:
- gross_profit = selling_amount - buying_amount
gross_profit_percent = (gross_profit / selling_amount) * 100.0
else:
- gross_profit = gross_profit_percent = 0.0
+ gross_profit_percent = 0.0
icon = """<a href="%s"><i class="icon icon-share" style="cursor: pointer;"></i></a>""" \
% ("/".join(["#Form", row.parenttype, row.name]),)
diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js
index a7a148a..c0bad94 100644
--- a/home/page/latest_updates/latest_updates.js
+++ b/home/page/latest_updates/latest_updates.js
@@ -1,5 +1,7 @@
erpnext.updates = [
["27th March", ["Rename multiple items together. Go to Setup > Rename Tool"]],
+ ["26th March", ["Added project to Stock Ledger and Balance",
+ "Added Default Cash Account in Company."]],
["19th March", ["Sales and Purchase Return Tool deprecated. Use Stock Entry instead."]],
["12th March", ["Updates to website module. Added more options in Style Settings and Website Settings."]],
["5th March", ["Refactored Upload Attendance Tool"]],
diff --git a/patches/march_2013/p11_update_attach_files.py b/patches/march_2013/p11_update_attach_files.py
new file mode 100644
index 0000000..ef39ce8
--- /dev/null
+++ b/patches/march_2013/p11_update_attach_files.py
@@ -0,0 +1,16 @@
+import webnotes
+
+def execute():
+ for f in webnotes.conn.sql("""select parent, fieldname
+ from tabDocField where options="attach_files:" """, as_dict=1):
+ if webnotes.conn.get_value("DocType", f.parent, "issingle"):
+ fname = webnotes.conn.get_value(f.parent, None, f.fieldname)
+ if fname:
+ if not (fname.startswith("http") or fname.startswith("files")):
+ webnotes.conn.set_value(f.parent, None, f.fieldname, "files/" + fname)
+ else:
+ webnotes.conn.sql("""update `tab%(parent)s`
+ set %(fieldname)s =
+ if(substr(%(fieldname)s,1,4)='http' or substr(%(fieldname)s,1,5)='files',
+ %(fieldname)s,
+ concat('files/', %(fieldname)s))""" % f)
\ No newline at end of file
diff --git a/patches/march_2013/p12_set_item_tax_rate_in_json.py b/patches/march_2013/p12_set_item_tax_rate_in_json.py
new file mode 100644
index 0000000..de47c67
--- /dev/null
+++ b/patches/march_2013/p12_set_item_tax_rate_in_json.py
@@ -0,0 +1,19 @@
+import webnotes
+import json
+
+def execute():
+ """replace item_tax_rate stored as string with a json string"""
+ webnotes.conn.auto_commit_on_many_writes = 1
+ for dt in ["Quotation Item", "Sales Order Item", "Sales Invoice Item",
+ "Delivery Note Item", "Supplier Quotation Item", "Purchase Order Item",
+ "Purchase Invoice Item", "Purchase Receipt Item"]:
+ for d in webnotes.conn.sql("""select name, item_tax_rate from `tab%s`
+ where ifnull(item_tax_rate, '')!=''""" % (dt,), as_dict=1):
+ try:
+ json.loads(d["item_tax_rate"])
+ except ValueError, e:
+ webnotes.conn.sql("""update `tab%s` set item_tax_rate=%s
+ where name=%s""" % (dt, "%s", "%s"),
+ (json.dumps(eval(d["item_tax_rate"])), d["name"]))
+
+ webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 0c9662e..905ea29 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -225,4 +225,6 @@
"patches.march_2013.p09_unset_user_type_partner",
"patches.march_2013.p10_set_fiscal_year_for_stock",
"patches.march_2013.p10_update_against_expense_account",
+ "patches.march_2013.p11_update_attach_files",
+ "patches.march_2013.p12_set_item_tax_rate_in_json",
]
\ No newline at end of file
diff --git a/setup/doctype/item_group/item_group.py b/setup/doctype/item_group/item_group.py
index ba4ea77..827eed4 100644
--- a/setup/doctype/item_group/item_group.py
+++ b/setup/doctype/item_group/item_group.py
@@ -74,7 +74,7 @@
for d in self.doc.sub_groups:
d.count = get_group_item_count(d.name)
- self.doc.items = get_product_list_for_group(product_group = self.doc.name, limit=20)
+ self.doc.items = get_product_list_for_group(product_group = self.doc.name, limit=100)
self.parent_groups = get_parent_item_groups(self.doc.name)
self.doc.title = self.doc.name
diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py
index ded6897..daf7d61 100644
--- a/stock/doctype/delivery_note/delivery_note.py
+++ b/stock/doctype/delivery_note/delivery_note.py
@@ -366,6 +366,7 @@
# Reduce actual qty from warehouse
self.make_sl_entry(d, d['warehouse'], - flt(d['qty']) , 0, update_stock)
+
get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index 931b776..802771c 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -235,9 +235,8 @@
clear_cache(self.doc.page_name)
def prepare_template_args(self):
- from website.helpers.product import get_parent_item_groups, url_for_website
+ from website.helpers.product import get_parent_item_groups
self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
- self.doc.website_image = url_for_website(self.doc.website_image)
self.doc.title = self.doc.item_name
if self.doc.slideshow:
diff --git a/stock/utils.py b/stock/utils.py
index d75c1d4..a2541dc 100644
--- a/stock/utils.py
+++ b/stock/utils.py
@@ -171,7 +171,7 @@
buying_amount = 0.0
for bom_item in item_sales_bom[item_code]:
if bom_item.get("parent_detail_docname")==voucher_detail_no:
- buying_amount += _get_buying_amount(voucher_type, voucher_no, "[** No Item Row **]",
+ buying_amount += _get_buying_amount(voucher_type, voucher_no, voucher_detail_no,
bom_item.item_code, bom_item.warehouse or warehouse,
bom_item.total_qty or (bom_item.qty * qty), stock_ledger_entries)
return buying_amount
@@ -187,8 +187,7 @@
for i, sle in enumerate(relevant_stock_ledger_entries):
if sle.voucher_type == voucher_type and sle.voucher_no == voucher_no and \
- ((sle.voucher_detail_no == item_row) or (sle.voucher_type != "Stock Reconciliation"
- and flt(sle.qty) == qty)):
+ sle.voucher_detail_no == item_row:
previous_stock_value = len(relevant_stock_ledger_entries) > i+1 and \
flt(relevant_stock_ledger_entries[i+1].stock_value) or 0.0
diff --git a/website/doctype/about_us_settings/about_us_settings.py b/website/doctype/about_us_settings/about_us_settings.py
index e291aa8..fb3dcc9 100644
--- a/website/doctype/about_us_settings/about_us_settings.py
+++ b/website/doctype/about_us_settings/about_us_settings.py
@@ -2,7 +2,6 @@
from __future__ import unicode_literals
import webnotes
-from website.utils import url_for_website
class DocType:
def __init__(self, d, dl):
@@ -14,9 +13,6 @@
def get_args():
obj = webnotes.get_obj("About Us Settings")
- for d in obj.doclist.get({"doctype":"About Us Team Member"}):
- if not "/" in d.image_link:
- d.image_link = "files/" + d.image_link
return {
"obj": obj
}
\ No newline at end of file
diff --git a/website/doctype/blog_post/blog_post.py b/website/doctype/blog_post/blog_post.py
index ff6cc99..90f72f2 100644
--- a/website/doctype/blog_post/blog_post.py
+++ b/website/doctype/blog_post/blog_post.py
@@ -78,8 +78,6 @@
self.doc.content_html = self.doc.content
if self.doc.blogger:
self.doc.blogger_info = webnotes.doc("Blogger", self.doc.blogger).fields
- if self.doc.blogger_info.avatar and not "/" in self.doc.blogger_info.avatar:
- self.doc.blogger_info.avatar = "files/" + self.doc.blogger_info.avatar
self.doc.description = self.doc.blog_intro or self.doc.content[:140]
diff --git a/website/doctype/style_settings/custom_template.css b/website/doctype/style_settings/custom_template.css
index fcb2276..f055b78 100644
--- a/website/doctype/style_settings/custom_template.css
+++ b/website/doctype/style_settings/custom_template.css
@@ -4,7 +4,7 @@
body {
{% if doc.background_image %}
- background: url("../files/{{ doc.background_image }}") repeat;
+ background: url("../{{ doc.background_image }}") repeat;
{% elif doc.background_color %}
background-color: #{{ doc.background_color }};
background-image: none;
@@ -67,16 +67,10 @@
/* Bootstrap Navbar */
.navbar-inverse .navbar-inner {
+ box-shadow: none;
background-color: #{{ doc.top_bar_background or "444444"}};
background-repeat: repeat-x;
background-image: none;
-}
-
-.navbar-inner {
- box-shadow: none;
-}
-
-.navbar-inner {
border-bottom: 1px solid {% if doc.top_bar_background == doc.page_background -%}
#{{ get_hex_shade(doc.page_background or "ffffff", 15) }};
{%- else -%}
diff --git a/website/doctype/website_settings/website_settings.js b/website/doctype/website_settings/website_settings.js
index 67e4941..5858926 100644
--- a/website/doctype/website_settings/website_settings.js
+++ b/website/doctype/website_settings/website_settings.js
@@ -48,7 +48,6 @@
msgprint(wn._("Select a Banner Image first."));
}
var src = doc.banner_image;
- if(src.indexOf("/")==-1) src = "files/" + src;
cur_frm.set_value("banner_html", "<a href='/'><img src='"+ src
+"' style='max-width: 200px;'></a>");
}
\ No newline at end of file
diff --git a/website/helpers/blog.py b/website/helpers/blog.py
index 1f25ac0..4044353 100644
--- a/website/helpers/blog.py
+++ b/website/helpers/blog.py
@@ -46,8 +46,6 @@
if not res['content']:
res['content'] = website.utils.get_html(res['page_name'])
res['content'] = res['content'][:140]
- if res.avatar and not "/" in res.avatar:
- res.avatar = "files/" + res.avatar
return result
@@ -133,9 +131,6 @@
def get_writers_args():
bloggers = webnotes.conn.sql("""select * from `tabBlogger`
order by posts desc""", as_dict=1)
- for blogger in bloggers:
- if blogger.avatar and not "/" in blogger.avatar:
- blogger.avatar = "files/" + blogger.avatar
args = {
"bloggers": bloggers,
diff --git a/website/helpers/product.py b/website/helpers/product.py
index ef433b1..f79d207 100644
--- a/website/helpers/product.py
+++ b/website/helpers/product.py
@@ -5,7 +5,7 @@
import webnotes
from webnotes.utils import cstr
-from website.utils import build_html, url_for_website, delete_page_cache
+from website.utils import build_html, delete_page_cache
@webnotes.whitelist(allow_guest=True)
@@ -90,7 +90,6 @@
r.website_description = "No description given"
if len(r.website_description.split(" ")) > 24:
r.website_description = " ".join(r.website_description.split(" ")[:24]) + "..."
- r.website_image = url_for_website(r.website_image)
def get_parent_item_groups(item_group_name):
item_group = webnotes.doc("Item Group", item_group_name)
diff --git a/website/helpers/slideshow.py b/website/helpers/slideshow.py
index 0afd80a..4c64c55 100644
--- a/website/helpers/slideshow.py
+++ b/website/helpers/slideshow.py
@@ -20,7 +20,4 @@
slideshow = webnotes.bean("Website Slideshow", obj.doc.slideshow)
obj.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"})
obj.doc.slideshow_header = slideshow.doc.header or ""
- for s in obj.slides:
- if s.image and not s.image.lower().startswith("http"):
- s.image = "files/" + s.image
\ No newline at end of file
diff --git a/website/templates/html/base.html b/website/templates/html/base.html
index 6889d67..cfba1a5 100644
--- a/website/templates/html/base.html
+++ b/website/templates/html/base.html
@@ -10,13 +10,8 @@
<script type="text/javascript" src="js/wn-web.js"></script>
<link type="text/css" rel="stylesheet" href="css/all-web.css">
<link type="text/css" rel="stylesheet" href="css/wn-web.css">
- {%- if favicon %}
- <link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
- <link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
- {% else %}
- <link rel="shortcut icon" href="app/images/favicon.ico" type="image/x-icon">
- <link rel="icon" href="app/images/favicon.ico" type="image/x-icon">
- {% endif -%}
+ <link rel="shortcut icon" href="{{ favicon }}" type="image/x-icon">
+ <link rel="icon" href="{{ favicon }}" type="image/x-icon">
{% if description -%}
<meta name="description" content="{{ description }}">
{%- endif %}
diff --git a/website/templates/html/product_group.html b/website/templates/html/product_group.html
index 2e80c43..510f994 100644
--- a/website/templates/html/product_group.html
+++ b/website/templates/html/product_group.html
@@ -29,8 +29,8 @@
{{ item }}
{% endfor %}
</div>
- {% if len(items)==20 %}
- <div class="alert info">Showing top 20</div>
+ {% if len(items)==100 %}
+ <div class="alert info">Showing top 100 items.</div>
{% endif %}
{% else %}
<div class="alert">No items listed.</div>
diff --git a/website/utils.py b/website/utils.py
index 14e3e13..2528859 100644
--- a/website/utils.py
+++ b/website/utils.py
@@ -192,6 +192,7 @@
return None, None
def get_outer_env(page_name, args):
+
from webnotes.utils import get_request_site_address
from urllib import quote
@@ -238,7 +239,7 @@
args.update(ret)
settings = webnotes.doc("Website Settings", "Website Settings")
- for k in ["banner_html", "brand_html", "copyright", "address", "twitter_share_via"
+ for k in ["banner_html", "brand_html", "copyright", "address", "twitter_share_via",
"favicon", "facebook_share", "google_plus_one", "twitter_share", "linked_in_share"]:
if k in settings.fields:
args[k] = settings.fields.get(k)
@@ -280,13 +281,7 @@
def delete_page_cache(page_name):
if page_name:
webnotes.cache().delete_value("page:" + page_name)
-
-def url_for_website(url):
- if url and not url.lower().startswith("http"):
- return "files/" + url
- else:
- return url
-
+
def get_hex_shade(color, percent):
def p(c):