odoo currency symbol display mechanism Monetary

//-------------------------------------------------------------------
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;

});
// ------------------------------------------------ ------------------- 
call this.session_init in session_bind () in ()

call this.session_reload in this.session_init () in ()

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

when running into session_reload session_info has got res_currency currency information

wfk! ! !
Go down to the bottom to engage in when not clear what it means:
window.odoo What is this stuff?
What window is?
interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch, WindowOrWorkerGlobalScope, WindowEventHandlers {
//-------------------------------------------------------------------


Guess you like

Origin www.cnblogs.com/yanhuaqiang/p/11708509.html