mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
135
accounts/Print Format/SalesInvoice/SalesInvoice.html
Normal file
135
accounts/Print Format/SalesInvoice/SalesInvoice.html
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
{%- if doc.letter_head -%}
|
||||||
|
{{ webnotes.conn.get_value("Letter Head", doc.letter_head, "content") }}
|
||||||
|
{%- endif -%}
|
||||||
|
<!-- Page Layout Settings -->
|
||||||
|
<div class='common page-header'>
|
||||||
|
<table class='header-table' cellspacing=0>
|
||||||
|
<thead>
|
||||||
|
<tr><td colspan="2"><h1>{{ doc.select_print_heading or 'Invoice' }}</h1></td></tr>
|
||||||
|
<tr><td colspan="2"><h3>{{ doc.name }}</h3></td></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td width=60%><table width=100% cellspacing=0><tbody>
|
||||||
|
<tr>
|
||||||
|
<td width=39%><b>Name</b></td>
|
||||||
|
<td>{{ doc.customer_name }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b>Address</b></td>
|
||||||
|
<td>{{ doc.address_display.replace("\n", "<br>") }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><b>Contact</b></td>
|
||||||
|
<td>{{ doc.contact_display }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody></table></td>
|
||||||
|
<td><table width=100% cellspacing=0><tbody>
|
||||||
|
<tr>
|
||||||
|
<td width=40%><b>Invoice Date</b></td>
|
||||||
|
<td>{{ utils.formatdate(doc.posting_date) }}</td>
|
||||||
|
<tr>
|
||||||
|
{%- if doc.convert_into_recurring_invoice and doc.recurring_id -%}
|
||||||
|
<tr>
|
||||||
|
<td width=40%><b>Invoice Period</b></td>
|
||||||
|
<td>{{ (utils.formatdate(doc.invoice_period_from_date)) +
|
||||||
|
' to ' + utils.formatdate(doc.invoice_period_to_date) }}</td>
|
||||||
|
<tr>
|
||||||
|
{%- endif -%}
|
||||||
|
<tr>
|
||||||
|
<td><b>Due Date</b></td>
|
||||||
|
<td>{{ utils.formatdate(doc.due_date) }}</td>
|
||||||
|
<tr>
|
||||||
|
</tbody></table></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class='common page-body'>
|
||||||
|
<!--
|
||||||
|
Page Body will contain
|
||||||
|
+ table 2
|
||||||
|
- Sales Invoice Data
|
||||||
|
-->
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Sr</th>
|
||||||
|
<th>Item Name</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Qty</th>
|
||||||
|
<th>UoM</th>
|
||||||
|
<th>Basic Rate</th>
|
||||||
|
<th>Amount</th>
|
||||||
|
</tr>
|
||||||
|
{%- for row in doclist.get({"doctype":"Sales Invoice Item"}) %}
|
||||||
|
<tr>
|
||||||
|
<td style="width: 3%;">{{ row.idx }}</td>
|
||||||
|
<td style="width: 20%;">{{ row.item_name }}</td>
|
||||||
|
<td style="width: 37%;">{{ row.description }}</td>
|
||||||
|
<td style="width: 5%; text-align: right;">{{ row.qty }}</td>
|
||||||
|
<td style="width: 5%;">{{ row.stock_uom }}</td>
|
||||||
|
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_rate, currency=doc.currency) }}</td>
|
||||||
|
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_amount, currency=doc.currency) }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor -%}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class='common page-footer'>
|
||||||
|
<!--
|
||||||
|
Page Footer will contain
|
||||||
|
+ table 3
|
||||||
|
- Terms and Conditions
|
||||||
|
- Total Rounded Amount Calculation
|
||||||
|
- Total Rounded Amount in Words
|
||||||
|
-->
|
||||||
|
<table class='footer-table' width=100% cellspacing=0>
|
||||||
|
<thead>
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td width=60% style='padding-right: 10px;'>
|
||||||
|
<b>Terms, Conditions & Other Information:</b><br />
|
||||||
|
{{ doc.terms }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<table cellspacing=0 width=100%>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Net Total</td>
|
||||||
|
<td width=40% style="text-align: right;">{{
|
||||||
|
utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency)
|
||||||
|
}}</td>
|
||||||
|
</tr>
|
||||||
|
{%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}
|
||||||
|
{%- if not charge.included_in_print_rate -%}
|
||||||
|
<tr>
|
||||||
|
<td>{{ charge.description }}</td>
|
||||||
|
<td style="text-align: right;">{{ utils.fmt_money(charge.tax_amount / doc.conversion_rate, currency=doc.currency) }}</td>
|
||||||
|
</tr>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
<tr>
|
||||||
|
<td>Grand Total</td>
|
||||||
|
<td style="text-align: right;">{{ utils.fmt_money(doc.grand_total_export, currency=doc.currency) }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr style='font-weight: bold'>
|
||||||
|
<td>Rounded Total</td>
|
||||||
|
<td style="text-align: right;">{{ utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br /><b>In Words</b><br />
|
||||||
|
<i>{{ doc.in_words_export }}</i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
20
accounts/Print Format/SalesInvoice/SalesInvoice.txt
Normal file
20
accounts/Print Format/SalesInvoice/SalesInvoice.txt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"creation": "2013-03-21 15:24:28",
|
||||||
|
"docstatus": 0,
|
||||||
|
"modified": "2013-03-21 15:26:21",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"owner": "Administrator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doc_type": "Sales Invoice",
|
||||||
|
"doctype": "Print Format",
|
||||||
|
"module": "Accounts",
|
||||||
|
"name": "__common__",
|
||||||
|
"standard": "Yes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Print Format",
|
||||||
|
"name": "SalesInvoice"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -7,7 +7,8 @@
|
|||||||
"app/public/js/startup.css"
|
"app/public/js/startup.css"
|
||||||
],
|
],
|
||||||
"public/js/all-web.min.js": [
|
"public/js/all-web.min.js": [
|
||||||
"app/public/js/website_utils.js"
|
"app/public/js/website_utils.js",
|
||||||
|
"lib/public/js/wn/misc/number_format.js"
|
||||||
],
|
],
|
||||||
"public/js/all-app.min.js": [
|
"public/js/all-app.min.js": [
|
||||||
"app/public/js/startup.js",
|
"app/public/js/startup.js",
|
||||||
|
|||||||
@@ -1,36 +1,88 @@
|
|||||||
|
|
||||||
var erpnext = {};
|
var erpnext = {};
|
||||||
|
var wn = {};
|
||||||
|
|
||||||
|
// Add / update a new Lead / Communication
|
||||||
// subject, sender, description
|
// subject, sender, description
|
||||||
erpnext.send_message = function(opts) {
|
erpnext.send_message = function(opts) {
|
||||||
|
wn.call({
|
||||||
|
type: "POST",
|
||||||
|
method: "website.helpers.contact.send_message",
|
||||||
|
args: opts,
|
||||||
|
callback: opts.callback
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
wn.call = function(opts) {
|
||||||
if(opts.btn) {
|
if(opts.btn) {
|
||||||
|
var $spinner = $('<img src="lib/images/ui/button-load.gif">').appendTo($(opts.btn).parent())
|
||||||
$(opts.btn).attr("disabled", "disabled");
|
$(opts.btn).attr("disabled", "disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(opts.msg) {
|
||||||
|
$(opts.msg).toggle(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get or post?
|
||||||
|
if(!opts.args._type) {
|
||||||
|
opts.args._type = opts.type || "GET";
|
||||||
|
}
|
||||||
|
|
||||||
|
// method
|
||||||
|
if(opts.method) {
|
||||||
|
opts.args.cmd = opts.method;
|
||||||
|
}
|
||||||
|
|
||||||
|
// stringify
|
||||||
|
$.each(opts.args, function(key, val) {
|
||||||
|
if(typeof val != "string") {
|
||||||
|
opts.args[key] = JSON.stringify(val);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "server.py",
|
url: "server.py",
|
||||||
data: {
|
data: opts.args,
|
||||||
cmd: "website.helpers.contact.send_message",
|
|
||||||
subject: opts.subject,
|
|
||||||
sender: opts.sender,
|
|
||||||
status: opts.status,
|
|
||||||
_type: "POST",
|
|
||||||
message: typeof opts.message == "string"
|
|
||||||
? opts.message
|
|
||||||
: JSON.stringify(opts.message)
|
|
||||||
},
|
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if(opts.btn) {
|
if(opts.btn) {
|
||||||
$(opts.btn).attr("disabled", false);
|
$(opts.btn).attr("disabled", false);
|
||||||
|
$spinner.remove();
|
||||||
|
}
|
||||||
|
if(data.exc) {
|
||||||
|
console.log(data.exc);
|
||||||
|
}
|
||||||
|
if(opts.msg && data.message) {
|
||||||
|
$(opts.msg).html(data.message).toggle(true);
|
||||||
}
|
}
|
||||||
if(opts.callback)
|
if(opts.callback)
|
||||||
opts.callback(data);
|
opts.callback(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup the user tools
|
||||||
|
//
|
||||||
|
$(document).ready(function() {
|
||||||
|
// update login
|
||||||
|
var full_name = getCookie("full_name");
|
||||||
|
if(full_name) {
|
||||||
|
$("#user-tools").html(repl('<a href="profile" title="My Profile" id="user-full-name">%(full_name)s</a> | \
|
||||||
|
<a href="account" title="My Account">My Account</a> | \
|
||||||
|
<!--<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i> (%(count)s)</a> | -->\
|
||||||
|
<a href="server.py?cmd=web_logout" title="Sign Out"><i class="icon-signout"></i></a>', {
|
||||||
|
full_name: full_name,
|
||||||
|
count: getCookie("cart_count") || "0"
|
||||||
|
}));
|
||||||
|
$("#user-tools a").tooltip({"placement":"bottom"});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Utility functions
|
||||||
|
|
||||||
function valid_email(id) {
|
function valid_email(id) {
|
||||||
if(id.toLowerCase().search("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")==-1)
|
if(id.toLowerCase().search("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")==-1)
|
||||||
return 0; else return 1; }
|
return 0; else return 1; }
|
||||||
@@ -55,3 +107,58 @@ function repl(s, dict) {
|
|||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function replace_all(s, t1, t2) {
|
||||||
|
return s.split(t1).join(t2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookie(name) {
|
||||||
|
return getCookies()[name];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookies() {
|
||||||
|
var c = document.cookie, v = 0, cookies = {};
|
||||||
|
if (document.cookie.match(/^\s*\$Version=(?:"1"|1);\s*(.*)/)) {
|
||||||
|
c = RegExp.$1;
|
||||||
|
v = 1;
|
||||||
|
}
|
||||||
|
if (v === 0) {
|
||||||
|
c.split(/[,;]/).map(function(cookie) {
|
||||||
|
var parts = cookie.split(/=/, 2),
|
||||||
|
name = decodeURIComponent(parts[0].trimLeft()),
|
||||||
|
value = parts.length > 1 ? decodeURIComponent(parts[1].trimRight()) : null;
|
||||||
|
if(value.charAt(0)==='"') {
|
||||||
|
value = value.substr(1, value.length-2);
|
||||||
|
}
|
||||||
|
cookies[name] = value;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
c.match(/(?:^|\s+)([!#$%&'*+\-.0-9A-Z^`a-z|~]+)=([!#$%&'*+\-.0-9A-Z^`a-z|~]*|"(?:[\x20-\x7E\x80\xFF]|\\[\x00-\x7F])*")(?=\s*[,;]|$)/g).map(function($0, $1) {
|
||||||
|
var name = $0,
|
||||||
|
value = $1.charAt(0) === '"'
|
||||||
|
? $1.substr(1, -1).replace(/\\(.)/g, "$1")
|
||||||
|
: $1;
|
||||||
|
cookies[name] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return cookies;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof String.prototype.trimLeft !== "function") {
|
||||||
|
String.prototype.trimLeft = function() {
|
||||||
|
return this.replace(/^\s+/, "");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (typeof String.prototype.trimRight !== "function") {
|
||||||
|
String.prototype.trimRight = function() {
|
||||||
|
return this.replace(/\s+$/, "");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (typeof Array.prototype.map !== "function") {
|
||||||
|
Array.prototype.map = function(callback, thisArg) {
|
||||||
|
for (var i=0, n=this.length, a=[]; i<n; i++) {
|
||||||
|
if (i in this) a[i] = callback.call(thisArg, this[i]);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@@ -310,7 +310,8 @@ cur_frm.cscript.barcode = function(doc, cdt, cdn) {
|
|||||||
var callback = function(r, rt) {
|
var callback = function(r, rt) {
|
||||||
cur_frm.cscript.item_code(doc, cdt, cdn);
|
cur_frm.cscript.item_code(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
get_server_fields('get_barcode_details', d.barcode, cur_frm.cscript.fname, doc, cdt, cdn, 1, callback);
|
get_server_fields('get_barcode_details', d.barcode, cur_frm.cscript.fname,
|
||||||
|
doc, cdt, cdn, 1, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field('batch_no').get_query =
|
cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field('batch_no').get_query =
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
import webnotes.utils
|
||||||
|
import json
|
||||||
|
|
||||||
from webnotes.utils import cstr, flt, getdate
|
from webnotes.utils import cstr, flt, getdate
|
||||||
from webnotes.model.bean import getlist
|
from webnotes.model.bean import getlist
|
||||||
@@ -353,3 +355,51 @@ class DocType(SellingController):
|
|||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def get_orders():
|
||||||
|
# find customer id
|
||||||
|
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
|
||||||
|
"customer")
|
||||||
|
|
||||||
|
if customer:
|
||||||
|
orders = webnotes.conn.sql("""select
|
||||||
|
name, creation, currency from `tabSales Order`
|
||||||
|
where customer=%s
|
||||||
|
and docstatus=1
|
||||||
|
order by creation desc
|
||||||
|
limit 20
|
||||||
|
""", customer, as_dict=1)
|
||||||
|
for order in orders:
|
||||||
|
order.items = webnotes.conn.sql("""select
|
||||||
|
item_name, qty, export_rate, export_amount, delivered_qty, stock_uom
|
||||||
|
from `tabSales Order Item`
|
||||||
|
where parent=%s
|
||||||
|
order by idx""", order.name, as_dict=1)
|
||||||
|
return orders
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
|
||||||
|
def get_website_args():
|
||||||
|
customer = webnotes.conn.get_value("Contact", {"email_id": webnotes.session.user},
|
||||||
|
"customer")
|
||||||
|
bean = webnotes.bean("Sales Order", webnotes.form_dict.name)
|
||||||
|
if bean.doc.customer != customer:
|
||||||
|
return {
|
||||||
|
"doc": {"name": "Not Allowed"}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return {
|
||||||
|
"doc": bean.doc,
|
||||||
|
"doclist": bean.doclist,
|
||||||
|
"webnotes": webnotes,
|
||||||
|
"utils": webnotes.utils
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_currency_and_number_format():
|
||||||
|
return {
|
||||||
|
"global_number_format": webnotes.conn.get_default("number_format") or "#,###.##",
|
||||||
|
"currency": webnotes.conn.get_default("currency"),
|
||||||
|
"currency_symbols": json.dumps(dict(webnotes.conn.sql("""select name, symbol
|
||||||
|
from tabCurrency where ifnull(enabled,0)=1""")))
|
||||||
|
}
|
||||||
@@ -61,7 +61,7 @@ def dropbox_callback(oauth_token=None, not_approved=False):
|
|||||||
webnotes.response['page_name'] = 'message.html'
|
webnotes.response['page_name'] = 'message.html'
|
||||||
|
|
||||||
def backup_to_dropbox():
|
def backup_to_dropbox():
|
||||||
from dropbox import client, session, rest
|
from dropbox import client, session
|
||||||
from conf import dropbox_access_key, dropbox_secret_key
|
from conf import dropbox_access_key, dropbox_secret_key
|
||||||
from webnotes.utils.backups import new_backup
|
from webnotes.utils.backups import new_backup
|
||||||
if not webnotes.conn:
|
if not webnotes.conn:
|
||||||
@@ -97,13 +97,14 @@ def get_dropbox_session():
|
|||||||
from dropbox import session
|
from dropbox import session
|
||||||
try:
|
try:
|
||||||
from conf import dropbox_access_key, dropbox_secret_key
|
from conf import dropbox_access_key, dropbox_secret_key
|
||||||
except ImportError, e:
|
except ImportError:
|
||||||
webnotes.msgprint(_("Please set Dropbox access keys in") + " conf.py",
|
webnotes.msgprint(_("Please set Dropbox access keys in") + " conf.py",
|
||||||
raise_exception=True)
|
raise_exception=True)
|
||||||
sess = session.DropboxSession(dropbox_access_key, dropbox_secret_key, "app_folder")
|
sess = session.DropboxSession(dropbox_access_key, dropbox_secret_key, "app_folder")
|
||||||
return sess
|
return sess
|
||||||
|
|
||||||
def upload_file_to_dropbox(filename, folder, dropbox_client):
|
def upload_file_to_dropbox(filename, folder, dropbox_client):
|
||||||
|
from dropbox import rest
|
||||||
size = os.stat(filename).st_size
|
size = os.stat(filename).st_size
|
||||||
f = open(filename,'r')
|
f = open(filename,'r')
|
||||||
if size > 4194304:
|
if size > 4194304:
|
||||||
@@ -111,11 +112,11 @@ def upload_file_to_dropbox(filename, folder, dropbox_client):
|
|||||||
while uploader.offset < size:
|
while uploader.offset < size:
|
||||||
try:
|
try:
|
||||||
uploader.upload_chunked()
|
uploader.upload_chunked()
|
||||||
uploader.finish(os.path.join(folder, os.path.basename(filename)), overwrite='True')
|
uploader.finish(os.path.join(folder, os.path.basename(filename)), overwrite=True)
|
||||||
except rest.ErrorResponse, e:
|
except rest.ErrorResponse:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
response = dropbox_client.put_file(os.path.join(folder, os.path.basename(filename)), f, overwrite=True)
|
dropbox_client.put_file(os.path.join(folder, os.path.basename(filename)), f, overwrite=True)
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
backup_to_dropbox()
|
backup_to_dropbox()
|
||||||
@@ -11,12 +11,11 @@
|
|||||||
# gdrive_client_secret
|
# gdrive_client_secret
|
||||||
|
|
||||||
import httplib2
|
import httplib2
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import webnotes
|
import webnotes
|
||||||
import oauth2client.client
|
import oauth2client.client
|
||||||
from webnotes.utils import get_request_site_address, get_base_path
|
from webnotes.utils import get_base_path
|
||||||
from webnotes import _, msgprint
|
from webnotes import _, msgprint
|
||||||
from apiclient.discovery import build
|
from apiclient.discovery import build
|
||||||
from apiclient.http import MediaFileUpload
|
from apiclient.http import MediaFileUpload
|
||||||
@@ -53,7 +52,7 @@ def backup_to_gdrive():
|
|||||||
from webnotes.utils.backups import new_backup
|
from webnotes.utils.backups import new_backup
|
||||||
if not webnotes.conn:
|
if not webnotes.conn:
|
||||||
webnotes.connect()
|
webnotes.connect()
|
||||||
flow = get_gdrive_flow()
|
get_gdrive_flow()
|
||||||
credentials_json = webnotes.conn.get_value("Backup Manager", None, "gdrive_credentials")
|
credentials_json = webnotes.conn.get_value("Backup Manager", None, "gdrive_credentials")
|
||||||
credentials = oauth2client.client.Credentials.new_from_json(credentials_json)
|
credentials = oauth2client.client.Credentials.new_from_json(credentials_json)
|
||||||
http = httplib2.Http()
|
http = httplib2.Http()
|
||||||
@@ -101,11 +100,6 @@ def get_gdrive_flow():
|
|||||||
webnotes.msgprint(_("Please set Google Drive access keys in") + " conf.py",
|
webnotes.msgprint(_("Please set Google Drive access keys in") + " conf.py",
|
||||||
raise_exception=True)
|
raise_exception=True)
|
||||||
|
|
||||||
#callback_url = get_request_site_address(True) \
|
|
||||||
# + "?cmd=setup.doctype.backup_manager.backup_googledrive.googledrive_callback"
|
|
||||||
|
|
||||||
# for installed apps since google does not support subdomains
|
|
||||||
|
|
||||||
flow = OAuth2WebServerFlow(conf.gdrive_client_id, conf.gdrive_client_secret,
|
flow = OAuth2WebServerFlow(conf.gdrive_client_id, conf.gdrive_client_secret,
|
||||||
"https://www.googleapis.com/auth/drive", 'urn:ietf:wg:oauth:2.0:oob')
|
"https://www.googleapis.com/auth/drive", 'urn:ietf:wg:oauth:2.0:oob')
|
||||||
return flow
|
return flow
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _
|
from webnotes import _
|
||||||
from backup_dropbox import dropbox_callback, get_dropbox_session, get_dropbox_authorize_url
|
|
||||||
from backup_googledrive import gdrive_callback, get_gdrive_flow, get_gdrive_authorize_url
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
|
|||||||
@@ -1,99 +1,7 @@
|
|||||||
# Please edit this list and import only required elements
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import set_default
|
|
||||||
from webnotes.model import db_exists
|
|
||||||
from webnotes.model.doc import Document
|
|
||||||
from webnotes.model.bean import copy_doclist
|
|
||||||
from webnotes.model.code import get_obj
|
|
||||||
from webnotes import msgprint
|
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self,doc,doclist=[]):
|
def __init__(self,doc,doclist=[]):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
def enable_login(self,arg):
|
|
||||||
arg = eval(arg)
|
|
||||||
sql("update tabContact set disable_login = 'No' where name=%s",arg['contact'])
|
|
||||||
sql("update tabProfile set enabled=1 where name=%s",arg['email'])
|
|
||||||
|
|
||||||
def disable_login(self,arg):
|
|
||||||
arg = eval(arg)
|
|
||||||
sql("update tabContact set disable_login = 'Yes' where name=%s",arg['contact'])
|
|
||||||
sql("update tabProfile set enabled=0 where name=%s",arg['email'])
|
|
||||||
|
|
||||||
def create_login(self,arg):
|
|
||||||
arg = eval(arg)
|
|
||||||
cont_det = sql("select * from tabContact where name=%s",(arg['contact']),as_dict=1)
|
|
||||||
if cont_det[0]['docstatus'] !=0:
|
|
||||||
msgprint('Please save the corresponding contact first')
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
if sql("select name from tabProfile where name=%s",cont_det[0]['email_id']):
|
|
||||||
msgprint('Profile with same name already exist.')
|
|
||||||
raise Exception
|
|
||||||
else:
|
|
||||||
p = Document('Profile')
|
|
||||||
p.name = cont_det[0]['email_id']
|
|
||||||
p.first_name = cont_det[0]['first_name']
|
|
||||||
p.last_name = cont_det[0]['last_name']
|
|
||||||
p.email = cont_det[0]['email_id']
|
|
||||||
p.cell_no = cont_det[0]['contact_no']
|
|
||||||
p.password = 'password'
|
|
||||||
p.enabled = 1
|
|
||||||
p.user_type = 'Partner';
|
|
||||||
p.save(1)
|
|
||||||
|
|
||||||
get_obj(doc=p).on_update()
|
|
||||||
|
|
||||||
role = []
|
|
||||||
if cont_det[0]['contact_type'] == 'Individual':
|
|
||||||
role = ['Customer']
|
|
||||||
else:
|
|
||||||
if cont_det[0]['is_customer']:
|
|
||||||
role.append('Customer')
|
|
||||||
if cont_det[0]['is_supplier']:
|
|
||||||
role.append('Supplier')
|
|
||||||
if cont_det[0]['is_sales_partner']:
|
|
||||||
role.append('Partner')
|
|
||||||
|
|
||||||
if role:
|
|
||||||
prof_nm = p.name
|
|
||||||
for i in role:
|
|
||||||
r = Document('UserRole')
|
|
||||||
r.parent = p.name
|
|
||||||
r.role = i
|
|
||||||
r.parenttype = 'Profile'
|
|
||||||
r.parentfield = 'userroles'
|
|
||||||
r.save(1)
|
|
||||||
|
|
||||||
if i == 'Customer':
|
|
||||||
def_keys = ['from_company','customer_name','customer']
|
|
||||||
def_val = cont_det[0]['customer_name']
|
|
||||||
self.set_default_val(def_keys,def_val,prof_nm)
|
|
||||||
|
|
||||||
if i == 'Supplier':
|
|
||||||
def_keys = ['supplier_name','supplier']
|
|
||||||
def_val = cont_det[0]['supplier_name']
|
|
||||||
self.set_default_val(def_keys,def_val,prof_nm)
|
|
||||||
|
|
||||||
sql("update tabContact set has_login = 'Yes' where name=%s",cont_det[0]['name'])
|
|
||||||
sql("update tabContact set disable_login = 'No' where name=%s",cont_det[0]['name'])
|
|
||||||
msgprint('User login is created.')
|
|
||||||
|
|
||||||
#------set default values---------
|
|
||||||
def set_default_val(self,def_keys,def_val,prof_nm):
|
|
||||||
for d in def_keys:
|
|
||||||
kv = Document('DefaultValue')
|
|
||||||
kv.defkey = d
|
|
||||||
kv.defvalue = def_val
|
|
||||||
kv.parent = prof_nm
|
|
||||||
kv.parenttype = 'Profile'
|
|
||||||
kv.parentfield = 'defaults'
|
|
||||||
kv.save(1)
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import webnotes.defaults
|
|||||||
from webnotes.utils import cint
|
from webnotes.utils import cint
|
||||||
|
|
||||||
keydict = {
|
keydict = {
|
||||||
|
"print_style": "print_style",
|
||||||
"fiscal_year": "current_fiscal_year",
|
"fiscal_year": "current_fiscal_year",
|
||||||
'company': 'default_company',
|
'company': 'default_company',
|
||||||
'currency': 'default_currency',
|
'currency': 'default_currency',
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-02-21 14:54:43",
|
"creation": "2013-02-21 12:28:24",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-03-19 14:46:49",
|
"modified": "2013-03-21 15:42:59",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@@ -27,8 +27,6 @@
|
|||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
@@ -59,6 +57,19 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Session Expiry"
|
"label": "Session Expiry"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "column_break_3",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "For Server Side Print Formats",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "print_style",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Print Format Style",
|
||||||
|
"options": "Standard\nClassic\nModern\nSpartan"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
@@ -424,6 +435,11 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "SMS Sender Name"
|
"label": "SMS Sender Name"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"doctype": "DocPerm"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm"
|
"doctype": "DocPerm"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:23",
|
"creation": "2013-01-23 20:00:16",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-22 14:56:03",
|
"modified": "2013-03-20 15:09:28",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@@ -123,6 +123,13 @@
|
|||||||
"fieldtype": "Text Editor",
|
"fieldtype": "Text Editor",
|
||||||
"label": "Description"
|
"label": "Description"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "item_website_specifications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"label": "Item Website Specifications",
|
||||||
|
"options": "Item Website Specification"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "lft",
|
"fieldname": "lft",
|
||||||
@@ -174,6 +181,20 @@
|
|||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cancel": 1,
|
||||||
|
"create": 1,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"role": "System Manager",
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cancel": 1,
|
||||||
|
"create": 1,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"role": "Material Master Manager",
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
"amend": 0,
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
@@ -189,19 +210,5 @@
|
|||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "Material User",
|
"role": "Material User",
|
||||||
"write": 0
|
"write": 0
|
||||||
},
|
|
||||||
{
|
|
||||||
"cancel": 1,
|
|
||||||
"create": 1,
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "System Manager",
|
|
||||||
"write": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cancel": 1,
|
|
||||||
"create": 1,
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "Material Master Manager",
|
|
||||||
"write": 1
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -137,3 +137,17 @@ cur_frm.cscript.on_remove_attachment = function(doc) {
|
|||||||
+ wn.meta.get_docfield(doc.doctype, "description_html").label);
|
+ wn.meta.get_docfield(doc.doctype, "description_html").label);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cur_frm.cscript.copy_from_item_group = function(doc) {
|
||||||
|
wn.model.with_doc("Item Group", doc.item_group, function() {
|
||||||
|
$.each(wn.model.get("Item Website Specification", {parent:doc.item_group}),
|
||||||
|
function(i, d) {
|
||||||
|
var n = wn.model.add_child(doc, "Item Website Specification",
|
||||||
|
"item_website_specifications");
|
||||||
|
n.label = d.label;
|
||||||
|
n.description = d.description;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
cur_frm.refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-02-21 14:54:43",
|
"creation": "2013-03-07 15:53:11",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-03-06 16:02:47",
|
"modified": "2013-03-20 15:10:12",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@@ -33,7 +33,6 @@
|
|||||||
"parent": "Item",
|
"parent": "Item",
|
||||||
"parentfield": "permissions",
|
"parentfield": "permissions",
|
||||||
"parenttype": "DocType",
|
"parenttype": "DocType",
|
||||||
"permlevel": 0,
|
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
"submit": 0
|
"submit": 0
|
||||||
@@ -785,6 +784,12 @@
|
|||||||
"fieldname": "sb72",
|
"fieldname": "sb72",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "copy_from_item_group",
|
||||||
|
"fieldtype": "Button",
|
||||||
|
"label": "Copy From Item Group"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "show_in_website",
|
"depends_on": "show_in_website",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@@ -804,6 +809,24 @@
|
|||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 0,
|
||||||
|
"role": "System Manager",
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"create": 0,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 1,
|
||||||
|
"role": "Material Master Manager",
|
||||||
|
"write": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cancel": 1,
|
||||||
|
"create": 1,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 0,
|
||||||
"role": "Material Master Manager",
|
"role": "Material Master Manager",
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
@@ -812,6 +835,15 @@
|
|||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"create": 0,
|
"create": 0,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 1,
|
||||||
|
"role": "System Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"create": 0,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 1,
|
||||||
"role": "Material Manager",
|
"role": "Material Manager",
|
||||||
"write": 0
|
"write": 0
|
||||||
},
|
},
|
||||||
@@ -820,6 +852,25 @@
|
|||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"create": 0,
|
"create": 0,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 0,
|
||||||
|
"role": "Material Manager",
|
||||||
|
"write": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"create": 0,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 1,
|
||||||
|
"role": "Material User",
|
||||||
|
"write": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
|
"create": 0,
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"permlevel": 0,
|
||||||
"role": "Material User",
|
"role": "Material User",
|
||||||
"write": 0
|
"write": 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,3 +71,27 @@ def set_status(name, status):
|
|||||||
st.doc.status = status
|
st.doc.status = status
|
||||||
st.save()
|
st.save()
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def get_tickets():
|
||||||
|
tickets = webnotes.conn.sql("""select
|
||||||
|
name, subject, status
|
||||||
|
from `tabSupport Ticket`
|
||||||
|
where raised_by=%s
|
||||||
|
order by modified desc
|
||||||
|
limit 20""",
|
||||||
|
webnotes.session.user, as_dict=1)
|
||||||
|
return tickets
|
||||||
|
|
||||||
|
def get_website_args():
|
||||||
|
bean = webnotes.bean("Support Ticket", webnotes.form_dict.name)
|
||||||
|
if bean.doc.raised_by != webnotes.session.user:
|
||||||
|
return {
|
||||||
|
"doc": {"name": "Not Allowed"}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
return {
|
||||||
|
"doc": bean.doc,
|
||||||
|
"doclist": bean.doclist,
|
||||||
|
"webnotes": webnotes,
|
||||||
|
"utils": webnotes.utils
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ div.outer {
|
|||||||
padding: 30px;
|
padding: 30px;
|
||||||
margin: 30px -30px 10px -30px;
|
margin: 30px -30px 10px -30px;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.outer .navbar {
|
.outer .navbar {
|
||||||
margin: -30px -30px 10px -30px;
|
margin: -30px -30px 20px -30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-03-08 11:36:50",
|
"creation": "2013-03-08 11:36:50",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-03-11 15:23:21",
|
"modified": "2013-03-18 13:55:53",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@@ -65,6 +65,7 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "blogger",
|
"fieldname": "blogger",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Blogger",
|
"label": "Blogger",
|
||||||
"options": "Blogger",
|
"options": "Blogger",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "blog_category",
|
"fieldname": "blog_category",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Blog Category",
|
"label": "Blog Category",
|
||||||
"options": "Blog Category"
|
"options": "Blog Category"
|
||||||
},
|
},
|
||||||
@@ -86,6 +88,7 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "blog_intro",
|
"fieldname": "blog_intro",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
|
"in_list_view": 1,
|
||||||
"label": "Blog Intro",
|
"label": "Blog Intro",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class DocType:
|
|||||||
|
|
||||||
self.doc.at_import = ""
|
self.doc.at_import = ""
|
||||||
for f in fonts:
|
for f in fonts:
|
||||||
self.doc.at_import += "\n@import url(http://fonts.googleapis.com/css?family=%s:400,700);" % f.replace(" ", "+")
|
self.doc.at_import += "\n@import url(https://fonts.googleapis.com/css?family=%s:400,700);" % f.replace(" ", "+")
|
||||||
|
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import webnotes
|
import webnotes
|
||||||
from core.doctype.communication.communication import make
|
from core.doctype.communication.communication import make
|
||||||
|
from webnotes.utils import now
|
||||||
|
|
||||||
max_communications_per_hour = 300
|
max_communications_per_hour = 300
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ def send_message(subject="Website Query", message="", sender="", status="Open"):
|
|||||||
|
|
||||||
# guest method, cap max writes per hour
|
# guest method, cap max writes per hour
|
||||||
if webnotes.conn.sql("""select count(*) from `tabCommunication`
|
if webnotes.conn.sql("""select count(*) from `tabCommunication`
|
||||||
where TIMEDIFF(NOW(), modified) < '01:00:00'""")[0][0] > max_communications_per_hour:
|
where TIMEDIFF(%s, modified) < '01:00:00'""", now())[0][0] > max_communications_per_hour:
|
||||||
webnotes.response["message"] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later"
|
webnotes.response["message"] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
33
website/settings.py
Normal file
33
website/settings.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import webnotes
|
||||||
|
|
||||||
|
page_map = {
|
||||||
|
'Web Page': webnotes._dict({
|
||||||
|
"template": 'html/web_page.html',
|
||||||
|
"condition_field": "published"
|
||||||
|
}),
|
||||||
|
'Blog Post': webnotes._dict({
|
||||||
|
"template": 'html/blog_page.html',
|
||||||
|
"condition_field": "published",
|
||||||
|
}),
|
||||||
|
'Item': webnotes._dict({
|
||||||
|
"template": 'html/product_page.html',
|
||||||
|
"condition_field": "show_in_website",
|
||||||
|
}),
|
||||||
|
'Item Group': webnotes._dict({
|
||||||
|
"template": "html/product_group.html",
|
||||||
|
"condition_field": "show_in_website"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
page_settings_map = {
|
||||||
|
"about": "website.doctype.about_us_settings.about_us_settings.get_args",
|
||||||
|
"contact": "Contact Us Settings",
|
||||||
|
"blog": "website.helpers.blog.get_blog_template_args",
|
||||||
|
"writers": "website.helpers.blog.get_writers_args",
|
||||||
|
"print": "core.doctype.print_format.print_format.get_args",
|
||||||
|
"orders": "selling.doctype.sales_order.sales_order.get_currency_and_number_format",
|
||||||
|
"order": "selling.doctype.sales_order.sales_order.get_website_args",
|
||||||
|
"ticket": "support.doctype.support_ticket.support_ticket.get_website_args"
|
||||||
|
}
|
||||||
|
|
||||||
|
no_cache = ["message", "print", "order", "ticket"]
|
||||||
@@ -4,9 +4,17 @@
|
|||||||
margin: 70px auto;
|
margin: 70px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#login_wrapper,
|
||||||
|
#login_wrapper h3 {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
#login_wrapper a {
|
||||||
|
color: #0088cc;
|
||||||
|
}
|
||||||
|
|
||||||
.layout-wrapper {
|
.layout-wrapper {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #333;
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
box-shadow: 1px 1px 3px 3px #ccc;
|
box-shadow: 1px 1px 3px 3px #ccc;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -32,7 +40,4 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
}
|
}
|
||||||
.login-footer, .login-footer a {
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -10,21 +10,18 @@
|
|||||||
<script type="text/javascript" src="js/wn-web.js"></script>
|
<script type="text/javascript" src="js/wn-web.js"></script>
|
||||||
<link type="text/css" rel="stylesheet" href="css/all-web.css">
|
<link type="text/css" rel="stylesheet" href="css/all-web.css">
|
||||||
<link type="text/css" rel="stylesheet" href="css/wn-web.css">
|
<link type="text/css" rel="stylesheet" href="css/wn-web.css">
|
||||||
|
{%- if favicon %}
|
||||||
{% if favicon %}
|
|
||||||
<link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
|
<link rel="shortcut icon" href="files/{{ favicon }}" type="image/x-icon">
|
||||||
<link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
|
<link rel="icon" href="files/{{ favicon }}" type="image/x-icon">
|
||||||
{% else %}
|
{% else %}
|
||||||
<link rel="shortcut icon" href="app/images/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="app/images/favicon.ico" type="image/x-icon">
|
||||||
<link rel="icon" href="app/images/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="app/images/favicon.ico" type="image/x-icon">
|
||||||
{% endif %}
|
{% endif -%}
|
||||||
|
{% if description -%}
|
||||||
{% if description %}
|
|
||||||
<meta name="description" content="{{ description }}">
|
<meta name="description" content="{{ description }}">
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
{% block header -%}
|
||||||
{% block header %}
|
{%- endblock %}
|
||||||
{% endblock %}
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<div class="navbar navbar-inverse"
|
<div class="navbar navbar-inverse" style="">
|
||||||
style="">
|
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
{% if brand_html %}<a class="brand" href="index">{{ brand_html }}</a>{% endif %}
|
{%- if brand_html %}<a class="brand" href="index">{{ brand_html }}</a>{% endif -%}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
@@ -10,45 +9,27 @@
|
|||||||
</button>
|
</button>
|
||||||
<div class="nav-collapse collapse">
|
<div class="nav-collapse collapse">
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
{% for page in top_bar_items %}
|
{%- for page in top_bar_items -%}
|
||||||
{% if not page.parent_label %}
|
{% if not page.parent_label -%}
|
||||||
<li data-label="{{ page.label }}"
|
<li data-label="{{ page.label }}" {% if page.child_items %} class="dropdown"{% endif %}>
|
||||||
{% if page.child_items %}
|
<a href="{{ page.url or '#' }}" {% if page.child_items %} class="dropdown-toggle" onclick="return false;" data-toggle="dropdown"{% endif %} {{ page.target or ''}}>
|
||||||
class="dropdown"
|
{{ page.label }}
|
||||||
{% endif %}>
|
{%- if page.child_items -%}
|
||||||
<a href="{{ page.url or '#' }}"
|
<b class="caret"></b>
|
||||||
{% if page.child_items %}
|
</a>
|
||||||
class="dropdown-toggle"
|
<ul class="dropdown-menu">
|
||||||
onclick="return false;"
|
{%- for child in page.child_items -%}
|
||||||
data-toggle="dropdown"
|
<li data-label="{{ child.label }}">
|
||||||
{% endif %}
|
<a {% if child.indent %} style="padding-left: {{(int(child.indent)+1)*15 }}px"{% endif %} href="{{ child.url }}" {{ child.target or '' }}>{{ child.label }}</a>
|
||||||
{{ page.target or ''}}>
|
</li>
|
||||||
{{ page.label }}
|
{%- endfor -%}
|
||||||
{% if page.child_items %}
|
</ul>
|
||||||
<b class="caret"></b>
|
{%- else -%}
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
{%- endif -%}
|
||||||
{% for child in page.child_items %}
|
</li>
|
||||||
<li data-label="{{ child.label }}">
|
{%- endif -%}
|
||||||
<a {% if child.indent %}
|
{%- endfor %}
|
||||||
style="padding-left:
|
|
||||||
{{(int(child.indent)+1)*15 }}px"
|
|
||||||
{% endif %}
|
|
||||||
href="{{ child.url }}" {{ child.target or '' }}>
|
|
||||||
{{ child.label }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
<ul class="nav pull-right">
|
|
||||||
<li id="login-topbar-item"><a href="login">Login</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
{% extends "html/base.html" %}
|
{% extends "html/base.html" %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<header>
|
|
||||||
</header>
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<div class="pull-right" style="margin:4px;" id="user-tools">
|
||||||
|
<a id="login-link" href="login">Login</a>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
{% if banner_html %}<div class="row" style="margin-top: 30px;">
|
{% if banner_html %}<div class="row" style="margin-top: 30px;">
|
||||||
<div class="span12">{{ banner_html }}</div>
|
<div class="span12">{{ banner_html }}</div>
|
||||||
</div>{% endif %}
|
</div>{% endif %}
|
||||||
<div class="outer">
|
<div class="outer">
|
||||||
{% include "html/navbar.html" %}
|
{% include "html/navbar.html" %}
|
||||||
<div class="content row" id="page-{{ name }}" style="display: block;">
|
<div class="content row" id="page-{{ name }}" style="display: block;">
|
||||||
{% block content %}
|
{%- block content -%}
|
||||||
{% endblock %}
|
{%- endblock -%}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
{% extends "html/outer.html" %}
|
{% extends "html/outer.html" %}
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
{% block title -%}{{ title }}{%- endblock %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header -%}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script>
|
<script>
|
||||||
{% block javascript %}
|
{% block javascript -%}
|
||||||
{% endblock %}
|
{%- endblock %}
|
||||||
</script>
|
</script>
|
||||||
{% block css %}
|
{% block css -%}
|
||||||
{% if insert_style %}
|
{% if insert_style -%}
|
||||||
<style>{{ css }}</style>
|
<style>{{ css }}</style>
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% endblock %}
|
{%- endblock %}
|
||||||
{% endblock %}
|
{%- endblock -%}
|
||||||
|
|
||||||
{% block content %}
|
{%- block content -%}
|
||||||
{{ content }}
|
{{ content }}
|
||||||
{% endblock %}
|
{%- endblock %}
|
||||||
@@ -17,27 +17,53 @@ $(document).ready(function(wrapper) {
|
|||||||
|
|
||||||
// Login
|
// Login
|
||||||
login.do_login = function(){
|
login.do_login = function(){
|
||||||
|
|
||||||
var args = {};
|
var args = {};
|
||||||
args['usr']=$("#login_id").val();
|
if(window.is_sign_up) {
|
||||||
args['pwd']=$("#password").val();
|
args.cmd = "core.doctype.profile.profile.sign_up";
|
||||||
|
args.email = $("#login_id").val();
|
||||||
|
args.full_name = $("#full_name").val();
|
||||||
|
|
||||||
if(!args.usr || !args.pwd) {
|
if(!args.email || !valid_email(args.email) || !args.full_name) {
|
||||||
login.set_message("Both login and password required.");
|
login.set_message("Valid email and name required.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if(window.is_forgot) {
|
||||||
|
args.cmd = "reset_password";
|
||||||
|
args.user = $("#login_id").val();
|
||||||
|
|
||||||
|
if(!args.user) {
|
||||||
|
login.set_message("Valid Login Id required.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
args.cmd = "login"
|
||||||
|
args.usr = $("#login_id").val();
|
||||||
|
args.pwd = $("#password").val();
|
||||||
|
|
||||||
|
if(!args.usr || !args.pwd) {
|
||||||
|
login.set_message("Both login and password required.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#login_btn').attr("disabled", "disabled");
|
$('#login_btn').attr("disabled", "disabled");
|
||||||
|
$("#login-spinner").toggle(true);
|
||||||
$('#login_message').toggle(false);
|
$('#login_message').toggle(false);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "server.py",
|
url: "server.py",
|
||||||
data: {cmd:"login", usr:args.usr, pwd: args.pwd},
|
data: args,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
$("input").val("");
|
||||||
|
$("#login-spinner").toggle(false);
|
||||||
$('#login_btn').attr("disabled", false);
|
$('#login_btn').attr("disabled", false);
|
||||||
if(data.message=="Logged In") {
|
if(data.message=="Logged In") {
|
||||||
window.location.href = "app.html";
|
window.location.href = "app.html";
|
||||||
|
} else if(data.message=="No App") {
|
||||||
|
window.location.href = "index";
|
||||||
} else {
|
} else {
|
||||||
login.set_message(data.message);
|
login.set_message(data.message);
|
||||||
}
|
}
|
||||||
@@ -47,28 +73,23 @@ login.do_login = function(){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
login.show_forgot_password = function(){
|
login.sign_up = function() {
|
||||||
// create dialog
|
$("#login_wrapper h3").html("Sign Up");
|
||||||
var login_id = $("#login_id").val();
|
$("#login-label").html("Email Id");
|
||||||
if(!login_id || !valid_email(login_id)) {
|
$("#password-row, #sign-up-wrapper, #login_message").toggle(false);
|
||||||
login.set_message("Please set your login id (which is your email where the password will be sent);");
|
$("#full-name-row").toggle(true);
|
||||||
return;
|
$("#login_btn").html("Register");
|
||||||
}
|
$("#forgot-wrapper").html("<a onclick='location.reload()' href='#'>Login</a>")
|
||||||
login.set_message("Sending email with new password...");
|
window.is_sign_up = true;
|
||||||
$("#forgot-password").remove();
|
}
|
||||||
|
|
||||||
$.ajax({
|
login.show_forgot_password = function() {
|
||||||
method: "POST",
|
$("#login_wrapper h3").html("Forgot");
|
||||||
url: "server.py",
|
$("#login-label").html("Email Id");
|
||||||
data: {
|
$("#password-row, #sign-up-wrapper, #login_message").toggle(false);
|
||||||
cmd: "reset_password",
|
$("#login_btn").html("Send Password");
|
||||||
user: login_id,
|
$("#forgot-wrapper").html("<a onclick='location.reload()' href='#'>Login</a>")
|
||||||
_type: "POST"
|
window.is_forgot = true;
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
login.set_message("A new password has been sent to your email id.", "GREEN");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
login.set_message = function(message, color) {
|
login.set_message = function(message, color) {
|
||||||
|
|||||||
18
website/templates/pages/account.html
Normal file
18
website/templates/pages/account.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{% extends "html/page.html" %}
|
||||||
|
|
||||||
|
{% set title="My Account" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="span12">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="index">Home</a> <span class="divider">/</span></li>
|
||||||
|
<li class="active">My Account</li>
|
||||||
|
</ul>
|
||||||
|
<h3>My Account</h3>
|
||||||
|
<p><a href="profile"><i class="icon-user"></i> Change my name, password</a></p>
|
||||||
|
<p><a href="orders"><i class="icon-list"></i> My Orders</a></p>
|
||||||
|
<p><a href="tickets"><i class="icon-tags"></i> My Tickets</a></p>
|
||||||
|
<p><a href="server.py?cmd=web_logout"><i class="icon-signout"></i> Logout</a></p>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
{% set title="Login" %}
|
{% set title="Login" %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div id='login_wrapper'>
|
<div class="container" id='login_wrapper'>
|
||||||
<div class='layout-wrapper layout-main'>
|
<div class='layout-wrapper layout-main'>
|
||||||
<p id="login_message" class="alert" style="display: none;"></p>
|
<p id="login_message" class="alert" style="display: none;"></p>
|
||||||
<h3><i class="icon-lock" style="margin-top: 7px"></i> Login</h3>
|
<h3><i class="icon-lock" style="margin-top: 7px"></i> Login</h3>
|
||||||
@@ -18,34 +18,45 @@
|
|||||||
<table border="0" class="login-box">
|
<table border="0" class="login-box">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: right; padding: 3px;">Login Id</td>
|
<td style="text-align: right; padding: 3px;"
|
||||||
|
id="login-label">Login Id</td>
|
||||||
<td><input id="login_id" type="text" style="width: 180px"/></td>
|
<td><input id="login_id" type="text" style="width: 180px"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr id="password-row">
|
||||||
<td style="text-align: right; padding: 3px;">Password</td>
|
<td style="text-align: right; padding: 3px;" >Password</td>
|
||||||
<td><input id="password" type="password" style="width: 180px" /></td>
|
<td><input id="password" type="password" style="width: 180px" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr id="full-name-row" style="display: none;">
|
||||||
|
<td style="text-align: right; padding: 3px;">Full Name</td>
|
||||||
|
<td><input id="full_name" type="text" style="width: 180px" /></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" id="login_btn"
|
<button type="submit" id="login_btn"
|
||||||
class="btn btn-small btn-primary">Login</button>
|
class="btn btn-small btn-primary">Login</button>
|
||||||
|
<img src="lib/images/ui/button-load.gif" id="login-spinner"
|
||||||
|
style="display: none;">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
<br>
|
<br>
|
||||||
<p style="text-align: center"><a id="forgot-password"
|
<p style="text-align: center" id="forgot-wrapper">
|
||||||
|
<a id="forgot-password" style="cursor:pointer"
|
||||||
onclick="return login.show_forgot_password()">Forgot Password</a></p>
|
onclick="return login.show_forgot_password()">Forgot Password</a></p>
|
||||||
|
<p style="text-align: center" id="sign-up-wrapper">
|
||||||
|
New user? <a id="sign-up" style="cursor:pointer"
|
||||||
|
onclick="return login.sign_up()">Sign Up</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="login-footer">
|
</div>
|
||||||
<a href="index.html">Home</a> |
|
<div class="web-footer login-footer container">
|
||||||
<a href="https://erpnext.com">ERPNext</a><br><br>
|
<a href="index.html">Home</a> |
|
||||||
{% if copyright %}
|
<a href="https://erpnext.com">ERPNext</a><br><br>
|
||||||
<div class="web-footer-copyright">© {{ copyright }}
|
{% if copyright %}
|
||||||
{% endif %}
|
<div class="web-footer-copyright">© {{ copyright }}
|
||||||
</div>
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
88
website/templates/pages/order.html
Normal file
88
website/templates/pages/order.html
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{% extends "html/page.html" %}
|
||||||
|
|
||||||
|
{% set title=doc.name %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="span12">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="index">Home</a> <span class="divider">/</span></li>
|
||||||
|
<li><a href="account">My Account</a> <span class="divider">/</span></li>
|
||||||
|
<li><a href="orders">My Orders</a> <span class="divider">/</span></li>
|
||||||
|
<li class="active">{{ doc.name }}</li>
|
||||||
|
</ul>
|
||||||
|
<h3><i class="icon-file"></i> {{ doc.name }}</h3>
|
||||||
|
<hr>
|
||||||
|
{%- if doc.status -%}
|
||||||
|
<div style="font-size: 13px;">
|
||||||
|
<div class="row">
|
||||||
|
<div class="span2">
|
||||||
|
<div class="label">{{ doc.status }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="span4">
|
||||||
|
{{ utils.formatdate(doc.transaction_date) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="span12">
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>Sr</th>
|
||||||
|
<th>Item Name</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Qty</th>
|
||||||
|
<th>UoM</th>
|
||||||
|
<th>Basic Rate</th>
|
||||||
|
<th>Amount</th>
|
||||||
|
</tr>
|
||||||
|
{%- for row in doclist.get({"doctype":"Sales Order Item"}) %}
|
||||||
|
<tr>
|
||||||
|
<td style="width: 3%;">{{ row.idx }}</td>
|
||||||
|
<td style="width: 20%;">{{ row.item_name }}</td>
|
||||||
|
<td style="width: 37%;">{{ row.description }}</td>
|
||||||
|
<td style="width: 5%; text-align: right;">{{ row.qty }}</td>
|
||||||
|
<td style="width: 5%;">{{ row.stock_uom }}</td>
|
||||||
|
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_rate, currency=doc.currency) }}</td>
|
||||||
|
<td style="width: 15%; text-align: right;">{{ utils.fmt_money(row.export_amount, currency=doc.currency) }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor -%}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="span6"></div>
|
||||||
|
<div class="span6">
|
||||||
|
<table cellspacing=0 width=100%>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Net Total</td>
|
||||||
|
<td width=40% style="text-align: right;">{{
|
||||||
|
utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency)
|
||||||
|
}}</td>
|
||||||
|
</tr>
|
||||||
|
{%- for charge in doclist.get({"doctype":"Sales Taxes and Charges"}) -%}
|
||||||
|
{%- if not charge.included_in_print_rate -%}
|
||||||
|
<tr>
|
||||||
|
<td>{{ charge.description }}</td>
|
||||||
|
<td style="text-align: right;">{{ utils.fmt_money(charge.tax_amount / doc.conversion_rate, currency=doc.currency) }}</td>
|
||||||
|
</tr>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
<tr>
|
||||||
|
<td>Grand Total</td>
|
||||||
|
<td style="text-align: right;">{{ utils.fmt_money(doc.grand_total_export, currency=doc.currency) }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr style='font-weight: bold'>
|
||||||
|
<td>Rounded Total</td>
|
||||||
|
<td style="text-align: right;">{{ utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
70
website/templates/pages/orders.html
Normal file
70
website/templates/pages/orders.html
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
{% extends "html/page.html" %}
|
||||||
|
|
||||||
|
{% set title="My Orders" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<script>
|
||||||
|
global_number_format = "{{ global_number_format }}";
|
||||||
|
currency = "{{ currency }}";
|
||||||
|
wn.currency_symbols = {{ currency_symbols }};
|
||||||
|
</script>
|
||||||
|
<div class="span12">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="index">Home</a> <span class="divider">/</span></li>
|
||||||
|
<li><a href="account">My Account</a> <span class="divider">/</span></li>
|
||||||
|
<li class="active">My Orders</li>
|
||||||
|
</ul>
|
||||||
|
<h3><i class="icon-list"></i> My Orders</h3>
|
||||||
|
<hr>
|
||||||
|
<div id="order-list" style="font-size: 13px;">
|
||||||
|
<div class="progress progress-striped active">
|
||||||
|
<div class="bar" style="width: 100%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var order_start = 0;
|
||||||
|
|
||||||
|
wn.call({
|
||||||
|
method: "selling.doctype.sales_order.sales_order.get_orders",
|
||||||
|
args: {
|
||||||
|
start: order_start
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
$("#order-list .progress").remove();
|
||||||
|
var $list = $("#order-list");
|
||||||
|
|
||||||
|
if(!(r.message && r.message.length)) {
|
||||||
|
$list.html("<div class='alert'>No Orders Yet</div>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each(r.message, function(i, order) {
|
||||||
|
|
||||||
|
// parent
|
||||||
|
var $order = $(repl('<div class="row">\
|
||||||
|
<div class="span3"><a href="order?name=%(name)s">%(name)s</a></div>\
|
||||||
|
<div class="span9"></div>\
|
||||||
|
</div>', order)).appendTo($list);
|
||||||
|
|
||||||
|
// items
|
||||||
|
$.each(order.items || [], function(i, item) {
|
||||||
|
item.export_rate = format_currency(item.export_rate, order.currency);
|
||||||
|
item.export_amount = format_currency(item.export_amount, order.currency);
|
||||||
|
var $item = $(repl('<div class="row">\
|
||||||
|
<div class="span3">%(item_name)s</div>\
|
||||||
|
<div class="span2" style="text-align: right;">%(export_rate)s</div>\
|
||||||
|
<div class="span2" style="text-align: right;">%(qty)s %(stock_uom)s</div>\
|
||||||
|
<div class="span2" style="text-align: right;">%(export_amount)s</div>\
|
||||||
|
</div>\
|
||||||
|
</div>', item)).appendTo($order.find(".span9"));
|
||||||
|
});
|
||||||
|
|
||||||
|
$("<hr>").appendTo($list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
18
website/templates/pages/print.html
Normal file
18
website/templates/pages/print.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Print Format</title>
|
||||||
|
<meta name="generator" content="wnframework">
|
||||||
|
<style>
|
||||||
|
{{ css }}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{ body }}
|
||||||
|
</body>
|
||||||
|
{%- if comment -%}
|
||||||
|
<!-- {{ comment }} -->
|
||||||
|
{%- endif -%}
|
||||||
|
</html>
|
||||||
56
website/templates/pages/profile.html
Normal file
56
website/templates/pages/profile.html
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
{% extends "html/page.html" %}
|
||||||
|
|
||||||
|
{% set title="My Profile" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="span12">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="index">Home</a> <span class="divider">/</span></li>
|
||||||
|
<li><a href="account">My Account</a> <span class="divider">/</span></li>
|
||||||
|
<li class="active">My Profile</li>
|
||||||
|
</ul>
|
||||||
|
<h2><i class="icon-user"></i> My Profile</h2>
|
||||||
|
<hr>
|
||||||
|
<div class="alert" id="message" style="display: none;"></div>
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="fullname">Full Name</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="fullname" placeholder="Your Name">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label" for="password">Password</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="password" id="password" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<button id="update_profile" type="submit" class="btn">Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#fullname").val(getCookie("full_name") || "");
|
||||||
|
$("#update_profile").click(function() {
|
||||||
|
wn.call({
|
||||||
|
method: "core.doctype.profile.profile.update_profile",
|
||||||
|
type: "POST",
|
||||||
|
args: {
|
||||||
|
fullname: $("#fullname").val(),
|
||||||
|
password: $("#password").val()
|
||||||
|
},
|
||||||
|
btn: this,
|
||||||
|
msg: $("#message"),
|
||||||
|
callback: function(r) {
|
||||||
|
if(!r.exc) $("#user-full-name").html($("#fullname").val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
49
website/templates/pages/ticket.html
Normal file
49
website/templates/pages/ticket.html
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{% extends "html/page.html" %}
|
||||||
|
|
||||||
|
{% set title=doc.name %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="span12">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="index">Home</a> <span class="divider">/</span></li>
|
||||||
|
<li><a href="account">My Account</a> <span class="divider">/</span></li>
|
||||||
|
<li><a href="tickets">My Tickets</a> <span class="divider">/</span></li>
|
||||||
|
<li class="active">{{ doc.name }}</li>
|
||||||
|
</ul>
|
||||||
|
<h3><i class="icon-file"></i> {{ doc.name }}</h3>
|
||||||
|
<hr>
|
||||||
|
{%- if doc.status -%}
|
||||||
|
<div class="row">
|
||||||
|
<div class="span2">
|
||||||
|
<div class="label">{{ doc.status }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="span7">
|
||||||
|
{{ doc.subject }}
|
||||||
|
</div>
|
||||||
|
<div class="span3">
|
||||||
|
{{ utils.formatdate(doc.transaction_date) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<h4>Messages</h4>
|
||||||
|
{%- if doclist.get({"doctype":"Communication"}) -%}
|
||||||
|
<div style="font-size: 13px;">
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<tbody>
|
||||||
|
{%- for comm in doclist.get({"doctype":"Communication"}) %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<h5>{{ comm.sender }} on {{ utils.formatdate(doc.modified) }}</h5>
|
||||||
|
<p>{{ comm.content }}</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor -%}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{%- else -%}
|
||||||
|
<div class="alert">No messages</div>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
53
website/templates/pages/tickets.html
Normal file
53
website/templates/pages/tickets.html
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{% extends "html/page.html" %}
|
||||||
|
|
||||||
|
{% set title="My Tickets" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="span12">
|
||||||
|
<ul class="breadcrumb">
|
||||||
|
<li><a href="index">Home</a> <span class="divider">/</span></li>
|
||||||
|
<li><a href="account">My Account</a> <span class="divider">/</span></li>
|
||||||
|
<li class="active">My Tickets</li>
|
||||||
|
</ul>
|
||||||
|
<h3><i class="icon-tags"></i> My Tickets</h3>
|
||||||
|
<hr>
|
||||||
|
<div id="ticket-list" style="font-size: 13px;">
|
||||||
|
<div class="progress progress-striped active">
|
||||||
|
<div class="bar" style="width: 100%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var order_start = 0;
|
||||||
|
|
||||||
|
wn.call({
|
||||||
|
method: "support.doctype.support_ticket.support_ticket.get_tickets",
|
||||||
|
args: {
|
||||||
|
start: order_start
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
$("#ticket-list .progress").remove();
|
||||||
|
var $list = $("#ticket-list");
|
||||||
|
|
||||||
|
if(!(r.message && r.message.length)) {
|
||||||
|
$list.html("<div class='alert'>No Tickets Yet</div>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each(r.message, function(i, ticket) {
|
||||||
|
|
||||||
|
// parent
|
||||||
|
var $ticket = $(repl('<div class="row">\
|
||||||
|
<div class="span2"><span class="label">%(status)s</span></div>\
|
||||||
|
<div class="span3"><a href="ticket?name=%(name)s">%(name)s</a></div>\
|
||||||
|
<div class="span7">%(subject)s</div>\
|
||||||
|
</div>', ticket)).appendTo($list);
|
||||||
|
|
||||||
|
$("<hr>").appendTo($list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
@@ -18,35 +18,9 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import conf
|
import conf
|
||||||
|
from website.settings import *
|
||||||
import webnotes
|
import webnotes
|
||||||
|
import webnotes.utils
|
||||||
page_map = {
|
|
||||||
'Web Page': webnotes._dict({
|
|
||||||
"template": 'html/web_page.html',
|
|
||||||
"condition_field": "published"
|
|
||||||
}),
|
|
||||||
'Blog Post': webnotes._dict({
|
|
||||||
"template": 'html/blog_page.html',
|
|
||||||
"condition_field": "published",
|
|
||||||
}),
|
|
||||||
'Item': webnotes._dict({
|
|
||||||
"template": 'html/product_page.html',
|
|
||||||
"condition_field": "show_in_website",
|
|
||||||
}),
|
|
||||||
'Item Group': webnotes._dict({
|
|
||||||
"template": "html/product_group.html",
|
|
||||||
"condition_field": "show_in_website"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
page_settings_map = {
|
|
||||||
"about": "website.doctype.about_us_settings.about_us_settings.get_args",
|
|
||||||
"contact": "Contact Us Settings",
|
|
||||||
"blog": "website.helpers.blog.get_blog_template_args",
|
|
||||||
"writers": "website.helpers.blog.get_writers_args"
|
|
||||||
}
|
|
||||||
|
|
||||||
no_cache = "message"
|
|
||||||
|
|
||||||
def render(page_name):
|
def render(page_name):
|
||||||
"""render html page"""
|
"""render html page"""
|
||||||
@@ -75,7 +49,10 @@ def get_html(page_name):
|
|||||||
from_cache = True
|
from_cache = True
|
||||||
|
|
||||||
if not html:
|
if not html:
|
||||||
webnotes.connect()
|
from webnotes.auth import HTTPRequest
|
||||||
|
webnotes.http_request = HTTPRequest()
|
||||||
|
|
||||||
|
#webnotes.connect()
|
||||||
html = load_into_cache(page_name)
|
html = load_into_cache(page_name)
|
||||||
from_cache = False
|
from_cache = False
|
||||||
|
|
||||||
@@ -254,7 +231,8 @@ def get_outer_env(page_name, args):
|
|||||||
order by idx asc""", as_dict=1),
|
order by idx asc""", as_dict=1),
|
||||||
|
|
||||||
'int':int,
|
'int':int,
|
||||||
"webnotes": webnotes
|
"webnotes": webnotes,
|
||||||
|
"utils": webnotes.utils
|
||||||
})
|
})
|
||||||
|
|
||||||
args.update(ret)
|
args.update(ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user