Просмотр исходного кода

fixes to currency format

version-14
Rushabh Mehta 12 лет назад
Родитель
Сommit
6d732ec69d
6 измененных файлов: 11 добавлений и 7 удалений
  1. +1
    -1
      public/js/legacy/utils/datatype.js
  2. +1
    -1
      public/js/legacy/widgets/form/fields.js
  3. +3
    -3
      public/js/wn/form/formatters.js
  4. +4
    -0
      public/js/wn/model/meta.js
  5. +1
    -1
      public/js/wn/views/listview.js
  6. +1
    -1
      public/js/wn/views/reportview.js

+ 1
- 1
public/js/legacy/utils/datatype.js Просмотреть файл

@@ -94,7 +94,7 @@ function is_null(v) {
}

function set_value_in(ele, v, ftype, fopt, doc) {
$(ele).html(wn.format(v, {fieldtype:ftype, options:fopt}, doc));
$(ele).html(wn.format(v, {fieldtype:ftype, options:fopt}, null, doc));
return;
}
var $s = set_value_in; // used in print formats


+ 1
- 1
public/js/legacy/widgets/form/fields.js Просмотреть файл

@@ -862,7 +862,7 @@ FloatField.prototype.onmake_input = function() {
}
}
FloatField.prototype.set_disp = function(val) {
this.set_disp_html(wn.format(val, this.df, locals[this.doctype][this.name]));
this.set_disp_html(wn.format(val, this.df, null, locals[this.doctype][this.name]));
}

function PercentField() { } PercentField.prototype = new FloatField();


+ 3
- 3
public/js/wn/form/formatters.js Просмотреть файл

@@ -19,7 +19,7 @@ wn.form.formatters = {
Percent: function(value) {
return cint(value) + "%";
},
Currency: function(value, docfield, doc) {
Currency: function(value, docfield, options, doc) {
var currency = wn.meta.get_field_currency(docfield, doc);
return "<div style='text-align: right'>" + format_currency(value, currency) + "</div>";
},
@@ -95,7 +95,7 @@ wn.form.get_formatter = function(fieldtype) {
return wn.form.formatters[fieldtype.replace(/ /g, "")] || wn.form.formatters.Data;
}

wn.format = function(value, df, options) {
wn.format = function(value, df, options, doc) {
if(!df) df = {"fieldtype":"Data"};
return wn.form.get_formatter(df.fieldtype)(value, df, options);
return wn.form.get_formatter(df.fieldtype)(value, df, options, doc);
}

+ 4
- 0
public/js/wn/model/meta.js Просмотреть файл

@@ -116,6 +116,10 @@ $.extend(wn.meta, {
var options = df.options.split(":");
if(options.length==3) {
// get reference record e.g. Company
var docname = doc[options[1]];
if(!docname) {
docname = cur_frm.doc[options[1]]
}
currency = wn.model.get_value(options[0], doc[options[1]],
options[2]) || currency;
}


+ 1
- 1
public/js/wn/views/listview.js Просмотреть файл

@@ -262,7 +262,7 @@ wn.views.ListView = Class.extend({
}
else if(data[opts.content]) {
$("<span>")
.html(wn.format(data[opts.content], opts.df, data))
.html(wn.format(data[opts.content], opts.df, null, data))
.appendTo(parent)
}


+ 1
- 1
public/js/wn/views/reportview.js Просмотреть файл

@@ -183,7 +183,7 @@ wn.views.ReportView = wn.ui.Listing.extend({
width: (docfield ? cint(docfield.width) : 120) || 120,
formatter: function(row, cell, value, columnDef, dataContext) {
var docfield = columnDef.docfield;
return wn.format(value, docfield, dataContext);
return wn.format(value, docfield, null, dataContext);
}
}
return coldef;


Загрузка…
Отмена
Сохранить