[website] [minor] moving to framework
This commit is contained in:
parent
46089dbc97
commit
c59c4e0699
14
config.json
14
config.json
@ -102,7 +102,7 @@
|
||||
"order": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/sale",
|
||||
"args_method": "website.helpers.transaction.get_order_args",
|
||||
"args_method": "utilities.website_transactions.get_order_args",
|
||||
"portal": {
|
||||
"doctype": "Sales Order",
|
||||
"conditions": {
|
||||
@ -113,12 +113,12 @@
|
||||
"orders": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/sales_transactions",
|
||||
"args_method": "website.helpers.transaction.order_list_args"
|
||||
"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",
|
||||
"args_method": "utilities.website_transactions.get_invoice_args",
|
||||
"portal": {
|
||||
"doctype": "Sales Invoice",
|
||||
"conditions": {
|
||||
@ -129,12 +129,12 @@
|
||||
"invoices": {
|
||||
"no_cache": true,
|
||||
"template": "app/website/templates/pages/sales_transactions",
|
||||
"args_method": "website.helpers.transaction.invoice_list_args"
|
||||
"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",
|
||||
"args_method": "utilities.website_transactions.get_shipment_args",
|
||||
"portal": {
|
||||
"doctype": "Delivery Note",
|
||||
"conditions": {
|
||||
@ -145,7 +145,7 @@
|
||||
"shipments": {
|
||||
"no_cache": true,
|
||||
"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": {
|
||||
"template": "app/website/templates/pages/product_search"
|
||||
@ -160,7 +160,7 @@
|
||||
},
|
||||
"tickets": {
|
||||
"template": "app/website/templates/pages/tickets",
|
||||
"args_method": "website.helpers.transaction.ticket_list_args"
|
||||
"args_method": "utilities.website_transactions.ticket_list_args"
|
||||
},
|
||||
"address": {
|
||||
"no_cache": true,
|
||||
|
@ -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"
|
||||
]
|
17
patches/september_2013/p03_move_website_to_framework.py
Normal file
17
patches/september_2013/p03_move_website_to_framework.py
Normal 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
|
||||
|
@ -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,
|
||||
|
@ -6,7 +6,7 @@ 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 selling.utils.cart import _get_cart_quotation
|
||||
|
||||
@webnotes.whitelist(allow_guest=True)
|
||||
def get_product_info(item_code):
|
@ -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
|
||||
@ -45,7 +45,7 @@ class DocType(DocTypeNestedSet):
|
||||
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, \
|
||||
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
|
||||
|
@ -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):
|
||||
|
@ -71,14 +71,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
|
||||
|
@ -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)
|
||||
|
||||
@ -259,7 +259,7 @@ class DocType(DocListController):
|
||||
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
|
||||
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
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
@ -14,6 +14,7 @@ $(document).ready(function() {
|
||||
.parent().append("<div class='alert alert-warning'>Comments are closed.</div>")
|
||||
}
|
||||
$(".add-comment").click(function() {
|
||||
$(this).toggle(false);
|
||||
$("#comment-form").toggle();
|
||||
$("#comment-form input, #comment-form, textarea").val("");
|
||||
})
|
||||
|
@ -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 = "";
|
||||
|
@ -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
|
||||
|
@ -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 }}"
|
||||
},
|
||||
|
@ -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) {
|
||||
|
@ -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");
|
||||
|
@ -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 %}
|
Loading…
x
Reference in New Issue
Block a user