patch: update item tax rate in json format
This commit is contained in:
commit
acecb94a0f
@ -26,11 +26,11 @@ def execute(filters=None):
|
||||
|
||||
buying_amount = buying_amount > 0 and buying_amount or 0
|
||||
|
||||
if selling_amount:
|
||||
gross_profit = selling_amount - buying_amount
|
||||
if selling_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]),)
|
||||
|
@ -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"]],
|
||||
|
16
patches/march_2013/p11_update_attach_files.py
Normal file
16
patches/march_2013/p11_update_attach_files.py
Normal file
@ -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)
|
19
patches/march_2013/p12_set_item_tax_rate_in_json.py
Normal file
19
patches/march_2013/p12_set_item_tax_rate_in_json.py
Normal file
@ -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
|
@ -225,4 +225,6 @@ patch_list = [
|
||||
"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",
|
||||
]
|
@ -74,7 +74,7 @@ class DocType(DocTypeNestedSet):
|
||||
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
|
||||
|
||||
|
@ -366,6 +366,7 @@ class DocType(SellingController):
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
|
@ -235,9 +235,8 @@ class DocType(DocListController):
|
||||
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:
|
||||
|
@ -171,7 +171,7 @@ def get_buying_amount(item_code, warehouse, qty, voucher_type, voucher_no, vouch
|
||||
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 @@ def _get_buying_amount(voucher_type, voucher_no, item_row, item_code, warehouse,
|
||||
|
||||
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
|
||||
|
||||
|
@ -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 @@ class DocType:
|
||||
|
||||
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
|
||||
}
|
@ -78,8 +78,6 @@ class DocType:
|
||||
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]
|
||||
|
||||
|
@ -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 @@ div.web-footer, div.web-footer a {
|
||||
|
||||
/* 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 -%}
|
||||
|
@ -48,7 +48,6 @@ cur_frm.cscript.set_banner_from_image = function(doc) {
|
||||
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>");
|
||||
}
|
@ -46,8 +46,6 @@ def get_blog_list(start=0, by=None, category=None):
|
||||
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_blog_template_args():
|
||||
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,
|
||||
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
||||
|
||||
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 @@ def scrub_item_for_list(r):
|
||||
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)
|
||||
|
@ -20,7 +20,4 @@ def get_slideshow(obj):
|
||||
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
|
||||
|
@ -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 %}
|
||||
|
@ -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>
|
||||
|
@ -192,6 +192,7 @@ def get_source_doc(page_name):
|
||||
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 @@ def get_outer_env(page_name, args):
|
||||
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)
|
||||
@ -281,12 +282,6 @@ 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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user