码迷,mamicode.com
首页 > Web开发 > 详细

odoo 币别符号显示机制 Monetary

时间:2019-10-20 20:24:32      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:是什么   func   format   handlers   result   time   ||   end   ext   

//-------------------------------------------------------------------
basic_fields.js
init: function () {
this._setCurrency();
//-------------------------------------------------------------------
_setCurrency: function () {
var currencyField = this.nodeOptions.currency_field || this.field.currency_field || ‘currency_id‘;
var currencyID = this.record.data[currencyField] && this.record.data[currencyField].res_id;
this.currency = session.get_currency(currencyID);
this.formatOptions.currency = this.currency;
//-------------------------------------------------------------------
core/session.js
get_currency: function (currency_id) {
return this.currencies[currency_id];
},
//-------------------------------------------------------------------
service/session.js
odoo.define(‘web.session‘, function (require) {
"use strict";

  var Session = require(‘web.Session‘);
  var modules = odoo._modules;

  var session = new Session(undefined, undefined, {modules: modules, use_cors: false});
  session.is_bound = session.session_bind();

  return session;

});
//-------------------------------------------------------------------
在session_bind()中调用this.session_init()

在this.session_init()中调用this.session_reload()

session_reload: function () {
var result = _.extend({}, window.odoo.session_info);
delete result.session_id;
_.extend(this, result);
return $.when();
}

在运行到session_reload时session_info中已经拿到了res_currency的币种信息

wfk!!!
再往底层就搞不明时什么意思了:
window.odoo是什么玩意?
window 又是什么?
interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch, WindowOrWorkerGlobalScope, WindowEventHandlers {
//-------------------------------------------------------------------


odoo 币别符号显示机制 Monetary

标签:是什么   func   format   handlers   result   time   ||   end   ext   

原文地址:https://www.cnblogs.com/yanhuaqiang/p/11708509.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!