[FIX] gamification, web: separate gamification/crash_manager

Fix for: https://github.com/odoo/odoo/pull/32132

A reference to gamification was still made in the crash_manager.

Part of: https://github.com/odoo/odoo/pull/35209
This commit is contained in:
fja-odoo
2019-07-30 16:00:05 +00:00
parent 2d6dc75a2c
commit 09681e5660
3 changed files with 41 additions and 11 deletions
@@ -0,0 +1,20 @@
odoo.define('gamification.CrashManager', function (require) {
"use strict";
const core = require('web.core');
const CrashManager = require('web.CrashManager').CrashManager;
const _lt = core._lt;
CrashManager.include({
/**
* @override
*/
getMapTitle() {
return {
...this._super(...arguments),
karma_error: _lt("Karma Error"),
};
},
});
});
@@ -4,4 +4,10 @@
<link rel="stylesheet" type="text/scss" href="/gamification/static/src/scss/gamification.scss"/>
</xpath>
</template>
<template id="assets_common" inherit_id="web.assets_common">
<xpath expr="script[last()]" position="after">
<script type="text/javascript" src="/gamification/static/src/js/crash_manager.js"/>
</xpath>
</template>
</odoo>
@@ -10,17 +10,6 @@ var Widget = require('web.Widget');
var _t = core._t;
var _lt = core._lt;
var map_title ={
user_error: _lt("User Error"),
warning: _lt("Warning"),
access_error: _lt("Access Error"),
missing_error: _lt("Missing Record"),
validation_error: _lt("Validation Error"),
except_orm: _lt("Global Business Error"),
access_denied: _lt("Access Denied"),
karma_error: _lt("Karma Error"),
};
// Register this eventlistener before qunit does.
// Some errors needs to be negated by the crash_manager.
window.addEventListener('unhandledrejection', ev =>
@@ -157,6 +146,20 @@ var CrashManager = AbstractService.extend({
disable: function () {
active = false;
},
/**
* @return {Object}
*/
getMapTitle() {
return {
access_denied: _lt("Access Denied"),
access_error: _lt("Access Error"),
except_orm: _lt("Global Business Error"),
missing_error: _lt("Missing Record"),
user_error: _lt("User Error"),
validation_error: _lt("Validation Error"),
warning: _lt("Warning"),
};
},
handleLostConnection: function () {
var self = this;
if (!this.isConnected) {
@@ -185,6 +188,7 @@ var CrashManager = AbstractService.extend({
if (!document.body) {
return;
}
var map_title = this.getMapTitle();
if (!active) {
return;
}