How to import javascript file with variable in odoo15 - odoo

before odoo15 we can import js with variable like this:
<script type="text/javascript" t-attf-src="https://api.map.baidu.com/api?v=3.0&type=webgl&ak=#{baidu_ak}"></script>
but when it comes to odoo15, all js files were moved to __mainfest__.py file, so
is there a way to import js file with varaible?

Related

ImportError: cannot import name 'ugettext' from 'django.utils.translation'

from rest_framework_jwt.views import obtain_jwt_token,refresh_jwt_token,verify_jwt_token
path('auth-jwt/', obtain_jwt_token),
path('auth-jwt-refresh/',refresh_jwt_token),
path('auth-jwt-verify/', verify_jwt_token),
getting error after addding the above urls ,I have installed jwt using this pip install djangorestframework -jwt
I want to implement JWT Authentication
from .serializers import (
File "*\lib\site-packages\rest_framework_jwt\serializers.py", line 7, in
from django.utils.translation import ugettext as _
ImportError: cannot import name 'ugettext' from 'django.utils.translation' (c:\users\dell\downloads\djangoEnvs\djangoEnv\lib\site-packages\django\utils\translation_init_.py)
There are two ways of resolving above issues:
Way 1: (Not recommended Approach)
Steps:
Open the last file in traceback (<path showing in your IDE>\lib\site-packages\rest_framework_jwt\serializers.py) :
In this file, replace ugettext with --> gettext
Enjoy coding!!!! :)
before replace:
from django.utils.translation import ugettext as _
after replace:
from django.utils.translation import gettext as _
Way2 : (Recommended Approach)
Steps are:
Open settings.py (project folder)
On the top of settings.py type below imports
import django
from django.utils.translation import gettext
django.utils.translation.ugettext = gettext
Enjoy Coding !!!!! :)

TinyMCE ERR_ABORTED 404 (Not Found) skins (vue)

