Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
1c0f32ce45
@ -13,17 +13,27 @@ def execute():
|
|||||||
name = question.question[:180]
|
name = question.question[:180]
|
||||||
if webnotes.conn.exists("Note", name):
|
if webnotes.conn.exists("Note", name):
|
||||||
webnotes.delete_doc("Note", name)
|
webnotes.delete_doc("Note", name)
|
||||||
note = webnotes.bean({
|
|
||||||
|
similar_questions = webnotes.conn.sql_list("""select name from `tabQuestion`
|
||||||
|
where question like %s""", "%s%%" % name)
|
||||||
|
answers = [markdown2.markdown(c) for c in webnotes.conn.sql_list("""
|
||||||
|
select answer from tabAnswer where question in (%s)""" % \
|
||||||
|
", ".join(["%s"]*len(similar_questions)), similar_questions)]
|
||||||
|
|
||||||
|
webnotes.bean({
|
||||||
"doctype":"Note",
|
"doctype":"Note",
|
||||||
"title": name,
|
"title": name,
|
||||||
"content": "<hr>".join([markdown2.markdown(c) for c in webnotes.conn.sql_list("""
|
"content": "<hr>".join(answers),
|
||||||
select answer from tabAnswer where question=%s""", question.name)]),
|
|
||||||
"owner": question.owner,
|
"owner": question.owner,
|
||||||
"creation": question.creation,
|
"creation": question.creation,
|
||||||
"public": 1
|
"public": 1
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
except NameError:
|
except NameError:
|
||||||
pass
|
pass
|
||||||
|
except Exception, e:
|
||||||
|
if e.args[0] != 1062:
|
||||||
|
raise e
|
||||||
|
|
||||||
webnotes.delete_doc("DocType", "Question")
|
webnotes.delete_doc("DocType", "Question")
|
||||||
webnotes.delete_doc("DocType", "Answer")
|
webnotes.delete_doc("DocType", "Answer")
|
||||||
|
@ -6,9 +6,9 @@ wn.require("app/js/controllers/stock_controller.js");
|
|||||||
|
|
||||||
erpnext.TransactionController = erpnext.stock.StockController.extend({
|
erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||||
onload: function() {
|
onload: function() {
|
||||||
|
var me = this;
|
||||||
if(this.frm.doc.__islocal) {
|
if(this.frm.doc.__islocal) {
|
||||||
var me = this,
|
var today = get_today(),
|
||||||
today = get_today(),
|
|
||||||
currency = wn.defaults.get_default("currency");
|
currency = wn.defaults.get_default("currency");
|
||||||
|
|
||||||
$.each({
|
$.each({
|
||||||
@ -30,6 +30,14 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
|
|
||||||
me.frm.script_manager.trigger("company");
|
me.frm.script_manager.trigger("company");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.other_fname) {
|
||||||
|
this[this.other_fname + "_remove"] = this.calculate_taxes_and_totals;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.fname) {
|
||||||
|
this[this.fname + "_remove"] = this.calculate_taxes_and_totals;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onload_post_render: function() {
|
onload_post_render: function() {
|
||||||
@ -311,8 +319,13 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
|||||||
function(item_code, tax_data) {
|
function(item_code, tax_data) {
|
||||||
if(!item_tax[item_code]) item_tax[item_code] = {};
|
if(!item_tax[item_code]) item_tax[item_code] = {};
|
||||||
if($.isArray(tax_data)) {
|
if($.isArray(tax_data)) {
|
||||||
var tax_rate = tax_data[0] == null ? "" : (flt(tax_data[0], tax_rate_precision) + "%"),
|
var tax_rate = "";
|
||||||
tax_amount = format_currency(flt(tax_data[1], tax_amount_precision), company_currency,
|
if(tax_data[0] != null) {
|
||||||
|
tax_rate = (tax.charge_type === "Actual") ?
|
||||||
|
format_currency(flt(tax_data[0], tax_amount_precision), company_currency, tax_amount_precision) :
|
||||||
|
(flt(tax_data[0], tax_rate_precision) + "%");
|
||||||
|
}
|
||||||
|
var tax_amount = format_currency(flt(tax_data[1], tax_amount_precision), company_currency,
|
||||||
tax_amount_precision);
|
tax_amount_precision);
|
||||||
|
|
||||||
item_tax[item_code][tax.name] = [tax_rate, tax_amount];
|
item_tax[item_code][tax.name] = [tax_rate, tax_amount];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user