Odoo.sh Upgrade to v15 : how to migrate obsolete but inherited views? - migration

I am currently following the UPGRADE process in odoo.sh to migrate to Odoo v15.
Because some of the templates have been removed or renamed in v15, I got 100 errors similar to:
ValueError: External ID not found in the system: website_blog.s_latest_posts
Most of these errors are caused by the third party template on version 13.
How to deal with (Theme-) templates which are not existing anymore in the destination (v15) version but used as inherited template in the current version (v13)?
For example:
website_blog.s_latest_posts.xml is existing in the official src/odoo/addons in v13 but not in v15. And I have custumized this template using inherit:
<template id="my_s_latest_post" inherit_id="website_blog.s_latest_posts"><xpath="..."></xpath></template>
The "third party theme" module "third_party_theme" inherits from it:
<template id="thirdpartytheme_s_latest_post" inherit_id="website_blog.s_latest_posts"><xpath="..."></xpath></template>
and other of my custom templates which inherit from third_party_theme 's template:
<template id="my_other_s_latest_post" inherit_id="third_party_theme.thirdpartytheme_s_latest_post"><xpath="..."></xpath></template>
or other parts of my custom templates or third party theme CALL the original template:
<template><xpath=xxx>
<t t-call=third_party_theme.thirdpartytheme_s_latest_post...
And because the website_blog.s_latest_posts.xml is not existing anymore in v15, during the migration process (odoo.sh), such an error occurs: ValueError: External ID not found in the system: website_blog.s_latest_posts
I have heard about pre-migrate scripts to disable views during migration process:
https://www.youtube.com/watch?v=n0jQQlEnUUQ
but i can t figure out how to manage the steps to handle views (see screen shots in attach). Scripts examples (pre-migrate.py, post-migrate.py and end-migrate.py) are welcome :)
I have also tried to figure out what to do with the OpenUpgrade informations: https://github.com/OCA/OpenUpgrade/blob/15.0/openupgrade_scripts/scripts/website_blog/15.0.1.1/upgrade_analysis.txt
For instance:
---Models in module 'website_blog'---
---Fields in module 'website_blog'---
---XML records in module 'website_blog'---
NEW ir.asset: website_blog.s_blog_posts_000_js
NEW ir.ui.view: website_blog.s_blog_posts
DEL ir.ui.view: website_blog.assets_editor
DEL ir.ui.view: website_blog.assets_frontend
DEL ir.ui.view: website_blog.assets_snippet_s_latest_posts_css_000
DEL ir.ui.view: website_blog.s_latest_posts
DEL ir.ui.view: website_blog.s_latest_posts_big_picture_template
NEW website.snippet.filter: website_blog.dynamic_filter_latest_blog_posts

Related

ACE editor - allow custom modes and themes in Angular/TypeScript

