Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pdvyas committed Sep 9, 2014
2 parents 90c8932 + 52fa199 commit 796c84e
Show file tree
Hide file tree
Showing 55 changed files with 635 additions and 4,379 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ recursive-include shopping_cart *.md
recursive-include shopping_cart *.png
recursive-include shopping_cart *.py
recursive-include shopping_cart *.svg
recursive-include shopping_cart/public *
recursive-exclude shopping_cart *.pyc
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from setuptools import setup, find_packages
import os

version = '0.2.0'
version = "0.4.0"

setup(
name='shopping_cart',
Expand Down
2 changes: 1 addition & 1 deletion shopping_cart/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.2.0'
from .__version__ import __version__
1 change: 1 addition & 0 deletions shopping_cart/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.4.0"
2 changes: 1 addition & 1 deletion shopping_cart/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
app_color = "#B7E090"
app_email = "[email protected]"
app_url = "https://erpnext.com"
app_version = "0.0.1"
app_version = "0.4.0"

web_include_js = "assets/js/shopping-cart-web.min.js"
web_include_css = "assets/css/shopping-cart-web.css"
Expand Down
2 changes: 1 addition & 1 deletion shopping_cart/modules.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
shopping_cart
Shopping Cart
6 changes: 3 additions & 3 deletions shopping_cart/public/js/shopping_cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $.extend(shopping_cart, {
update_cart: function(opts) {
if(!full_name) {
if(localStorage) {
localStorage.setItem("last_visited", window.location.href.split("/").slice(-1)[0]);
localStorage.setItem("last_visited", window.location.pathname);
localStorage.setItem("pending_add_to_cart", opts.item_code);
}
window.location.href = "/login";
Expand All @@ -30,7 +30,7 @@ $.extend(shopping_cart, {
args: {
item_code: opts.item_code,
qty: opts.qty,
with_doclist: opts.with_doclist
with_doc: opts.with_doc || 0
},
btn: opts.btn,
callback: function(r) {
Expand All @@ -51,7 +51,7 @@ $.extend(shopping_cart, {
var $cog_count = $cog.find(".cart-count");
if(cart_count) {
if($badge.length === 0) {
var $badge = $('<span class="badge pull-right"></span>').appendTo($cart.find("a"));
var $badge = $('<span class="badge pull-right"></span>').prependTo($cart.find("a"));
}
$badge.html(cart_count);
if($cog_count.length === 0) {
Expand Down
24 changes: 13 additions & 11 deletions shopping_cart/shopping_cart/cart.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,22 @@ def guess_territory():
frappe.db.get_value("Shopping Cart Settings", None, "territory") or \
get_root_of("Territory")

def decorate_quotation_doc(doc):
for d in doc.get_all_children():
if d.item_code:
d.update(frappe.db.get_value("Item", d.item_code,
["website_image", "description", "page_name"], as_dict=True))
d.formatted_rate = fmt_money(d.rate, currency=doc.currency)
d.formatted_amount = fmt_money(d.amount, currency=doc.currency)
elif d.charge_type:
d.formatted_tax_amount = fmt_money(flt(d.tax_amount) / doc.conversion_rate,
currency=doc.currency)
def decorate_quotation_doc(quotation_doc):
doc = frappe._dict(quotation_doc.as_dict())
for d in doc.get("quotation_details", []):
d.update(frappe.db.get_value("Item", d["item_code"],
["website_image", "description", "page_name"], as_dict=True))
d["formatted_rate"] = fmt_money(d.get("rate"), currency=doc.currency)
d["formatted_amount"] = fmt_money(d.get("amount"), currency=doc.currency)

for d in doc.get("other_charges", []):
d["formatted_tax_amount"] = fmt_money(flt(d.get("tax_amount")) / doc.conversion_rate,
currency=doc.currency)

doc.formatted_grand_total_export = fmt_money(doc.grand_total_export,
currency=doc.currency)

return doc.as_dict()
return doc

def _get_cart_quotation(party=None):
if not party:
Expand Down Expand Up @@ -174,6 +175,7 @@ def _get_cart_quotation(party=None):
qdoc.contact_person = frappe.db.get_value("Contact", {"email_id": frappe.session.user,
"customer": party.name})

qdoc.ignore_permissions = True
qdoc.run_method("set_missing_values")
apply_cart_settings(party, qdoc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
{
"fieldname": "company",
"fieldtype": "Link",
"ignore_restrictions": 0,
"in_list_view": 1,
"label": "Company",
"options": "Company",
Expand All @@ -30,7 +29,7 @@
"description": "<a href=\"#Sales Browser/Territory\">Add / Edit</a>",
"fieldname": "default_territory",
"fieldtype": "Link",
"ignore_restrictions": 1,
"ignore_user_permissions": 1,
"in_list_view": 1,
"label": "Default Territory",
"options": "Territory",
Expand All @@ -46,7 +45,7 @@
"description": "<a href=\"#Sales Browser/Customer Group\">Add / Edit</a>",
"fieldname": "default_customer_group",
"fieldtype": "Link",
"ignore_restrictions": 1,
"ignore_user_permissions": 1,
"label": "Default Customer Group",
"options": "Customer Group",
"permlevel": 0,
Expand Down Expand Up @@ -97,7 +96,7 @@
"icon": "icon-shopping-cart",
"idx": 1,
"issingle": 1,
"modified": "2014-05-07 02:59:37.942130",
"modified": "2014-05-26 03:05:53.747800",
"modified_by": "Administrator",
"module": "Shopping Cart",
"name": "Shopping Cart Settings",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def validate_exchange_rates_exist(self):

def get_name_from_territory(self, territory, parentfield, fieldname):
name = None
print territory
territory_name_map = self.get_territory_name_map(parentfield, fieldname)

if territory_name_map.get(territory):
Expand Down
5 changes: 3 additions & 2 deletions shopping_cart/shopping_cart/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
from __future__ import unicode_literals

import frappe
from frappe.utils import cint, fmt_money
from frappe.utils import cint, fmt_money, cstr
from shopping_cart.shopping_cart.cart import _get_cart_quotation
from urllib import unquote

@frappe.whitelist(allow_guest=True)
def get_product_info(item_code):
Expand All @@ -15,7 +16,7 @@ def get_product_info(item_code):

cart_quotation = _get_cart_quotation()

price_list = frappe.local.request.cookies.get("selling_price_list")
price_list = cstr(unquote(frappe.local.request.cookies.get("selling_price_list")))

warehouse = frappe.db.get_value("Item", item_code, "website_warehouse")
if warehouse:
Expand Down
Loading

0 comments on commit 796c84e

Please sign in to comment.