added format_currency and added options to all currency fields

This commit is contained in:
Rushabh Mehta
2013-01-23 19:39:51 +05:30
parent 6382a42dbe
commit 597d470e63
96 changed files with 804 additions and 604 deletions

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:18",
"docstatus": 0,
"modified": "2013-01-22 16:54:47",
"modified": "2013-01-23 17:11:21",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -277,6 +277,7 @@
"label": "Credit Limit",
"oldfieldname": "credit_limit",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"permlevel": 2
},
{

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:19",
"docstatus": 0,
"modified": "2013-01-22 13:41:28",
"modified": "2013-01-23 17:11:22",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -85,6 +85,7 @@
"label": "Basic Rate",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1
},
{

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:19",
"docstatus": 0,
"modified": "2013-01-22 16:55:23",
"modified": "2013-01-23 17:11:22",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -242,6 +242,7 @@
"no_copy": 0,
"oldfieldname": "net_total",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 0,
"read_only": 1,
"reqd": 0,
@@ -413,6 +414,7 @@
"label": "Taxes and Charges Total*",
"oldfieldname": "other_charges_total",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"read_only": 1
},
@@ -440,6 +442,7 @@
"no_copy": 0,
"oldfieldname": "grand_total",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"read_only": 1,
"reqd": 0,
@@ -453,6 +456,7 @@
"no_copy": 0,
"oldfieldname": "rounded_total",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"read_only": 1,
"width": "200px"
@@ -486,6 +490,7 @@
"no_copy": 0,
"oldfieldname": "grand_total_export",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 0,
"read_only": 1,
"reqd": 0,
@@ -499,6 +504,7 @@
"no_copy": 0,
"oldfieldname": "rounded_total_export",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 0,
"read_only": 1,
"reqd": 0,

View File

@@ -31,7 +31,7 @@ wn.doclistviews['Quotation'] = wn.views.ListView.extend({
{
width: '18%',
content: function(parent, data) {
$(parent).html(data.currency + ' ' + fmt_money(data.grand_total_export))
$(parent).html(format_currency(data.grand_total_export, data.currency))
},
css: {'text-align':'right'}
},

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:19",
"docstatus": 0,
"modified": "2013-01-22 14:47:57",
"modified": "2013-01-23 15:46:18",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -107,6 +107,7 @@
"label": "Price List Rate",
"oldfieldname": "ref_rate",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 1,
"reqd": 0,
"width": "100px"
@@ -131,6 +132,7 @@
"label": "Rate",
"oldfieldname": "export_rate",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -145,6 +147,7 @@
"label": "Amount",
"oldfieldname": "export_amount",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 0,
"read_only": 1,
"reqd": 0,
@@ -158,6 +161,7 @@
"label": "Price List Rate*",
"oldfieldname": "base_ref_rate",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency(cur_frm.doc.company);",
"print_hide": 1,
"read_only": 1,
"width": "100px"
@@ -171,6 +175,7 @@
"label": "Basic Rate*",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency(cur_frm.doc.company);",
"print_hide": 1,
"reqd": 0,
"search_index": 0,
@@ -185,6 +190,7 @@
"label": "Amount*",
"oldfieldname": "amount",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency(cur_frm.doc.company);",
"print_hide": 1,
"read_only": 1,
"reqd": 0,

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:20",
"docstatus": 0,
"modified": "2013-01-22 14:47:59",
"modified": "2013-01-23 17:11:22",
"modified_by": "Administrator",
"owner": "wasim@webnotestech.com"
},
@@ -63,6 +63,7 @@
"label": "Rate",
"oldfieldname": "rate",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"read_only": 1
},
{

View File

@@ -172,23 +172,28 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
unhide_field(['price_list_currency', 'plc_conversion_rate']);
if (pl_currency.length==1) {
if (doc.price_list_currency != pl_currency[0]) set_multiple(cdt, cdn, {price_list_currency:pl_currency[0]});
if (doc.price_list_currency != pl_currency[0])
set_multiple(cdt, cdn, {price_list_currency:pl_currency[0]});
if (pl_currency[0] == doc.currency) {
if(doc.plc_conversion_rate != doc.conversion_rate) set_multiple(cdt, cdn, {plc_conversion_rate:doc.conversion_rate});
if(doc.plc_conversion_rate != doc.conversion_rate)
set_multiple(cdt, cdn, {plc_conversion_rate:doc.conversion_rate});
hide_field(['price_list_currency', 'plc_conversion_rate']);
} else if (pl_currency[0] == r.message[1]) {
if (doc.plc_conversion_rate != 1) set_multiple(cdt, cdn, {plc_conversion_rate:1})
if (doc.plc_conversion_rate != 1)
set_multiple(cdt, cdn, {plc_conversion_rate:1})
hide_field(['price_list_currency', 'plc_conversion_rate']);
}
}
if (r.message[1] == doc.currency) {
if (doc.conversion_rate != 1) set_multiple(cdt, cdn, {conversion_rate:1});
if (doc.conversion_rate != 1)
set_multiple(cdt, cdn, {conversion_rate:1});
hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
} else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
if (r.message[1] == doc.price_list_currency) {
if (doc.plc_conversion_rate != 1) set_multiple(cdt, cdn, {plc_conversion_rate:1});
if (doc.plc_conversion_rate != 1)
set_multiple(cdt, cdn, {plc_conversion_rate:1});
hide_field('plc_conversion_rate');
} else unhide_field('plc_conversion_rate');
@@ -573,9 +578,9 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
total += flt(tax[t].tax_amount); // for adding total to previous amount
if(tax[t].charge_type == 'Actual')
$td(otc,i+1,t+1).innerHTML = fmt_money(tax[t].total_amount);
$td(otc,i+1,t+1).innerHTML = format_currency(tax[t].total_amount, erpnext.get_currency(doc.company));
else
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
$td(otc,i+1,t+1).innerHTML = '('+format_number(rate) + '%) ' +format_currency(tax[t].total_amount, erpnext.get_currency(doc.company));
}
}