Introduction:
I've an Angular application where custom SQL statements can be written by using the ACE editor (https://ace.c9.io/). Even though there are modes and themes for SQL, I wanted to create a custom mode and a custom theme for my requirements.
Setup:
I followed this tutorial: https://blog.shhdharmen.me/how-to-setup-ace-editor-in-angular
ng new ace-app (Angular 13.3.2)
npm install ace-builds (ACE-Builds 1.4.14)
component.ts
import * as ace from 'ace-builds';
...
public aceEditor: ace.Ace.Editor;
#ViewChild('editor') private editor!: ElementRef<HTMLElement>;
...
ngAfterViewInit(): void {
// I don't understand why we don't set the "basePath" to our installed package
ace.config.set('basePath', 'https://unpkg.com/ace-builds#1.4.12/src-noconflict');
this.aceEditor = ace.edit(this.editor.nativeElement);
if (this.aceEditor) {
this.aceEditor.setOptions({
mode: 'ace/mode/sql',
theme: 'ace/theme/sqlserver',
});
}
component.html
<div #editor></div>
Result:
The editor is working, but now I need to somehow add a custom mode and theme.
Problems and Questions:
Is it correct to set the basePath to an external URL if I've the package already installed (obsolete due to Edit 1)?
How and where would I add the custom mode.js and theme.js?
How can I direct ace to the custom mode.js and theme.js?
Edit 1:
I managed to get rid of this line of code:
ace.config.set('basePath', 'https://unpkg.com/ace-builds#1.4.12/src-noconflict');
by directly importing the theme and mode with:
import 'ace-builds/src-noconflict/mode-sql';
import 'ace-builds/src-noconflict/theme-sqlserver';
the rest of the code did not have to be changed.
After looking through several projects and issues, I figured out that the best way to implement custom themes and modes for the ACE editor is to copy existing ones from ./node-modules/ace-builds/src-conflict and paste them to ./src/assets/ace.
Example:
Copy an existing mode (and optionally the theme) that represents your required syntax highlighting the most, in my case it was mode-sql.js. I copied the files to ./src/assets/ace and changed the import in my component.ts from:
import 'ace-builds/src-noconflict/mode-sql';
import 'ace-builds/src-noconflict/theme-sqlserver';
To:
import '../../../../assets/ace/mode-sql.js';
import '../../../../assets/ace/theme-sqlserver.js';
Everything else was kept exactly as described in the initial question. From there you can start to change the name of mode and theme, update the rules as well as the styling according to your requirements.

Prestashop LOG: get DUMP of Object and Array

I am figuring out how Prestashop 1.7 works and I have some experience with Symfony.
In Symfony development mode [Symfony project url]/_profiler is useful, among other things, to check the dump($someVariable) of variables in a request.
With Prestashop 1.7 in the admin mode it is possible to do [Prestashop project url]/admin[some random chain of chars]/_profiler to display the Symfony _profiler and analyse what's going on in the requests concerning the admin mode.
But if outside the admin mode (in the virtual shop demo mode), [Prestashop project url]/_profiler or [Prestashop project url]/[language value]/_profiler does not display the Symfony _profiler.
I have tried Prestashop own profiler by activating define('_PS_DEBUG_PROFILING_', true); in [prestashop project]/config/defines.inc.php. It displays Prestashop profiler at the bottom of the "virtual shop demo mode" but this one does not include dump($someVariable) that could be used, for development and to understand Prestashop behaviour, in a hookAction[action name].
I've managed to get the Symfony dump($someVariable) with hookDisplay[display name] through the HTML generated but not in a hookAction[action name] which is what I am looking for.
UPDATE
Looking at Prestashop 1.7 code I almost have the feeling that Symfony is only used on the Admin side, because I can see:
$kernel = new AppKernel(_PS_MODE_DEV_?'dev':'prod', _PS_MODE_DEV_); in [Prestashop project url]/admin[some random chain of chars]/index.php but I don't see it in [Prestashop project url]/index.php.
Best solution I've found so far is to create a custom logger similar to the one explained here
I've created file: [Prestashop project]/modules/[my module]/classes/CustomLogger.php
<?php
class CustomLogger {
const DEFAULT_LOG_FILE ="prestashop_system.log";
public static function log($message, $level = 'debug', $fileName = null){
$fileDir = _PS_ROOT_DIR_ . '/log/';
$fileName=self::DEFAULT_LOG_FILE;
if(is_array($message) || is_object($message)){$message = print_r($message, true);}
$formatted_message=$level." -- ".date('Y/m/d - H:i:s').": ".$message."\r\n";
return file_put_contents($fileDir . $fileName, $formatted_message, FILE_APPEND);
}
}
?>
In '[Prestashop project]/modules/[my module]/[my module].php' it is declared at the top:
include_once dirname(__FILE__).'/classes/CustomLogger.php';
And use CustomLogger::log($[some variable]); in your code.

Elm Graphics.Input

I'm trying to run the Elm input examples from this page. Specifically, the Text Field example, and I'm getting an error saying that the Graphics.Input module is missing.
I've got this in a file called Main.elm:
import Graphics.Input as Input
main = let (field, state) = Input.field "Type here!"
in lift2 display field state
display field state =
field `above` asText state
If I run elm-server and navigate to localhost:8000, I get the error
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
Error: Module 'Graphics.Input' is missing. Compile with --make flag or load missing module in a separate JavaScript file.
The problem may stem from an improper usage of:
Input.field, above
Compiling the project with elm --make Main.elm gives me
elm: Graphics/Input.elm: openFile: does not exist (No such file or directory)
Is there something extra I need to do to install the Graphic.Input?
Additional Notes:
I'm running this on a Debian machine, and installed it using cabal install elm fairly recently (Jun 15 2013). The current version is labeled Elm-0.7.1.1.
If I hop into the chromium JS prompt and poke around, it turns out there's no Elm.Graphics.Input module, but there is an Elm.Input. There isn't a function called field, there's a similar looking one called textField, but it isn't trivially interchangeable.
Running this:
import Input
main = let (field, state) = textField "Type here!"
in lift2 display field state
display field state =
field `above` asText state
gives me the error
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
TypeError: a is undefined
The problem may stem from an improper usage of:
above
The Graphics.Input package is new in version 0.8. So, since you're running version 0.7, that explains your problem.
0.8 was released somewhat recently, but it's definitely been out longer than June 15th, so you probably just forgot to cabal update before installing it. Running cabal update now and then updating elm to 0.8 should fix your issue.

How to use a dependency of a module within a Play app

I am writing a Play Framework module in order to share some common logic among multiple Play apps. One of the things I would like my module to do is provide some frequently-used functionality by way of 3rd-party modules, for example the excellent Markdown module.
First of all, is it possible to do this? I want all the apps that include my module to be able to use the .markdown().raw() String extension without needing to explicitly declare the Markdown module as a dependency. The Play Framework Cookbook chapter 5 seems to imply that it is possible, unless I am reading it wrong.
Secondly, if it is possible, how does it work? I have created the following vanilla example case, but I'm still getting errors.
I created a new, empty application "myapp", and a new, empty module "mymod", both in the same parent directory. I then modified mymod/conf/dependencies.yml to:
self: mymod -> mymod 0.1
require:
- play
- play -> markdown [1.5,)
I ran play deps on mymod and it successfully downloaded and installed the Markdown module. Running play build-module also worked fine with no errors.
Then, I modified myapp/conf/dependencies.yml to:
# Application dependencies
require:
- play
- mymod -> mymod 0.1
repositories:
- Local Modules:
type: local
artifact: ${application.path}/../[module]
contains:
- mymod
I ran play deps on myapp and it successfully found mymod, and generated the myapp/modules/mymod file, containing the absolute path to mymod.
I ran myapp using play run and was able to see the welcome page on http://localhost:9000/. So far so good.
Next, I modified myapp/app/views/Application/index.html to:
#{extends 'main.html' /}
#{set title:'Home' /}
${"This is _MarkDown_, by [John Gruber](http://daringfireball.net/projects/markdown/).".markdown().raw()}
I restarted myapp, and now I get the following error.
09:03:23,425 ERROR ~
#6a6eppo46
Internal Server Error (500) for request GET /
Template execution error (In /app/views/Application/index.html around line 4)
Execution error occured in template /app/views/Application/index.html. Exception raised was MissingMethodException : No signature of method: java.lang.String.markdown() is applicable for argument types: () values: [].
play.exceptions.TemplateExecutionException: No signature of method: java.lang.String.markdown() is applicable for argument types: () values: []
at play.templates.BaseTemplate.throwException(BaseTemplate.java:86)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:257)
at play.templates.Template.render(Template.java:26)
at play.templates.GroovyTemplate.render(GroovyTemplate.java:187)
at play.mvc.results.RenderTemplate.<init>(RenderTemplate.java:24)
at play.mvc.Controller.renderTemplate(Controller.java:660)
at play.mvc.Controller.renderTemplate(Controller.java:640)
at play.mvc.Controller.render(Controller.java:695)
at controllers.Application.index(Application.java:13)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)
Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.String.markdown() is applicable for argument types: () values: []
at /app/views/Application/index.html.(line:4)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:232)
... 13 more
And just to confirm I'm not crazy, I tried adding the play -> markdown [1.5,) line to myapp/conf/dependencies.yml and restarted the app, and confirmed that it works.
I feel like I'm missing something obvious. Many thanks in advance to anyone who can help! :)
Yes I had the same problem, it seems that transitive dependencies through custom home made modules does not work

