From 477b83f6da625af8801f8e026246f1b8173d6d09 Mon Sep 17 00:00:00 2001 From: Iryna Vyshnevska Date: Mon, 14 Jan 2019 13:46:49 +0200 Subject: [PATCH] [FIX] open account.move on currency sign --- .../account_financial_report_qweb_widgets.js | 138 ++++++++++-------- 1 file changed, 77 insertions(+), 61 deletions(-) diff --git a/account_financial_report_qweb/static/src/js/account_financial_report_qweb_widgets.js b/account_financial_report_qweb/static/src/js/account_financial_report_qweb_widgets.js index 8957edbe..53ba2816 100644 --- a/account_financial_report_qweb/static/src/js/account_financial_report_qweb_widgets.js +++ b/account_financial_report_qweb/static/src/js/account_financial_report_qweb_widgets.js @@ -1,69 +1,85 @@ odoo.define('account_financial_report_qweb.account_financial_report_widget', function (require) { -'use strict'; + 'use strict'; -var Widget = require('web.Widget'); + var Widget = require('web.Widget'); -var accountFinancialReportWidget = Widget.extend({ - events: { - 'click .o_account_financial_reports_web_action': 'boundLink', - 'click .o_account_financial_reports_web_action_multi': 'boundLinkmulti', - 'click .o_account_financial_reports_web_action_monetary': 'boundLinkMonetary', - 'click .o_account_financial_reports_web_action_monetary_multi': 'boundLinkMonetarymulti', - }, - init: function() { - this._super.apply(this, arguments); - }, - start: function() { - return this._super.apply(this, arguments); - }, - boundLink: function(e) { - var res_model = $(e.target).data('res-model'); - var res_id = $(e.target).data('active-id'); - return this.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - res_id: res_id, - views: [[false, 'form']], - target: 'current' - }); - }, - boundLinkmulti: function(e) { - var res_model = $(e.target).data('res-model'); - var domain = $(e.target).data('domain'); - return this.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - domain: domain, - views: [[false, "list"], [false, "form"]], - target: 'current' - }); - }, - boundLinkMonetary: function(e) { - var res_model = $(e.target.parentElement).data('res-model'); - var res_id = $(e.target.parentElement).data('active-id'); - return this.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - res_id: res_id, - views: [[false, 'form']], - target: 'current' - }); - }, - boundLinkMonetarymulti: function(e) { - var res_model = $(e.target.parentElement).data('res-model'); - var domain = $(e.target.parentElement).data('domain'); - return this.do_action({ - type: 'ir.actions.act_window', - res_model: res_model, - domain: domain, - views: [[false, "list"], [false, "form"]], - target: 'current' - }); - }, -}); + var accountFinancialReportWidget = Widget.extend({ + events: { + 'click .o_account_financial_reports_web_action': + 'boundLink', + 'click .o_account_financial_reports_web_action_multi': + 'boundLinkmulti', + 'click .o_account_financial_reports_web_action_monetary': + 'boundLinkMonetary', + 'click .o_account_financial_reports_web_action_monetary_multi': + 'boundLinkMonetarymulti', + }, + init: function () { + this._super.apply(this, arguments); + }, + start: function () { + return this._super.apply(this, arguments); + }, + boundLink: function (e) { + var res_model = $(e.target).data('res-model'); + var res_id = $(e.target).data('active-id'); + return this.do_action({ + type: 'ir.actions.act_window', + res_model: res_model, + res_id: res_id, + views: [[false, 'form']], + target: 'current', + }); + }, + boundLinkmulti: function (e) { + var res_model = $(e.target).data('res-model'); + var domain = $(e.target).data('domain'); + return this.do_action({ + type: 'ir.actions.act_window', + res_model: res_model, + domain: domain, + views: [[false, "list"], [false, "form"]], + target: 'current', + }); + }, + boundLinkMonetary: function (e) { + var res_model = $(e.target).data('res-model'); + var res_id = $(e.target).data('active-id'); + // check if we call on appropriate element, amount been wrapped in + // a span by a monetary widget + if (e.target.localName === 'span' ) { + res_model = $(e.target.parentElement).data('res-model'); + res_id = $(e.target.parentElement).data('active-id'); + } + return this.do_action({ + type: 'ir.actions.act_window', + res_model: res_model, + res_id: res_id, + views: [[false, 'form']], + target: 'current', + }); + }, + boundLinkMonetarymulti: function (e) { + var res_model = $(e.target).data('res-model'); + var domain = $(e.target).data('domain'); + // check if we call on appropriate element, amount been wrapped in + // a span by a monetary widget + if (e.target.localName === 'span' ) { + res_model = $(e.target.parentElement).data('res-model'); + domain = $(e.target.parentElement).data('domain'); + } + return this.do_action({ + type: 'ir.actions.act_window', + res_model: res_model, + domain: domain, + views: [[false, "list"], [false, "form"]], + target: 'current', + }); + }, + }); -return accountFinancialReportWidget; + return accountFinancialReportWidget; });