Merge branch 'website-wip' of github.com:webnotes/erpnext into website-wip

This commit is contained in:
Anand Doshi 2013-09-10 12:54:10 +05:30
commit 429fd1d3d8
169 changed files with 182 additions and 4434 deletions

View File

@ -1,5 +1,6 @@
{
"app_name": "ERPNext",
"base_template": "app/portal/templates/base.html",
"modules": {
"Selling": {
"link": "selling-home",
@ -43,12 +44,6 @@
"color": "#7f8c8d",
"icon": "icon-cogs"
},
"Website": {
"type": "module",
"link": "website-home",
"color": "#16a085",
"icon": "icon-globe"
},
"HR": {
"type": "module",
"link": "hr-home",
@ -80,29 +75,14 @@
},
"web": {
"pages": {
"about": {
"template": "app/website/templates/pages/about",
"args_method": "website.doctype.about_us_settings.about_us_settings.get_args"
},
"account": {
"no_cache": true,
"template": "app/website/templates/pages/account"
},
"blog": {
"template": "app/website/templates/pages/blog",
"args_method": "website.helpers.blog.get_blog_template_args"
},
"contact": {
"template": "app/website/templates/pages/contact",
"args_doctype": "Contact Us Settings"
},
"index": {
"template": "app/website/templates/pages/index"
"template": "app/portal/templates/account.html"
},
"order": {
"no_cache": true,
"template": "app/website/templates/pages/sale",
"args_method": "website.helpers.transaction.get_order_args",
"template": "app/portal/templates/sale.html",
"args_method": "utilities.website_transactions.get_order_args",
"portal": {
"doctype": "Sales Order",
"conditions": {
@ -112,13 +92,13 @@
},
"orders": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.order_list_args"
"template": "app/portal/templates/sales_transactions.html",
"args_method": "utilities.website_transactions.order_list_args"
},
"invoice": {
"no_cache": true,
"template": "app/website/templates/pages/sale",
"args_method": "website.helpers.transaction.get_invoice_args",
"template": "app/portal/templates/sale.html",
"args_method": "utilities.website_transactions.get_invoice_args",
"portal": {
"doctype": "Sales Invoice",
"conditions": {
@ -128,13 +108,13 @@
},
"invoices": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.invoice_list_args"
"template": "app/portal/templates/sales_transactions.html",
"args_method": "utilities.website_transactions.invoice_list_args"
},
"shipment": {
"no_cache": true,
"template": "app/website/templates/pages/sale",
"args_method": "website.helpers.transaction.get_shipment_args",
"template": "app/portal/templates/sale.html",
"args_method": "utilities.website_transactions.get_shipment_args",
"portal": {
"doctype": "Delivery Note",
"conditions": {
@ -144,69 +124,57 @@
},
"shipments": {
"no_cache": true,
"template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.shipment_list_args"
"template": "app/portal/templates/sales_transactions.html",
"args_method": "utilities.website_transactions.shipment_list_args"
},
"product_search": {
"template": "app/website/templates/pages/product_search"
"template": "app/stock/doctype/item/templates/product_search.html"
},
"ticket": {
"no_cache": true,
"template": "app/website/templates/pages/ticket",
"template": "app/support/doctype/support_ticket/templates/ticket.html",
"args_method": "support.doctype.support_ticket.support_ticket.get_website_args",
"portal": {
"doctype": "Support Ticket"
}
},
"tickets": {
"template": "app/website/templates/pages/tickets",
"args_method": "website.helpers.transaction.ticket_list_args"
"template": "app/support/doctype/support_ticket/templates/tickets.html",
"args_method": "utilities.website_transactions.ticket_list_args"
},
"address": {
"no_cache": true,
"template": "app/website/templates/pages/address",
"template": "app/utilities/doctype/address/templates/address.html",
"args_method": "utilities.doctype.address.address.get_website_args"
},
"addresses": {
"template": "app/website/templates/pages/addresses"
},
"writers": {
"template": "app/website/templates/pages/writers",
"args_method": "website.doctype.blogger.blogger.get_writers_args"
"template": "app/utilities/doctype/address/templates/addresses.html"
},
"profile": {
"no_cache": true,
"template": "app/website/templates/pages/profile",
"template": "app/portal/templates/profile.html",
"args_method": "startup.webutils.get_profile_args"
},
"cart": {
"no_cache": true,
"template": "app/website/templates/pages/cart.html"
"template": "app/portal/templates/cart.html"
},
"partners": {
"template": "app/website/templates/pages/partners",
"args_method": "website.helpers.partner.get_partner_args"
"template": "app/setup/doctype/sales_partners/templates/partners.html",
"args_method": "setup.doctype.sales_partner.sales_partner.get_partner_args"
}
},
"generators": {
"Web Page": {
"template": "app/website/templates/html/web_page.html",
"condition_field": "published"
},
"Blog Post": {
"template": "app/website/templates/html/blog_page.html",
"condition_field": "published"
},
"Item": {
"template": "app/website/templates/html/product_page.html",
"template": "app/stock/doctype/item/templates/item.html",
"condition_field": "show_in_website"
},
"Item Group":{
"template": "app/website/templates/html/product_group.html",
"template": "app/setup/doctype/item_group/templates/item_group.html",
"condition_field": "show_in_website"
},
"Sales Partner": {
"template": "app/website/templates/html/partner_page.html",
"template": "app/setup/doctype/sales_partner/templates/partner_page.html",
"condition_field": "show_in_website"
}
}

View File

@ -263,4 +263,5 @@ patch_list = [
"patches.september_2013.p01_update_communication",
"execute:webnotes.reload_doc('setup', 'doctype', 'features_setup') # 2013-09-05",
"patches.september_2013.p02_fix_serial_no_status",
"patches.september_2013.p03_move_website_to_framework"
]

View File

@ -0,0 +1,17 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import get_base_path
import os, shutil
def execute():
# remove pyc files
utils_pyc = os.path.join(get_base_path(), "app", "selling", "utils.pyc")
if os.path.exists(utils_pyc):
print exists
os.remove(utils_pyc)
shutil.rmtree(os.path.join(get_base_path(), "app", "website"))

View File

@ -0,0 +1,21 @@
{% extends "lib/website/templates/base.html" %}
{% block toolbar %}
<div class="pull-right" style="margin:4px;" id="user-tools">
{% if shopping_cart_enabled -%}
<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>
<span class="cart-count"></span></a> |
{%- endif %}
<a id="login-link" href="login">Login</a>
</div>
<div class="pull-right hide" style="margin:4px;" id="user-tools-post-login">
<a href="account" title="My Account" id="user-full-name"></a> |
{% if shopping_cart_enabled -%}
<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>
<span class="cart-count"></span></a> |
{%- endif %}
<a href="server.py?cmd=web_logout" title="Sign Out"><i class="icon-signout"></i></a>
</div>
{% endblock %}
{% block footer %}{% include "app/portal/templates/includes/footer.html" %}{% endblock %}

View File

@ -7,7 +7,7 @@ $(document).ready(function() {
wn.cart.bind_events();
return wn.call({
type: "POST",
method: "website.helpers.cart.get_cart_quotation",
method: "selling.utils.cart.get_cart_quotation",
callback: function(r) {
console.log(r);
$("#cart-container").removeClass("hide");
@ -194,7 +194,7 @@ $.extend(wn.cart, {
return wn.call({
btn: btn,
type: "POST",
method: "website.helpers.cart.apply_shipping_rule",
method: "selling.utils.cart.apply_shipping_rule",
args: { shipping_rule: rule },
callback: function(r) {
if(!r.exc) {
@ -242,7 +242,7 @@ $.extend(wn.cart, {
return wn.call({
type: "POST",
method: "website.helpers.cart.update_cart_address",
method: "selling.utils.cart.update_cart_address",
args: {
address_fieldname: $address_wrapper.attr("data-fieldname"),
address_name: $(this).attr("data-address-name")
@ -273,7 +273,7 @@ $.extend(wn.cart, {
place_order: function() {
return wn.call({
type: "POST",
method: "website.helpers.cart.place_order",
method: "selling.utils.cart.place_order",
callback: function(r) {
if(r.exc) {
var msg = "";

View File

@ -0,0 +1,44 @@
{% extends "lib/website/templates/includes/footer.html" %}
{% block powered %}
<p style="float: right; clear: right;">
<a style="font-size: 90%; color: #888;" href="http://erpnext.org">ERPNext Powered</a>
</p>
{% endblock %}
{% block extension %}
<br>
<div class="input-group col-md-6 col-md-offset-3">
<input class="form-control" type="text" id="footer-subscribe-email" placeholder="Your email address...">
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="footer-subscribe-button">Stay Updated</button>
</span>
</div>
<br>
<script>
$("#footer-subscribe-button").click(function() {
$("#footer-subscribe-email").attr('disabled', true);
$("#footer-subscribe-button").html("Sending...")
.attr("disabled", true);
if($("#footer-subscribe-email").val()) {
erpnext.send_message({
subject:"Subscribe me",
sender: $("#footer-subscribe-email").val(),
message: "Subscribe to newsletter (via website footer).",
callback: function(r) {
if(!r.exc) {
$("#footer-subscribe-button").html("Thank You :)")
.addClass("btn-success").attr("disabled", true);
} else {
$("#footer-subscribe-button").html("Error :( Not a valid id?")
.addClass("btn-danger").attr("disabled", false);
$("#footer-subscribe-email").val("").attr('disabled', false);
}
}
});
}
});
</script>
{% endblock %}

View File

@ -9,7 +9,7 @@ if(!window.wn) wn = {};
erpnext.send_message = function(opts) {
return wn.call({
type: "POST",
method: "website.helpers.contact.send_message",
method: "selling.utils.contact.send_message",
args: opts,
callback: opts.callback
});
@ -206,7 +206,7 @@ $.extend(wn.cart, {
} else {
return wn.call({
type: "POST",
method: "website.helpers.cart.update_cart",
method: "selling.utils.cart.update_cart",
args: {
item_code: opts.item_code,
qty: opts.qty,

View File

@ -4,9 +4,9 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, cint, fmt_money
from webnotes.webutils import build_html, delete_page_cache
from website.helpers.cart import _get_cart_quotation
from webnotes.utils import cstr, cint, fmt_money, get_base_path
from webnotes.webutils import delete_page_cache
from selling.utils.cart import _get_cart_quotation
@webnotes.whitelist(allow_guest=True)
def get_product_info(item_code):
@ -106,10 +106,12 @@ def get_group_item_count(item_group):
or name in (select parent from `tabWebsite Item Group`
where item_group in (%s))) """ % (child_groups, child_groups))[0][0]
def get_item_for_list_in_html(r):
scrub_item_for_list(r)
r.template = "app/website/templates/html/product_in_grid.html"
return build_html(r)
def get_item_for_list_in_html(context):
from jinja2 import Environment, FileSystemLoader
scrub_item_for_list(context)
jenv = Environment(loader = FileSystemLoader(get_base_path()))
template = jenv.get_template("app/stock/doctype/item/templates/includes/product_in_grid.html")
return template.render(context)
def scrub_item_for_list(r):
if not r.website_description:

View File

@ -18,7 +18,7 @@ class DocType(DocTypeNestedSet):
self.validate_name_with_item()
from website.helpers.product import invalidate_cache_for
from selling.utils.product import invalidate_cache_for
if self.doc.show_in_website:
from webnotes.webutils import update_page_name
@ -44,8 +44,8 @@ class DocType(DocTypeNestedSet):
webnotes.msgprint("An item exists with same name (%s), please change the \
item group name or rename the item" % self.doc.name, raise_exception=1)
def prepare_template_args(self):
from website.helpers.product import get_product_list_for_group, \
def get_context(self):
from selling.utils.product import get_product_list_for_group, \
get_parent_item_groups, get_group_item_count
self.doc.sub_groups = webnotes.conn.sql("""select name, page_name
@ -60,6 +60,6 @@ class DocType(DocTypeNestedSet):
self.doc.title = self.doc.name
if self.doc.slideshow:
from website.helpers.slideshow import get_slideshow
from website.doctype.website_slideshow.website_slideshow import get_slideshow
get_slideshow(self)

View File

@ -1,11 +1,11 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% block content %}
{% include 'app/website/templates/html/product_search_box.html' %}
{% include 'app/website/templates/html/product_breadcrumbs.html' %}
{% include 'app/stock/doctype/item/templates/includes/product_search_box.html' %}
{% include 'app/stock/doctype/item/templates/includes/product_breadcrumbs.html' %}
<div class="col-md-12">
{% if slideshow %}<!-- slideshow -->
{% include "app/website/templates/html/slideshow.html" %}
{% include "lib/website/templates/includes/slideshow.html" %}
{% endif %}
{% if description %}<!-- description -->
<div>{{ description or ""}}</div>
@ -31,7 +31,7 @@
{{ item }}
{% endfor %}
</div>
{% if len(items)==100 %}
{% if (items|length)==100 %}
<div class="alert info">Showing top 100 items.</div>
{% endif %}
{% else %}

View File

@ -0,0 +1,2 @@
doctype = "Item Group"
condition_field = "show_in_website"

View File

@ -29,7 +29,7 @@ class DocType:
else:
return ''
def prepare_template_args(self):
def get_context(self):
address = webnotes.conn.get_value("Address",
{"sales_partner": self.doc.name, "is_primary_address": 1},
"*", as_dict=True)
@ -42,4 +42,4 @@ class DocType:
"email": address.email_id,
"partner_address": filter_strip_join(address_rows, "\n<br>"),
"phone": filter_strip_join(cstr(address.phone).split(","), "\n<br>")
})
})

View File

@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% block content %}
<div class="col-md-12" itemscope itemtype="http://schema.org/Organization">

View File

@ -0,0 +1,2 @@
doctype = "Sales Partner"
condition_field = "show_in_website"

View File

@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% set title="Partners" %}

View File

@ -0,0 +1,7 @@
import webnotes
def get_context():
return {
"partners": webnotes.conn.sql("""select * from `tabSales Partner`
where show_in_website=1 order by name asc""", as_dict=True),
}

View File

@ -31,7 +31,7 @@ def on_login_post_session(login_manager):
webnotes.conn.commit()
if webnotes.conn.get_value("Profile", webnotes.session.user, "user_type") == "Website User":
from website.helpers.cart import set_cart_count
from selling.utils.cart import set_cart_count
set_cart_count()
def on_logout(login_manager):
@ -65,7 +65,7 @@ def check_if_expired():
raise webnotes.AuthenticationError
def on_build():
from website.helpers.make_web_include_files import make
from website.doctype.website_settings.make_web_include_files import make
make()
from home.page.latest_updates import latest_updates

View File

@ -7,15 +7,6 @@ from webnotes.utils import cint, cstr, encode
def get_templates_path():
return os.path.join(os.path.dirname(conf.__file__), "app", "website", "templates")
def get_home_page():
doc_name = webnotes.conn.get_value('Website Settings', None, 'home_page')
if doc_name:
page_name = webnotes.conn.get_value('Web Page', doc_name, 'page_name')
else:
page_name = 'login'
return page_name
def update_template_args(page_name, args):
from webnotes.utils import get_request_site_address
@ -71,14 +62,14 @@ def update_template_args(page_name, args):
@webnotes.whitelist()
def update_profile(fullname, password=None, company_name=None, mobile_no=None, phone=None):
from website.helpers.cart import update_party
from selling.utils.cart import update_party
update_party(fullname, company_name, mobile_no, phone)
from core.doctype.profile import profile
return profile.update_profile(fullname, password)
def get_profile_args():
from website.helpers.cart import get_lead_or_customer
from selling.utils.cart import get_lead_or_customer
party = get_lead_or_customer()
if party.doctype == "Lead":
mobile_no = party.mobile_no

View File

@ -228,7 +228,7 @@ class DocType(DocListController):
def update_website(self):
def _invalidate_cache():
from website.helpers.product import invalidate_cache_for
from selling.utils.product import invalidate_cache_for
invalidate_cache_for(self.doc.item_group)
@ -258,13 +258,13 @@ class DocType(DocListController):
def get_tax_rate(self, tax_type):
return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") }
def prepare_template_args(self):
from website.helpers.product import get_parent_item_groups
def get_context(self):
from selling.utils.product import get_parent_item_groups
self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
self.doc.title = self.doc.item_name
if self.doc.slideshow:
from website.helpers.slideshow import get_slideshow
from website.doctype.website_slideshow.website_slideshow import get_slideshow
get_slideshow(self)
def get_file_details(self, arg = ''):

View File

@ -1,28 +1,32 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% block javascript %}
{% include "app/website/templates/js/product_page.js" %}
<script>
{% include "app/stock/doctype/item/templates/includes/product_page.js" %}
</script>
{% endblock %}
{% block css %}
{% include "app/website/templates/css/product_page.css" %}
<style>
{% include "app/stock/doctype/item/templates/includes/product_page.css" %}
</style>
{% endblock %}
{% block content %}
{% include 'app/website/templates/html/product_search_box.html' %}
{% include 'app/website/templates/html/product_breadcrumbs.html' %}
{% include 'app/stock/doctype/item/templates/includes/product_search_box.html' %}
{% include 'app/stock/doctype/item/templates/includes/product_breadcrumbs.html' %}
<div class="col-md-12 product-page-content" itemscope itemtype="http://schema.org/Product">
<div class="row">
<div class="col-md-6">
{% if slideshow %}
{% include "app/website/templates/html/slideshow.html" %}
{% include "lib/website/templates/includes/html/slideshow.html" %}
{% else %}
{% if website_image %}
<image itemprop="image" class="item-main-image"
src="{{ website_image }}" />
{% else %}
<div class="img-area">
{% include 'app/website/templates/html/product_missing_image.html' %}
{% include 'app/stock/doctype/item/templates/includes/product_missing_image.html' %}
</div>
{% endif %}
{% endif %}

View File

@ -0,0 +1,2 @@
doctype = "Item"
condition_field = "show_in_website"

View File

@ -1,4 +1,4 @@
{% if obj.parent_groups and len(obj.parent_groups) > 1 %}
{% if obj.parent_groups and (obj.parent_groups|length) > 1 %}
<div class="col-md-12">
<div class="clearfix">
<ul class="breadcrumb">

View File

@ -4,7 +4,7 @@
{%- if website_image -%}
<img class="product-image" style="width: 80%; margin: auto;" src="{{ website_image }}">
{%- else -%}
{% include 'app/website/templates/html/product_missing_image.html' %}
{% include 'app/stock/doctype/item/templates/includes/product_missing_image.html' %}
{%- endif -%}
</a>
</div>

View File

@ -15,7 +15,7 @@ window.get_product_list = function() {
url: "server.py",
dataType: "json",
data: {
cmd: "website.helpers.product.get_product_list",
cmd: "selling.utils.product.get_product_list",
start: window.start,
search: window.search,
product_group: window.product_group

View File

@ -7,7 +7,7 @@ $(document).ready(function() {
wn.call({
type: "POST",
method: "website.helpers.product.get_product_info",
method: "selling.utils.product.get_product_info",
args: {
item_code: "{{ name }}"
},

View File

@ -1,4 +1,4 @@
{% extends "app/website/templates/html/page.html" %}
{% extends base_template %}
{% set title="Product Search" %}

View File

@ -6,7 +6,7 @@
if webnotes.form_dict.lead_email and validate_email_add(webnotes.form_dict.lead_email):
import requests
response = requests.post(conf.demo_notify_url, data={
"cmd":"website.helpers.contact.send_message",
"cmd":"selling.utils.contact.send_message",
"subject":"Logged into Demo",
"sender": webnotes.form_dict.lead_email,
"message": "via demo.erpnext.com"

View File

@ -89,7 +89,7 @@
wn.call({
btn: $(this),
type: "POST",
method: "website.helpers.cart.save_address",
method: "selling.utils.cart.save_address",
args: { fields: fields, address_fieldname: get_url_arg("address_fieldname") },
callback: function(r) {
if(r.exc) {

View File

@ -26,7 +26,7 @@
var fetch_addresses = function() {
wn.call({
method: "website.helpers.cart.get_addresses",
method: "selling.utils.cart.get_addresses",
callback: function(r) {
$("#address-list .progress").remove();
var $list = $("#address-list");

View File

@ -40,7 +40,7 @@ def order_list_args():
args = get_common_args()
args.update({
"title": "My Orders",
"method": "website.helpers.transaction.get_orders",
"method": "utilities.website_transactions.get_orders",
"icon": "icon-list",
"empty_list_message": "No Orders Yet",
"page": "order",
@ -55,7 +55,7 @@ def invoice_list_args():
args = get_common_args()
args.update({
"title": "Invoices",
"method": "website.helpers.transaction.get_invoices",
"method": "utilities.website_transactions.get_invoices",
"icon": "icon-file-text",
"empty_list_message": "No Invoices Found",
"page": "invoice"
@ -70,7 +70,7 @@ def shipment_list_args():
args = get_common_args()
args.update({
"title": "Shipments",
"method": "website.helpers.transaction.get_shipments",
"method": "utilities.website_transactions.get_shipments",
"icon": "icon-truck",
"empty_list_message": "No Shipments Found",
"page": "shipment"
@ -91,7 +91,7 @@ def get_tickets(start=0):
def ticket_list_args():
return {
"title": "My Tickets",
"method": "website.helpers.transaction.get_tickets",
"method": "utilities.website_transactions.get_tickets",
"icon": "icon-ticket",
"empty_list_message": "No Tickets Raised",
"page": "ticket"

View File

@ -1,8 +0,0 @@
Module for website management.
Contains:
- DocTypes for Web Page, Blogs
- Templates
- Settings
- Generators for Item, Blog Post, Item Group

View File

@ -1,20 +0,0 @@
from __future__ import unicode_literals
install_docs = [
{"doctype":"Role", "role_name":"Blogger", "name":"Blogger"},
{"doctype":"Role", "role_name":"Website Manager", "name":"Website Manager"},
]
import webnotes
def get_site_address():
from webnotes.utils import get_request_site_address
url = get_request_site_address()
if not url or url=='http://localhost':
new_url = webnotes.conn.get_value('Website Settings', 'Website Settings',
'subdomain')
if new_url:
url = "http://" + new_url
return url

View File

@ -1,204 +0,0 @@
.container {
max-width: 728px !important;
}
h1, h2, h3, h4, h5 {
font-weight: bold;
}
a {
cursor: pointer;
}
img {
max-width: 100%;
}
.content {
padding-bottom: 30px;
}
.banner {
margin-top: 20px;
padding: 0px 20px;
}
.missing-image {
background-color: #eee;
padding: 40px;
width: 112px;
font-size: 32px;
color: #888;
}
.social-icons {
font-size: 120%;
float: right;
text-align: right;
}
.social-icons a:hover {
text-decoration: none;
}
.social-icons a i:hover {
text-decoration: none;
}
.social-icons i {
margin-left: 5px;
}
div.web-footer {
padding-top: 10px;
padding-bottom: 20px;
}
.web-footer-menu ul {
list-style: none;
margin: 0px;
padding: 0px;
}
.web-footer-menu ul li {
display: inline;
padding: 2px 14px 2px 0px;
margin: 0px;
}
.avatar {
display: inline-block;
vertical-align: middle;
overflow: hidden;
background-color: #ddd;
border: 1px solid #eee;
}
.avatar-small {
margin-right: 5px;
width: 30px;
height: 30px;
border-radius: 30px;
-moz-border-radius: 30px;
-webkit-border-radius: 30px;
}
.avatar-small img {
width: 30px;
}
.avatar-medium {
margin-right: 5px;
width: 48px;
height: 48px;
border-radius: 48px;
-moz-border-radius: 48px;
-webkit-border-radius: 48px;
}
.avatar-medium img {
width: 48px;
}
.avatar-large {
margin-right: 10px;
width: 72px;
height: 72px;
border-radius: 72px;
-moz-border-radius: 72px;
-webkit-border-radius: 72px;
}
.avatar-large img {
width: 72px;
}
.avatar-x-large {
margin-right: 10px;
width: 100px;
height: 100px;
border-radius: 100px;
-moz-border-radius: 100px;
-webkit-border-radius: 100px;
}
.avatar-x-large img {
width: 100px;
}
.carousel-control .icon {
position: absolute;
top: 50%;
left: 50%;
z-index: 5;
display: inline-block;
width: 20px;
height: 20px;
margin-top: -10px;
margin-left: -10px;
}
.hidden-sm-inline {
display: none;
}
@media (min-width: 768px) {
.hidden-sm-inline {
display: inline;
}
}
.panel-heading,
.panel-body {
padding-left: 15px;
}
.breadcrumb {
margin: 0px -20px;
margin-bottom: 20px;
}
fieldset {
margin-bottom: 20px;
}
/* buttons */
.btn-default {
color: #ffffff;
background-color: #a7a9aa;
border-color: #a7a9aa;
}
.dropup .btn-default .caret,
.btn-default .caret {
border-bottom-color: #ffffff;
border-top-color: #ffffff;
}
.btn-default:hover,
.btn-default:focus,
.btn-default:active,
.btn-default.active,
.open .dropdown-toggle.btn-default {
background-color: #9a9c9d;
border-color: #8d9091;
color: #ffffff;
}
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
background-color: #a7a9aa;
border-color: #a7a9aa;
}
.label {
padding-top: 0.3em;
}

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1 +0,0 @@
Configuration for "About" page in the website that shows company, history and team.

View File

@ -1,21 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def on_update(self):
from webnotes.webutils import clear_cache
clear_cache("about")
def get_args():
obj = webnotes.get_obj("About Us Settings")
return {
"obj": obj
}

View File

@ -1,110 +0,0 @@
[
{
"creation": "2013-03-19 12:02:15",
"docstatus": 0,
"modified": "2013-07-05 14:23:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_attach": 1,
"description": "Settings for the About Us Page",
"doctype": "DocType",
"document_type": "Other",
"icon": "icon-group",
"issingle": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "About Us Settings",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
"read_only": 0
},
{
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "About Us Settings",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 0,
"role": "Website Manager",
"submit": 0,
"write": 1
},
{
"doctype": "DocType",
"name": "About Us Settings"
},
{
"doctype": "DocField",
"fieldname": "help",
"fieldtype": "HTML",
"label": "Help",
"options": "<div class=\"alert\">Link for About Us Page is \"/about\"</div>"
},
{
"description": "Introduce your company to the website visitor.",
"doctype": "DocField",
"fieldname": "company_introduction",
"fieldtype": "Text Editor",
"label": "Company Introduction"
},
{
"doctype": "DocField",
"fieldname": "sb0",
"fieldtype": "Section Break",
"label": "Company History"
},
{
"description": "\"Company History\"",
"doctype": "DocField",
"fieldname": "company_history_heading",
"fieldtype": "Data",
"label": "Company History Heading"
},
{
"doctype": "DocField",
"fieldname": "company_history",
"fieldtype": "Table",
"label": "Company History",
"options": "Company History"
},
{
"doctype": "DocField",
"fieldname": "sb1",
"fieldtype": "Section Break",
"label": "Team Members"
},
{
"description": "\"Team Members\" or \"Management\"",
"doctype": "DocField",
"fieldname": "team_members_heading",
"fieldtype": "Data",
"label": "Team Members Heading"
},
{
"doctype": "DocField",
"fieldname": "team_members",
"fieldtype": "Table",
"label": "Team Members",
"options": "About Us Team Member"
},
{
"description": "More content for the bottom of the page.",
"doctype": "DocField",
"fieldname": "footer",
"fieldtype": "Text Editor",
"label": "Footer"
},
{
"doctype": "DocPerm"
}
]

View File

@ -1 +0,0 @@
Details of team member for About Us page.

View File

@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,52 +0,0 @@
[
{
"creation": "2013-03-07 11:55:11",
"docstatus": 0,
"modified": "2013-07-10 14:54:03",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "DocType",
"istable": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "About Us Team Member",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"doctype": "DocType",
"name": "About Us Team Member"
},
{
"doctype": "DocField",
"fieldname": "full_name",
"fieldtype": "Data",
"label": "Full Name",
"reqd": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "image_link",
"fieldtype": "Select",
"label": "Image Link",
"options": "attach_files:",
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "bio",
"fieldtype": "Small Text",
"label": "Bio",
"reqd": 1,
"width": "200px"
}
]

View File

@ -1 +0,0 @@
Blog category.

View File

@ -1,17 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def on_update(self):
# for blog footer
from webnotes.webutils import clear_cache
clear_cache()

View File

@ -1,56 +0,0 @@
[
{
"creation": "2013-03-08 09:41:11",
"docstatus": 0,
"modified": "2013-07-05 14:27:02",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"autoname": "field:category_name",
"doctype": "DocType",
"document_type": "Master",
"icon": "icon-tag",
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"fieldname": "category_name",
"fieldtype": "Data",
"label": "Category Name",
"name": "__common__",
"parent": "Blog Category",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
"reqd": 1
},
{
"doctype": "DocPerm",
"name": "__common__",
"parent": "Blog Category",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1
},
{
"doctype": "DocType",
"name": "Blog Category"
},
{
"doctype": "DocField"
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Website Manager",
"write": 1
},
{
"doctype": "DocPerm",
"role": "Blogger"
}
]

View File

@ -1 +0,0 @@
Blog post for "Blogs" section of website.

View File

@ -1,12 +0,0 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.refresh = function(doc) {
if(!doc.__islocal && doc.published && !doc.email_sent) {
cur_frm.add_custom_button('Email Subscribers', function() {
$c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
cur_frm.refresh();
});
})
}
}

View File

@ -1,69 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
import webnotes.webutils
from webnotes import _
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def autoname(self):
from webnotes.webutils import page_name
self.doc.name = page_name(self.doc.title)
def validate(self):
if self.doc.blog_intro:
self.doc.blog_intro = self.doc.blog_intro[:140]
# update posts
webnotes.conn.sql("""update tabBlogger set posts=(select count(*) from `tabBlog Post`
where ifnull(blogger,'')=tabBlogger.name)
where name=%s""", self.doc.blogger)
def on_update(self):
webnotes.webutils.update_page_name(self.doc, self.doc.title)
webnotes.webutils.delete_page_cache("writers")
def prepare_template_args(self):
import webnotes.utils
import markdown2
# this is for double precaution. usually it wont reach this code if not published
if not webnotes.utils.cint(self.doc.published):
raise Exception, "This blog has not been published yet!"
# temp fields
from webnotes.utils import global_date_format, get_fullname
self.doc.full_name = get_fullname(self.doc.owner)
self.doc.updated = global_date_format(self.doc.published_on)
self.doc.content_html = self.doc.content
if self.doc.blogger:
self.doc.blogger_info = webnotes.doc("Blogger", self.doc.blogger).fields
self.doc.description = self.doc.blog_intro or self.doc.content[:140]
self.doc.meta_description = self.doc.description
self.doc.categories = webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
self.doc.texts = {
"comments": _("Comments"),
"first_comment": _("Be the first one to comment"),
"add_comment": _("Add Comment"),
"submit": _("Submit"),
"all_posts_by": _("All posts by"),
}
comment_list = webnotes.conn.sql("""\
select comment, comment_by_fullname, creation
from `tabComment` where comment_doctype="Blog Post"
and comment_docname=%s order by creation""", self.doc.name, as_dict=1)
self.doc.comment_list = comment_list or []
for comment in self.doc.comment_list:
comment['comment_date'] = webnotes.utils.global_date_format(comment['creation'])
comment['comment'] = markdown2.markdown(comment['comment'])

View File

@ -1,135 +0,0 @@
[
{
"creation": "2013-03-28 10:35:30",
"docstatus": 0,
"modified": "2013-07-05 15:08:30",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_attach": 1,
"allow_import": 1,
"doctype": "DocType",
"icon": "icon-quote-left",
"max_attachments": 5,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "Blog Post",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"doctype": "DocPerm",
"name": "__common__",
"parent": "Blog Post",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 1,
"submit": 0
},
{
"doctype": "DocType",
"name": "Blog Post"
},
{
"doctype": "DocField",
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "published",
"fieldtype": "Check",
"label": "Published"
},
{
"doctype": "DocField",
"fieldname": "published_on",
"fieldtype": "Date",
"label": "Published On"
},
{
"doctype": "DocField",
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "blogger",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Blogger",
"options": "Blogger",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "blog_category",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Blog Category",
"options": "Blog Category"
},
{
"doctype": "DocField",
"fieldname": "section_break_5",
"fieldtype": "Section Break"
},
{
"description": "Description for listing page, in plain text, only a couple of lines. (max 140 characters)",
"doctype": "DocField",
"fieldname": "blog_intro",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Blog Intro",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "content",
"fieldtype": "Text Editor",
"label": "Content",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "page_name",
"fieldtype": "Data",
"hidden": 1,
"label": "Page Name",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "email_sent",
"fieldtype": "Check",
"hidden": 1,
"label": "Email Sent"
},
{
"create": 1,
"doctype": "DocPerm",
"role": "Website Manager",
"write": 1
},
{
"create": 1,
"doctype": "DocPerm",
"role": "Blogger",
"write": 1
},
{
"doctype": "DocPerm",
"role": "Guest",
"write": 0
}
]

View File

@ -1 +0,0 @@
Blog titles and introduction texts.

View File

@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,62 +0,0 @@
[
{
"creation": "2013-03-11 17:48:16",
"docstatus": 0,
"modified": "2013-07-05 14:27:31",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"description": "Blog Settings",
"doctype": "DocType",
"icon": "icon-cog",
"issingle": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "Blog Settings",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Blog Settings",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"role": "Website Manager",
"write": 1
},
{
"doctype": "DocType",
"name": "Blog Settings"
},
{
"doctype": "DocField",
"fieldname": "blog_title",
"fieldtype": "Data",
"label": "Blog Title"
},
{
"doctype": "DocField",
"fieldname": "blog_introduction",
"fieldtype": "Small Text",
"label": "Blog Introduction"
},
{
"doctype": "DocField",
"fieldname": "writers_introduction",
"fieldtype": "Small Text",
"label": "Writers Introduction"
},
{
"doctype": "DocPerm"
}
]

View File

@ -1 +0,0 @@
Profile of blog writer in "Blog" section.

View File

@ -1,41 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import _
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def on_update(self):
"if profile is set, then update all older blogs"
from website.helpers.blog import clear_blog_cache
clear_blog_cache()
if self.doc.profile:
for blog in webnotes.conn.sql_list("""select name from `tabBlog Post` where owner=%s
and ifnull(blogger,'')=''""", self.doc.profile):
b = webnotes.bean("Blog Post", blog)
b.doc.blogger = self.doc.name
b.save()
def get_writers_args():
bloggers = webnotes.conn.sql("""select * from `tabBlogger`
where ifnull(posts,0) > 0 and ifnull(disabled,0)=0
order by posts desc""", as_dict=1)
args = {
"bloggers": bloggers,
"texts": {
"all_posts_by": _("All posts by")
},
"categories": webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
}
args.update(webnotes.doc("Blog Settings", "Blog Settings").fields)
return args

View File

@ -1,102 +0,0 @@
[
{
"creation": "2013-03-25 16:00:51",
"docstatus": 0,
"modified": "2013-08-30 16:35:24",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_attach": 1,
"autoname": "field:short_name",
"description": "Profile of a Blogger",
"doctype": "DocType",
"document_type": "Master",
"icon": "icon-user",
"max_attachments": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "Blogger",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"doctype": "DocPerm",
"name": "__common__",
"parent": "Blogger",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"write": 1
},
{
"doctype": "DocType",
"name": "Blogger"
},
{
"doctype": "DocField",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
},
{
"description": "Will be used in url (usually first name).",
"doctype": "DocField",
"fieldname": "short_name",
"fieldtype": "Data",
"label": "Short Name",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "full_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Full Name",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "profile",
"fieldtype": "Link",
"label": "Profile",
"options": "Profile"
},
{
"doctype": "DocField",
"fieldname": "bio",
"fieldtype": "Small Text",
"label": "Bio"
},
{
"doctype": "DocField",
"fieldname": "avatar",
"fieldtype": "Select",
"label": "Avatar",
"options": "attach_files:"
},
{
"doctype": "DocField",
"fieldname": "posts",
"fieldtype": "Int",
"in_list_view": 1,
"label": "Posts",
"read_only": 1
},
{
"create": 1,
"doctype": "DocPerm",
"role": "Website Manager"
},
{
"doctype": "DocPerm",
"match": "owner:profile",
"role": "Blogger"
}
]

View File

@ -1 +0,0 @@
Company history detail for "About Us" section.

View File

@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,42 +0,0 @@
[
{
"creation": "2013-02-22 01:28:08",
"docstatus": 0,
"modified": "2013-07-10 14:54:06",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "DocType",
"istable": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "Company History",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"doctype": "DocType",
"name": "Company History"
},
{
"doctype": "DocField",
"fieldname": "year",
"fieldtype": "Data",
"label": "Year"
},
{
"doctype": "DocField",
"fieldname": "highlight",
"fieldtype": "Text",
"label": "Highlight",
"print_width": "300px",
"width": "300px"
}
]

View File

@ -1 +0,0 @@
Settings, introduction for "Contact Us" section.

View File

@ -1,24 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def onload(self):
"""load address"""
if self.doc.query_options:
self.query_options = filter(None, self.doc.query_options.replace(",", "\n").split())
else:
self.query_options = ["Sales", "Support", "General"]
if self.doc.address:
self.address = webnotes.bean("Address", self.doc.address).doc
def on_update(self):
from webnotes.webutils import clear_cache
clear_cache("contact")

View File

@ -1,82 +0,0 @@
[
{
"creation": "2013-02-21 20:12:42",
"docstatus": 0,
"modified": "2013-07-05 14:32:24",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"description": "Settings for Contact Us Page",
"doctype": "DocType",
"icon": "icon-cog",
"issingle": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "Contact Us Settings",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Contact Us Settings",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 0,
"role": "Website Manager",
"submit": 0,
"write": 1
},
{
"doctype": "DocType",
"name": "Contact Us Settings"
},
{
"doctype": "DocField",
"fieldname": "help",
"fieldtype": "HTML",
"label": "Help",
"options": "<div class=\"alert\">Link for Contact Page is \"/contact\"</div>"
},
{
"description": "Address to be displayed on the Contact Page",
"doctype": "DocField",
"fieldname": "address",
"fieldtype": "Link",
"label": "Address",
"options": "Address"
},
{
"description": "Default: \"Contact Us\"",
"doctype": "DocField",
"fieldname": "heading",
"fieldtype": "Data",
"label": "Heading"
},
{
"description": "Introductory information for the Contact Us Page",
"doctype": "DocField",
"fieldname": "introduction",
"fieldtype": "Text Editor",
"label": "Introduction"
},
{
"description": "Contact options, like \"Sales Query, Support Query\" etc each on a new line or separated by commas.",
"doctype": "DocField",
"fieldname": "query_options",
"fieldtype": "Small Text",
"label": "Query Options"
},
{
"doctype": "DocPerm"
}
]

View File

@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,36 +0,0 @@
[
{
"creation": "2013-06-20 16:00:18",
"docstatus": 0,
"modified": "2013-08-09 14:47:12",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "DocType",
"istable": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"fieldname": "selling_price_list",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Price List",
"name": "__common__",
"options": "Price List",
"parent": "Shopping Cart Price List",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
"reqd": 1
},
{
"doctype": "DocType",
"name": "Shopping Cart Price List"
},
{
"doctype": "DocField"
}
]

View File

@ -1,10 +0,0 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt
$.extend(cur_frm.cscript, {
onload: function() {
if(cur_frm.doc.__quotation_series) {
cur_frm.fields_dict.quotation_series.df.options = cur_frm.doc.__quotation_series;
}
}
});

View File

@ -1,149 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import _, msgprint
from webnotes.utils import comma_and
from webnotes.model.controller import DocListController
class ShoppingCartSetupError(webnotes.ValidationError): pass
class DocType(DocListController):
def onload(self):
self.doc.fields["__quotation_series"] = webnotes.get_doctype("Quotation").get_options("naming_series")
def validate(self):
if self.doc.enabled:
self.validate_price_lists()
self.validate_tax_masters()
self.validate_exchange_rates_exist()
def on_update(self):
webnotes.conn.set_default("shopping_cart_enabled", self.doc.fields.get("enabled") or 0)
webnotes.conn.set_default("shopping_cart_quotation_series", self.doc.fields.get("quotation_series"))
def validate_overlapping_territories(self, parentfield, fieldname):
# for displaying message
doctype = self.meta.get_field(parentfield).options
# specify atleast one entry in the table
self.validate_table_has_rows(parentfield, raise_exception=ShoppingCartSetupError)
territory_name_map = self.get_territory_name_map(parentfield, fieldname)
for territory, names in territory_name_map.items():
if len(names) > 1:
msgprint(_("Error for") + " " + _(doctype) + ": " + comma_and(names) +
" " + _("have a common territory") + ": " + territory,
raise_exception=ShoppingCartSetupError)
return territory_name_map
def validate_price_lists(self):
territory_name_map = self.validate_overlapping_territories("price_lists",
"selling_price_list")
# validate that a Shopping Cart Price List exists for the root territory
# as a catch all!
from setup.utils import get_root_of
root_territory = get_root_of("Territory")
if root_territory not in territory_name_map.keys():
msgprint(_("Please specify a Price List which is valid for Territory") +
": " + root_territory, raise_exception=ShoppingCartSetupError)
def validate_tax_masters(self):
self.validate_overlapping_territories("sales_taxes_and_charges_masters",
"sales_taxes_and_charges_master")
def get_territory_name_map(self, parentfield, fieldname):
territory_name_map = {}
# entries in table
names = [doc.fields.get(fieldname) for doc in self.doclist.get({"parentfield": parentfield})]
if names:
# for condition in territory check
parenttype = self.meta.get_field(fieldname, parentfield=parentfield).options
# to validate territory overlap
# make a map of territory: [list of names]
# if list against each territory has more than one element, raise exception
territory_name = webnotes.conn.sql("""select `territory`, `parent`
from `tabFor Territory`
where `parenttype`=%s and `parent` in (%s)""" %
("%s", ", ".join(["%s"]*len(names))), tuple([parenttype] + names))
for territory, name in territory_name:
territory_name_map.setdefault(territory, []).append(name)
if len(territory_name_map[territory]) > 1:
territory_name_map[territory].sort(key=lambda val: names.index(val))
return territory_name_map
def validate_exchange_rates_exist(self):
"""check if exchange rates exist for all Price List currencies (to company's currency)"""
company_currency = webnotes.conn.get_value("Company", self.doc.company, "default_currency")
if not company_currency:
msgprint(_("Please specify currency in Company") + ": " + self.doc.company,
raise_exception=ShoppingCartSetupError)
price_list_currency_map = webnotes.conn.get_values("Price List",
[d.selling_price_list for d in self.doclist.get({"parentfield": "price_lists"})],
"currency")
expected_to_exist = [currency + "-" + company_currency
for currency in price_list_currency_map.values()
if currency != company_currency]
if expected_to_exist:
exists = webnotes.conn.sql_list("""select name from `tabCurrency Exchange`
where name in (%s)""" % (", ".join(["%s"]*len(expected_to_exist)),),
tuple(expected_to_exist))
missing = list(set(expected_to_exist).difference(exists))
if missing:
msgprint(_("Missing Currency Exchange Rates for" + ": " + comma_and(missing)),
raise_exception=ShoppingCartSetupError)
def get_name_from_territory(self, territory, parentfield, fieldname):
name = None
territory_name_map = self.get_territory_name_map(parentfield, fieldname)
if territory_name_map.get(territory):
name = territory_name_map.get(territory)
else:
territory_ancestry = self.get_territory_ancestry(territory)
for ancestor in territory_ancestry:
if territory_name_map.get(ancestor):
name = territory_name_map.get(ancestor)
break
return name
def get_price_list(self, billing_territory):
price_list = self.get_name_from_territory(billing_territory, "price_lists", "selling_price_list")
return price_list and price_list[0] or None
def get_tax_master(self, billing_territory):
tax_master = self.get_name_from_territory(billing_territory, "sales_taxes_and_charges_masters",
"sales_taxes_and_charges_master")
return tax_master and tax_master[0] or None
def get_shipping_rules(self, shipping_territory):
return self.get_name_from_territory(shipping_territory, "shipping_rules", "shipping_rule")
def get_territory_ancestry(self, territory):
from setup.utils import get_ancestors_of
if not hasattr(self, "_territory_ancestry"):
self._territory_ancestry = {}
if not self._territory_ancestry.get(territory):
self._territory_ancestry[territory] = get_ancestors_of("Territory", territory)
return self._territory_ancestry[territory]

View File

@ -1,125 +0,0 @@
[
{
"creation": "2013-06-19 15:57:32",
"docstatus": 0,
"modified": "2013-07-15 17:33:05",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"description": "Default settings for Shopping Cart",
"doctype": "DocType",
"icon": "icon-shopping-cart",
"issingle": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"name": "__common__",
"parent": "Shopping Cart Settings",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0
},
{
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Shopping Cart Settings",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"role": "Website Manager",
"write": 1
},
{
"doctype": "DocType",
"name": "Shopping Cart Settings"
},
{
"doctype": "DocField",
"fieldname": "enabled",
"fieldtype": "Check",
"label": "Enable Shopping Cart"
},
{
"doctype": "DocField",
"fieldname": "section_break_2",
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
"options": "Company",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "default_territory",
"fieldtype": "Link",
"label": "Default Territory",
"options": "Territory",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_4",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "default_customer_group",
"fieldtype": "Link",
"label": "Default Customer Group",
"options": "Customer Group",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "quotation_series",
"fieldtype": "Select",
"label": "Quotation Series",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "section_break_6",
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "price_lists",
"fieldtype": "Table",
"label": "Shopping Cart Price Lists",
"options": "Shopping Cart Price List",
"reqd": 0
},
{
"doctype": "DocField",
"fieldname": "shipping_rules",
"fieldtype": "Table",
"label": "Shopping Cart Shipping Rules",
"options": "Shopping Cart Shipping Rule",
"reqd": 0
},
{
"doctype": "DocField",
"fieldname": "column_break_10",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "sales_taxes_and_charges_masters",
"fieldtype": "Table",
"label": "Shopping Cart Taxes and Charges Masters",
"options": "Shopping Cart Taxes and Charges Master",
"reqd": 0
},
{
"doctype": "DocPerm"
}
]

View File

@ -1,81 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
import unittest
from website.doctype.shopping_cart_settings.shopping_cart_settings import ShoppingCartSetupError
class TestShoppingCartSettings(unittest.TestCase):
def setUp(self):
webnotes.conn.sql("""delete from `tabSingles` where doctype="Shipping Cart Settings" """)
webnotes.conn.sql("""delete from `tabShopping Cart Price List`""")
webnotes.conn.sql("""delete from `tabShopping Cart Taxes and Charges Master`""")
webnotes.conn.sql("""delete from `tabShopping Cart Shipping Rule`""")
def get_cart_settings(self):
return webnotes.bean({"doctype": "Shopping Cart Settings",
"company": "_Test Company"})
def test_price_list_territory_overlap(self):
cart_settings = self.get_cart_settings()
def _add_price_list(price_list):
cart_settings.doclist.append({
"doctype": "Shopping Cart Price List",
"parentfield": "price_lists",
"selling_price_list": price_list
})
for price_list in ("_Test Price List Rest of the World", "_Test Price List India",
"_Test Price List"):
_add_price_list(price_list)
controller = cart_settings.make_controller()
controller.validate_overlapping_territories("price_lists", "selling_price_list")
_add_price_list("_Test Price List 2")
controller = cart_settings.make_controller()
self.assertRaises(ShoppingCartSetupError, controller.validate_overlapping_territories,
"price_lists", "selling_price_list")
return cart_settings
def test_taxes_territory_overlap(self):
cart_settings = self.get_cart_settings()
def _add_tax_master(tax_master):
cart_settings.doclist.append({
"doctype": "Shopping Cart Taxes and Charges Master",
"parentfield": "sales_taxes_and_charges_masters",
"sales_taxes_and_charges_master": tax_master
})
for tax_master in ("_Test Sales Taxes and Charges Master", "_Test India Tax Master"):
_add_tax_master(tax_master)
controller = cart_settings.make_controller()
controller.validate_overlapping_territories("sales_taxes_and_charges_masters",
"sales_taxes_and_charges_master")
_add_tax_master("_Test Sales Taxes and Charges Master 2")
controller = cart_settings.make_controller()
self.assertRaises(ShoppingCartSetupError, controller.validate_overlapping_territories,
"sales_taxes_and_charges_masters", "sales_taxes_and_charges_master")
def test_exchange_rate_exists(self):
webnotes.conn.sql("""delete from `tabCurrency Exchange`""")
cart_settings = self.test_price_list_territory_overlap()
controller = cart_settings.make_controller()
self.assertRaises(ShoppingCartSetupError, controller.validate_exchange_rates_exist)
from setup.doctype.currency_exchange.test_currency_exchange import test_records as \
currency_exchange_records
webnotes.bean(currency_exchange_records[0]).insert()
controller.validate_exchange_rates_exist()

View File

@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,36 +0,0 @@
[
{
"creation": "2013-07-03 13:15:34",
"docstatus": 0,
"modified": "2013-07-10 14:54:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "DocType",
"istable": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"fieldname": "shipping_rule",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Shipping Rule",
"name": "__common__",
"options": "Shipping Rule",
"parent": "Shopping Cart Shipping Rule",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
"reqd": 1
},
{
"doctype": "DocType",
"name": "Shopping Cart Shipping Rule"
},
{
"doctype": "DocField"
}
]

View File

@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -1,36 +0,0 @@
[
{
"creation": "2013-06-20 16:57:03",
"docstatus": 0,
"modified": "2013-07-10 14:54:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "DocType",
"istable": 1,
"module": "Website",
"name": "__common__"
},
{
"doctype": "DocField",
"fieldname": "sales_taxes_and_charges_master",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Tax Master",
"name": "__common__",
"options": "Sales Taxes and Charges Master",
"parent": "Shopping Cart Taxes and Charges Master",
"parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
"reqd": 1
},
{
"doctype": "DocType",
"name": "Shopping Cart Taxes and Charges Master"
},
{
"doctype": "DocField"
}
]

View File

@ -1,6 +0,0 @@
Style settings for website. Includes settings for:
- Site colours (background, toolbars)
- Fonts (family and size)
- Background (image if any)
- Custom CSS

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

Some files were not shown because too many files have changed in this diff Show More