Spring Roo , Custom Dojo Build

I have been attempting to implement a custom dojo build to replace the dojo version that comes with spring roo 1.1.5.
I followed the instructions at
http://sagittech.blogspot.com/2011/08/asdadsad-qwasdace-aavvrv-place-holder.html
as well as
http://www.qc4blog.com/?p=1001
I have been able to create the builds.
My problem is that when I place the new build into the project like
WEB-INF\classes\META-INF\web-resources\dojo-1.6.2\
(FYI: I renamed the version from 1.6.1 to 1.6.2 to avoid conflict with same version as in
Roo.)
When I load my web page I get
syntax error
http://localhost:8080/app-1.0.0/resources/dojo-1.6.2/dojo/dojo.js
Line 14
also
missing ) after argument list
http://localhost:8080/app-1.0.0/
Line 3
dojo is not defined
http://localhost:8080/app-1.0.0/resources/spring/Spring-Dojo.js
Line 16
So, the question is:
What is the proper way to integrate a new custom dojo build with Spring Roo?
Is there a special way to build dojo to make this happen?
Are there additional steps required to make a custom build work with Roo?
Update:
Below is my profile file to create the new dojo.js
dependencies = {
optimize:"shrinksafe",
stripConsole: "normal",
cssOptimize: "comments",
layers:
[
{
name: "dojo.js",
layerDependencies:
[
"dojo.js",
],
dependencies:
[
"dijit.Dialog",
"dijit.Tooltip",
"dijit.form.DateTextBox",
"dijit.form.CheckBox",
"dijit.form.CurrencyTextBox",
"dojox.widget.Standby",
"dijit.form.ComboBox",
"dijit.form.FilteringSelect",
"dojox.form.PasswordValidator",
"dojo.parser",
"dijit.form.Form",
"dojox.grid.EnhancedGrid",
"dojo.data.ItemFileWriteStore",
"dijit.TitlePane",
"dijit.layout.LayoutContainer",
"dijit.layout.BorderContainer",
"dijit.form.SimpleTextarea",
"dijit.form.Textarea",
"dojo.date.locale",
"dojo.data.ItemFileReadStore",
"dojox.grid.cells.dijit",
"dojox.grid.DataGrid",
"dijit.form.Button",
"dijit.form.ValidationTextBox",
"dijit.Dialog",
"dijit.form.NumberSpinner",
"dojox.grid.enhanced.plugins.Menu",
"dojox.grid.enhanced.plugins.NestedSorting",
"dojox.grid.enhanced.plugins.IndirectSelection",
"dijit.MenuItem",
"dijit.MenuSeparator",
"dijit.PopupMenuItem",
"dijit.Menu",
"dojox.form.Uploader",
"dojox.form.uploader.FileList",
"dojox.form.uploader.plugins.Flash",
"dijit.form.Select"
]
}
],
prefixes: [
["dijit", "../dijit"],
["dojox", "../dojox"]
]
}
After making sure that I made the new optimized file the same as dojo.js to insure that dojo was found I now get the following error:
failed loading /app-1.0.0/resources/dojo-1.6.2/dojo/./parser.js with error: SyntaxError: syntax error
http://localhost:8080/app-1.0.0/resources/dojo-1.6.2/dojo/dojo.js
Line 14
I solved this in part by an answer given at
http://forum.springsource.org/showthread.php?118073-javascript-files-not-loading
I made sure that I had
<script type="text/javascript">dojo.require("dojo.parser");<!-- required for FF3 and Opera --></script>
Also, I had to verify that
<c:set var="dojo_baseline">/resources/dojo-1.6.2/</c:set>
pointed to the correct folder. Previously I had it at 1.6.1
also, that
webmvc-config.xml
looked like
<mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>