[website] [minor] moving to framework

This commit is contained in:
Rushabh Mehta 2013-09-09 12:17:45 +05:30
parent 46089dbc97
commit c59c4e0699
40 changed files with 49 additions and 61 deletions

View File

@ -102,7 +102,7 @@
"order": { "order": {
"no_cache": true, "no_cache": true,
"template": "app/website/templates/pages/sale", "template": "app/website/templates/pages/sale",
"args_method": "website.helpers.transaction.get_order_args", "args_method": "utilities.website_transactions.get_order_args",
"portal": { "portal": {
"doctype": "Sales Order", "doctype": "Sales Order",
"conditions": { "conditions": {
@ -113,12 +113,12 @@
"orders": { "orders": {
"no_cache": true, "no_cache": true,
"template": "app/website/templates/pages/sales_transactions", "template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.order_list_args" "args_method": "utilities.website_transactions.order_list_args"
}, },
"invoice": { "invoice": {
"no_cache": true, "no_cache": true,
"template": "app/website/templates/pages/sale", "template": "app/website/templates/pages/sale",
"args_method": "website.helpers.transaction.get_invoice_args", "args_method": "utilities.website_transactions.get_invoice_args",
"portal": { "portal": {
"doctype": "Sales Invoice", "doctype": "Sales Invoice",
"conditions": { "conditions": {
@ -129,12 +129,12 @@
"invoices": { "invoices": {
"no_cache": true, "no_cache": true,
"template": "app/website/templates/pages/sales_transactions", "template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.invoice_list_args" "args_method": "utilities.website_transactions.invoice_list_args"
}, },
"shipment": { "shipment": {
"no_cache": true, "no_cache": true,
"template": "app/website/templates/pages/sale", "template": "app/website/templates/pages/sale",
"args_method": "website.helpers.transaction.get_shipment_args", "args_method": "utilities.website_transactions.get_shipment_args",
"portal": { "portal": {
"doctype": "Delivery Note", "doctype": "Delivery Note",
"conditions": { "conditions": {
@ -145,7 +145,7 @@
"shipments": { "shipments": {
"no_cache": true, "no_cache": true,
"template": "app/website/templates/pages/sales_transactions", "template": "app/website/templates/pages/sales_transactions",
"args_method": "website.helpers.transaction.shipment_list_args" "args_method": "utilities.website_transactions.shipment_list_args"
}, },
"product_search": { "product_search": {
"template": "app/website/templates/pages/product_search" "template": "app/website/templates/pages/product_search"
@ -160,7 +160,7 @@
}, },
"tickets": { "tickets": {
"template": "app/website/templates/pages/tickets", "template": "app/website/templates/pages/tickets",
"args_method": "website.helpers.transaction.ticket_list_args" "args_method": "utilities.website_transactions.ticket_list_args"
}, },
"address": { "address": {
"no_cache": true, "no_cache": true,

View File

@ -263,4 +263,5 @@ patch_list = [
"patches.september_2013.p01_update_communication", "patches.september_2013.p01_update_communication",
"execute:webnotes.reload_doc('setup', 'doctype', 'features_setup') # 2013-09-05", "execute:webnotes.reload_doc('setup', 'doctype', 'features_setup') # 2013-09-05",
"patches.september_2013.p02_fix_serial_no_status", "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
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)
# TODO remove website folder

View File

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

View File

@ -6,7 +6,7 @@ from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.utils import cstr, cint, fmt_money from webnotes.utils import cstr, cint, fmt_money
from webnotes.webutils import build_html, delete_page_cache from webnotes.webutils import build_html, delete_page_cache
from website.helpers.cart import _get_cart_quotation from selling.utils.cart import _get_cart_quotation
@webnotes.whitelist(allow_guest=True) @webnotes.whitelist(allow_guest=True)
def get_product_info(item_code): def get_product_info(item_code):

View File

@ -18,7 +18,7 @@ class DocType(DocTypeNestedSet):
self.validate_name_with_item() 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: if self.doc.show_in_website:
from webnotes.webutils import update_page_name from webnotes.webutils import update_page_name
@ -45,7 +45,7 @@ class DocType(DocTypeNestedSet):
item group name or rename the item" % self.doc.name, raise_exception=1) item group name or rename the item" % self.doc.name, raise_exception=1)
def prepare_template_args(self): def prepare_template_args(self):
from website.helpers.product import get_product_list_for_group, \ from selling.utils.product import get_product_list_for_group, \
get_parent_item_groups, get_group_item_count get_parent_item_groups, get_group_item_count
self.doc.sub_groups = webnotes.conn.sql("""select name, page_name self.doc.sub_groups = webnotes.conn.sql("""select name, page_name

View File

@ -31,7 +31,7 @@ def on_login_post_session(login_manager):
webnotes.conn.commit() webnotes.conn.commit()
if webnotes.conn.get_value("Profile", webnotes.session.user, "user_type") == "Website User": 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() set_cart_count()
def on_logout(login_manager): def on_logout(login_manager):

View File

@ -71,14 +71,14 @@ def update_template_args(page_name, args):
@webnotes.whitelist() @webnotes.whitelist()
def update_profile(fullname, password=None, company_name=None, mobile_no=None, phone=None): 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) update_party(fullname, company_name, mobile_no, phone)
from core.doctype.profile import profile from core.doctype.profile import profile
return profile.update_profile(fullname, password) return profile.update_profile(fullname, password)
def get_profile_args(): 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() party = get_lead_or_customer()
if party.doctype == "Lead": if party.doctype == "Lead":
mobile_no = party.mobile_no mobile_no = party.mobile_no

View File

@ -228,7 +228,7 @@ class DocType(DocListController):
def update_website(self): def update_website(self):
def _invalidate_cache(): 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) invalidate_cache_for(self.doc.item_group)
@ -259,7 +259,7 @@ class DocType(DocListController):
return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") } return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") }
def prepare_template_args(self): def prepare_template_args(self):
from website.helpers.product import get_parent_item_groups 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.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
self.doc.title = self.doc.item_name self.doc.title = self.doc.item_name

View File

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

View File

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

View File

@ -14,6 +14,7 @@ $(document).ready(function() {
.parent().append("<div class='alert alert-warning'>Comments are closed.</div>") .parent().append("<div class='alert alert-warning'>Comments are closed.</div>")
} }
$(".add-comment").click(function() { $(".add-comment").click(function() {
$(this).toggle(false);
$("#comment-form").toggle(); $("#comment-form").toggle();
$("#comment-form input, #comment-form, textarea").val(""); $("#comment-form input, #comment-form, textarea").val("");
}) })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,31 +0,0 @@
{% extends "app/website/templates/html/transactions.html" %}
{% block javascript -%}
{{ super() }}
var render = function(doc) {
doc.sender = doc.sender ? doc.sender : "To ";
doc.recipients = doc.recipients ? (" to " + doc.recipients) : "";
doc.content = remove_script_and_style(doc.content);
if(!is_html(doc.content)) {
doc.content = doc.content.replace("\n", "<br>");
}
$(repl('<a class="list-group-item">\
<div class="row col-md-12">%(subject)s</div>\
<div class="row text-muted">\
<div class="col-md-6">%(sender)s%(recipients)s</div>\
<div class="col-md-6 text-right">%(creation)s</div>\
</div>\
<div class="row col-md-12 msg-content" style="display: none;"><hr>%(content)s</div>\
</a>', doc))
.appendTo($list)
.on("click", function() {
$(this).find(".msg-content").toggle();
});
}
{%- endblock %}