I'm facing the console error issue with tinymce on vue.js. It works correctly both localhost and server hovewer editor throws me error on server (doesn't throw error on localhost).
console errors
Here is my import section
[I've tried import files both dynamically and statically, hovewer errors continue to exist]
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js">
import Editor from "#tinymce/tinymce-vue";
import "tinymce/tinymce";
// Theme
import "../../../../../../node_modules/tinymce/themes/silver/theme";
// Skins
import "../../../../../../node_modules/tinymce/skins/ui/oxide/skin.min.css";
import "../../../../../../node_modules/tinymce/skins/ui/oxide/content.min.css";
import "../../../../../../node_modules/tinymce/skins/content/default/content.min.css";
// Plugins
import "../../../../../../node_modules/tinymce/plugins/fullscreen";
import "../../../../../../node_modules/tinymce/plugins/paste";
import "../../../../../../node_modules/tinymce/plugins/autoresize";
import "../../../../../../node_modules/tinymce/icons/default";
</script>
I've solved my issue with writing :init="{content_css: false, skin: false}" property to editor tag

karate.log file is not getting generated

I have placed the logback-test.xml in classpath
karate.log is not getting generated, I have seen there is a file called main.log that gets generated sometime
Here is the project structure
Here is the runner file
package com.org.KarateLearning;
import com.intuit.karate.KarateOptions;
import com.intuit.karate.Results;
import com.intuit.karate.Runner;
import com.intuit.karate.junit4.Karate;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Map;
import java.util.Properties;
import static org.junit.Assert.assertTrue;
public class ParallelTestRunner {
#Test
public void parallel() {
Results res = Runner.path("classpath:features").tags("~#ignore").parallel(5);
assertTrue(res.getErrorMessages(),res.getFailCount()==0);
}}
I have tried placing logback-test.xml in resources and com.org.KarateLearning but karate.log is not getting genearted
Deleted the existing file ( logback-test.xml ) and created a new one from below path under src/test/java
https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/logback-test.xml
Now file is getting generated in target folder
In between it was getting generated outside of target folder. Now its getting generated at correct location inside target folder.
Also note even after deleting the logback-test.xml log was getting generated. (not sure about the reason for it)
Now all works well

Jest does not resolve lodash imports

I'm writing a web component using StencilJS. One of the helper classes (ArrayHelper.ts) which is imported by my component has these import at the top:
import transform from 'lodash/transform';
import isEmpty from 'lodash/isEmpty';
import isEqual from 'lodash/isEqual';
import isObject from 'lodash/isObject';
this all works fine when compiling and serving locally. However, when writing some unit tests and executing them using jest, jest can't resolve these imports properly:
TypeError: isObject_1.default is not a function at Function.Object.
<anonymous>.ArrayHelper.toArray (/mycomponent/ArrayHelper.ts:15:35)
When I change the imports in ArrayHelper.ts to
import { isEmpty, isEqual, isObject, transform } from 'lodash';
then Jest will succesfully run the tests without problems but then the TS compilation by stencilJS doesn't work any more:
Missing Export: mycomponents/ArrayHelper.js:5:27
'isObject' is not exported by node_modules/lodash/lodash.js
Any ideas how to get these imports right for both situations?
Try import lodash like this
import * as _ from "lodash";
Try adding this to your stencil.config.js:
nodeResolve: {
browser: true
}
This is happening because lodash is not available where Jest is running your tests. Is it an experimental browser technology.
Refer - Link1 Link2
import * as transform from 'lodash/transform';
import * as isEmpty from 'lodash/isEmpty';
import * as isEqual from 'lodash/isEqual';
import * as isObject from 'lodash/isObject';

Robot framework - Ride - unable to OpenBrowser - nothing specific in the log

I'm trying to run this simple test on RIDE, but I cannot figure out it's failing without giving me any specific details:
Ride Log
command: pybot.bat --argumentfile c:\users\user\appdata\local\temp\RIDEe2en9t.d\argfile.txt --listener C:\Python27\lib\site-packages\robotide\contrib\testrunner\TestRunnerAgent.py:49555:False C:\Python27\Scripts\test\Login\login_suite.robot
========================================================================================================================================================================
Login Suite
========================================================================================================================================================================
login_user | FAIL |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/assets/displayhelpservlet.css" media="all"/>
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon" />
<script src="/assets/jquery-3.1.1.min.js" type="text/javascript"></script>
<script src="/assets/displayhelpservlet.js" type="text/javascript"></script>
<script type="text/javascript">
var json = Object.freeze('{"consoleLink":"/wd/hub","type":"Standalone","version":"3.11.0","class":"org.openqa.grid.web.servlet.DisplayHelpServlet$DisplayHelpServletConfig"}');
</script>
</head>
<body>
<div id="content">
<div id="help-heading">
<h1><span id="logo"></span></h1>
[ Message content over the limit has been removed. ]
</span>
</p>
<p>
Happy Testing!
</p>
</div>
<div>
<footer id="help-footer">
Selenium is made possible through the efforts of our open source community, contributions from
these people, and our
sponsors.
</footer>
</div>
</div>
</body>
</html>
Selenium server is started (standalone-3.11.0)
Python version 2.7
Environment Path is set Python27/Scripts
Here is the test code:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
login_user
SeleniumLibrary.Open Browser Google.com googlechrome
Maximize Browser Window
Title Should Be Google
The webdriver for Chrome is also set in Scripts folder, but I've tried it with Firefox as well and got the same result.
EDIT:
so i have tried with this code
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
login_user
SeleniumLibrary.Open Browser https://google.com googlechrome
Maximize Browser Window
Title Should Be Google
If you have
Selenium
Robot Framework
RIDE (for running robot files)
Chrome
The only thing you have to do is download chromedriver.
https://chromedriver.storage.googleapis.com/index.html?path=2.38/
After you have download the chromedriver put it to a folder and add it to your path.
The way i have done after unzipping chromedriver
Ubuntu:
sudo mv chromedriver /usr/local/bin/
sudo chown root:root /usr/local/bin/chromedriver
Windows:
put chromedriver.exe into a folder in this example C:\drivers\
Press Windows button on your keyboard and type Edit the system environment variables
Under Advanced tab, Click Environment Variables
List item
Under System Variables find "Path" and click on Path and Edit button
Click new and add the path where you have put the chromedriver
in this example C:\drivers\chromedriver