View File

@@ -27,8 +27,6 @@ wn.require('app/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_
wn.require('app/utilities/doctype/sms_control/sms_control.js');
// ONLOAD
// ================================================================================================
cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
@@ -148,7 +146,6 @@ cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
}
//================ create new contact ============================================================================
cur_frm.cscript.new_contact = function(){
tn = wn.model.make_new_doc_and_get_name('Contact');
locals['Contact'][tn].is_customer = 1;
@@ -156,11 +153,6 @@ cur_frm.cscript.new_contact = function(){
loaddoc('Contact', tn);
}
// DOCTYPE TRIGGERS
// ================================================================================================
// ***************** Get project name *****************
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
@@ -171,20 +163,22 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
}
// *************** Customized link query for QUOTATION *****************************
cur_frm.fields_dict['quotation_no'].get_query = function(doc) {
var cond='';
if(doc.order_type) cond = ' ifnull(`tabQuotation`.order_type, "") = "'+doc.order_type+'" and';
if(doc.customer) cond += ' ifnull(`tabQuotation`.customer, "") = "'+doc.customer+'" and';
if(doc.order_type) cond = ' ifnull(`tabQuotation`.order_type, "") = "'
+doc.order_type+'" and';
if(doc.customer) cond += ' ifnull(`tabQuotation`.customer, "") = "'
+doc.customer+'" and';
return repl('SELECT DISTINCT name, customer, transaction_date FROM `tabQuotation` WHERE `tabQuotation`.company = "' + doc.company + '" and `tabQuotation`.`docstatus` = 1 and `tabQuotation`.status != "Order Lost" and %(cond)s `tabQuotation`.%(key)s LIKE "%s" ORDER BY `tabQuotation`.`name` DESC LIMIT 50', {cond:cond});
return repl('SELECT DISTINCT name, customer, transaction_date FROM `tabQuotation` \
WHERE `tabQuotation`.company = "'
+ doc.company + '" and `tabQuotation`.`docstatus` = 1 \
and `tabQuotation`.status != "Order Lost" \
and %(cond)s `tabQuotation`.%(key)s LIKE "%s" \
ORDER BY `tabQuotation`.`name` DESC LIMIT 50', {cond:cond});
}
// SALES ORDER DETAILS TRIGGERS
// ================================================================================================
// ***************** Get available qty in warehouse of item selected ****************
cur_frm.cscript.reserved_warehouse = function(doc, cdt , cdn) {
var d = locals[cdt][cdn];
if (d.reserved_warehouse) {
@@ -222,7 +216,6 @@ cur_frm.cscript['Make Maintenance Schedule'] = function() {
}
}
//------------ make maintenance visit ------------
cur_frm.cscript.make_maintenance_visit = function() {
var doc = cur_frm.doc;
@@ -251,8 +244,6 @@ cur_frm.cscript.make_maintenance_visit = function() {
}
}
// make indent
// ================================================================================================
cur_frm.cscript['Make Purchase Request'] = function() {
var doc = cur_frm.doc;
if (doc.docstatus == 1) {
@@ -272,8 +263,6 @@ cur_frm.cscript['Make Purchase Request'] = function() {
}
// MAKE DELIVERY NOTE
// ================================================================================================
cur_frm.cscript['Make Delivery Note'] = function() {
var doc = cur_frm.doc;
if (doc.docstatus == 1) {
@@ -293,8 +282,6 @@ cur_frm.cscript['Make Delivery Note'] = function() {
}
// MAKE SALES INVOICE
// ================================================================================================
cur_frm.cscript['Make Sales Invoice'] = function() {
var doc = cur_frm.doc;
@@ -312,36 +299,36 @@ cur_frm.cscript['Make Sales Invoice'] = function() {
}
// STOP SALES ORDER
// ==================================================================================================
cur_frm.cscript['Stop Sales Order'] = function() {
var doc = cur_frm.doc;
var check = confirm("Are you sure you want to STOP " + doc.name);
if (check) {
$c('runserverobj', args={'method':'stop_sales_order', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
$c('runserverobj', {
'method':'stop_sales_order',
'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
}, function(r,rt) {
cur_frm.refresh();
});
}
}
// UNSTOP SALES ORDER
// ==================================================================================================
cur_frm.cscript['Unstop Sales Order'] = function() {
var doc = cur_frm.doc;
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
if (check) {
$c('runserverobj', args={'method':'unstop_sales_order', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
$c('runserverobj', {
'method':'unstop_sales_order',
'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
}, function(r,rt) {
cur_frm.refresh();
});
}
}
//get query select Territory
//=======================================================================================================================
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
}
@@ -350,4 +337,4 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
if(cint(wn.boot.notification_settings.sales_order)) {
cur_frm.email_doc(wn.boot.notification_settings.sales_order_message);
}
}
};

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-22 15:24:17",
"docstatus": 0,
"modified": "2013-01-22 16:55:24",
"modified": "2013-01-23 17:11:29",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -249,6 +249,7 @@
"label": "Net Total*",
"oldfieldname": "net_total",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 0,
"read_only": 1,
"reqd": 0,
@@ -427,6 +428,7 @@
"label": "Taxes and Charges Total*",
"oldfieldname": "other_charges_total",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"read_only": 1,
"width": "150px"
@@ -454,6 +456,7 @@
"label": "Grand Total*",
"oldfieldname": "grand_total",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"read_only": 1,
"reqd": 0,
@@ -466,6 +469,7 @@
"label": "Rounded Total",
"oldfieldname": "rounded_total",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"read_only": 1,
"width": "150px"
@@ -497,6 +501,7 @@
"label": "Grand Total (Export)",
"oldfieldname": "grand_total_export",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 0,
"read_only": 1,
"reqd": 0,
@@ -509,6 +514,7 @@
"label": "Rounded Total (Export)",
"oldfieldname": "rounded_total_export",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 0,
"read_only": 1,
"width": "150px"
@@ -920,6 +926,7 @@
"label": "Total Commission",
"oldfieldname": "total_commission",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1
},
{

View File

@@ -24,7 +24,7 @@ wn.doclistviews['Sales Order'] = wn.views.ListView.extend({
{
width: '18%',
content: function(parent, data) {
$(parent).html(data.currency + ' ' + fmt_money(data.grand_total_export))
$(parent).html(format_currency(data.grand_total_export, data.currency))
},
css: {'text-align':'right'}
},

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:21",
"docstatus": 0,
"modified": "2013-01-22 13:47:03",
"modified": "2013-01-23 17:11:22",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -101,6 +101,7 @@
"label": "Price List Rate",
"oldfieldname": "ref_rate",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 1,
"reqd": 0,
"width": "70px"
@@ -124,6 +125,7 @@
"label": "Rate",
"oldfieldname": "export_rate",
"oldfieldtype": "Currency",
"options": "currency",
"reqd": 0,
"width": "100px"
},
@@ -136,6 +138,7 @@
"no_copy": 0,
"oldfieldname": "export_amount",
"oldfieldtype": "Currency",
"options": "currency",
"read_only": 1,
"reqd": 0,
"width": "100px"
@@ -147,6 +150,7 @@
"label": "Price List Rate*",
"oldfieldname": "base_ref_rate",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"read_only": 1,
"width": "100px"
@@ -159,6 +163,7 @@
"label": "Basic Rate*",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"reqd": 0,
"width": "100px"
@@ -172,6 +177,7 @@
"no_copy": 0,
"oldfieldname": "amount",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"print_hide": 1,
"read_only": 1,
"reqd": 0,
@@ -237,6 +243,7 @@
"fieldtype": "Currency",
"label": "Billed Amt",
"no_copy": 1,
"options": "currency",
"print_hide": 1,
"read_only": 1
},

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:22",
"docstatus": 0,
"modified": "2013-01-22 13:47:40",
"modified": "2013-01-23 17:11:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -73,6 +73,7 @@
"label": "Allocated Amount",
"oldfieldname": "allocated_amount",
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()",
"reqd": 0,
"width": "120px"
},
@@ -94,6 +95,7 @@
"fieldtype": "Currency",
"label": "Incentives",
"oldfieldname": "incentives",
"oldfieldtype": "Currency"
"oldfieldtype": "Currency",
"options": "eval:erpnext.get_currency()"
}
]