Odoo Migration v13 to v15: how to handle deleted or renamed views - migration

In Odoo.sh, I am currently following the UPGRADE process to migrate from Odoo v13 to 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>
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 handle views during migration process: https://www.youtube.com/watch?v=n0jQQlEnUUQ but i can t figure out how to migrate views as described above (pre-migrate.py, post-migrate.py and end-migrate.py) as described in https://github.com/OCA/OpenUpgrade/blob/15.0/openupgrade_scripts/scripts

Related

How to create a DNN widget?

If I understood correctly, DNN widget is a way to add a js to every page on the website using module or theme. Right?
My goal evantually is to add a js to every page on a portal and preferably to do that via module that has no need to be added to every page manually.
My plan B is adding module and using setting "Display Module on All Pages", but widget seems to be a better way to do that.
At first I've tried to use this instruction. I've added the YourCompany.Widgets.SampleWidget.js file to root of existing DNN module. Also in the .dnn manifest file inside components tag I've added another component like this:
<component type="Widget">
<widgetFiles>
<basePath>YourCompany</basePath>
<widgetFile>
<name>YourCompany.Widgets.SampleWidget.js</name>
</widgetFile>
<widgetFile>
<name>license.txt</name>
</widgetFile>
<widgetFile>
<name>releasenotes.txt</name>
</widgetFile>
</widgetFiles>
</component>
I've got this error on module installation:
Failure File specified in the dnn could not be found in the zip file: - D:\Projects\website.com.ua\Host\Install\Temp\vp1vioj1\YourCompany.Widgets.SampleWidget.js
vp1vioj1 part is changing every time (seems like it's some unique id that is generating on module install).
Then I tried to place this widget component inside another package tag after checking this article. Like this:
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="ModuleName" type="Module" version="00.00.01">
<!-- some module content here -->
</package>
<package name="YourCompany.SampleWidget" type="Widget" version="00.00.01">
<components>
<component type="Widget">
<widgetFiles>
<basePath>YourCompany</basePath>
<widgetFile>
<name>YourCompany.Widgets.SampleWidget.js</name>
</widgetFile>
</widgetFiles>
</component>
</components>
</package>
</packages>
</dotnetnuke>
But I still got the same error on install. I didn't find any other instructions or documentations regarding widgets. When I tried to check the DNN source code - it seems to be also very time consuming and hard way.
So could you please help me to clarify this?
Support for Widgets in DNN Platformnwas dropped a number of years ago.
Your best option if you want something ok all pages would either be to look at a SkinObject, like the breadcrumb or Login for example. Or a traditional module but marking it “display on all pages”
First, you might want to take a look at the concept of DNN Extensions and how they are built and packaged.
If examples of versions DNN extensions, https://github.com/WillStrohl/dnnextensions. The examples include a widget. So check it out.
Now, what you posted looks like a .dnn file, which the the manifest file that is intended to be a part of a packaged DNN extension. Code and other bits and pieces go into the packaged extension (really a specially named zip file). The packaged extension is installed into your DNN installation via the Extensions Persona Bar page (click the Install Extension there).
From my experience with DNN (2006 to now), I believe that I can say that a DNN Widget is something that I've never had anything to do with. So, you may be barking up an old any dying tree in the project.
If you want something included on every page, it makes more sense to include it in the theme (skin). If you want a javascript file, add that to your theme project and have the .ascx files include it, probably using https://docs.dnncommunity.org/api/DotNetNuke.Web.Client.ClientResourceManagement.html (see https://docs.dnncommunity.org/api/DotNetNuke.Web.Client.ClientResourceManagement.html)
But, if you are determined to use a widget, start with https://www.kalyani.com/blog/2009/12/25/dotnetnuke-widgets-guide-part-1-of-4/

vue3: instant prototyping multiple root elements

I try to use instant prototyping in Vue3, having installed #vue/cli and #vue/cli-service-global, got this error:
Failed to compile.
./Alert.vue
Module Error (from /usr/local/lib/node_modules/#vue/cli-service-global/node_modules/eslint- loader/index.js):
/home/xrfang/git/deployer/gui/src/components/Alert.vue
5:3 error The template root requires exactly one element vue/no-multiple-template-root
✖ 1 problem (1 error, 0 warnings)
As far as I know "template root requires exactly one element" is a requirement in Vue2, Vue3 should allow multiple root elements in one template?
As this answer suggests, wrap all the code inside the template tags in a single parent div.
Otherwise, to simply stop the error form displaying, Visual Studio Code (VSC) users can do the following:
Open "extensions" in VSC
Find and open "Vetur" extension by Pine Wu
Click the gear and select "extension settings"
Scroll down to "Vetur > Validation: Template" and uncheck the box
This is built upon #wittgenstein's comment above to "follow the steps in the guide: vuejs.github.io/vetur/guide/linting-error.html#linting"
This worked for me, but beware that I'm a novice and it's possible there are drawbacks to the above that I'm not aware of.

Is it possible to include vuetify in a library bundle?

I have two Vue projects, one is an app that is injected in an older website via script-tag and a second project, that is a form, that uses own logic and vuetify components. The later should be used in other projects also and gets props from where it is used. Therefore it should be compiled as a library.
If i compile it as app i can transfer data via a global JS variable, but i would like to use the components like any other library. (Just import it and put it in the <template> like so: <MyComponent ..props../>)
If i compile it as a library i got all sorts of vuetify not correctly initialized. After i cleared them my HTML looked excactly like my code (eg:<v-app>...</v-app>) without any errors.
The 'serve' from the standard installation worked without a problem in the component project.
The component project is created with vue create project and modified according to https://cli.vuejs.org/guide/build-targets.html#library
I already searched online and got only so far, my question on the vue discord was left unanswered, so my questions are:
1. Is this even possible to do?
2. If it is, could you please point me in a direction, or give a summary of what i have to do?
3. If not, is there another way of achieving this, except for copying the raw code into each project?
Short answer, yes. Is it recommended, no.
The best way to do this is to export your form component as a library so that it can be imported into other projects but exclude any dependencies like Vuetify, which should be imported separately. This avoids versioning errors.
The Vue docs on packaging for npm are useful as is this article

How to update template views in Odoo while developing?

Is there an easy way for updating changes made in a template view when developing a module? Or what's the best approach for having a preview of what I'm coding?
I currently upgrade the module each time I change the template, but it costs me a lot of time.
If you run Odoo with the command-line --dev option, you have the following additional arguments:
all: all the features below are activated
XML: read template qweb from XML file directly instead of a database. Once a template has been modified in the database, it will be not be read from the XML file until the next update/init.
reload: restart the server when python file is updated (may not be detected depending on the text editor used)
qweb: break in the evaluation of qweb template when a node contains t-debug='debugger'
(i)p(u)db: start the chosen python debugger in the code when an unexpected error is raised before logging and returning the error.
See this Click Here
Thanks

Modify product labels xml in Odoo

I’m having several issues when trying to modify the default template of product labels. I need to add some new fields to the existing template that generates the document of product labels (and to design in with proper dimensions).
I am not able to find the xml template to modify it because I can’t find the file. This is a topic I have been researching deeply through the internet during the lasts days and all my attempts have been unsuccessful.
On the Internet, it is said that the product labels are generated using the product/report/product-label.xml and product_label.xsl:
https://www.odoo.com/es_ES/forum/ayuda-1/question/product-label-prints-only-one-variant-attribute-74684
The issue is that I can’t files these files in my Odoo installation folder (tested with both Windows and Ubuntu). These are my folder contents in Ubuntu usr/lib/python3/dist-packages/odoo/addons/product/report:
Should I create the xml and xsl files?
If so, how can I reference them? I have already tried to modify the xml file to try if the options for rendering the report change and nothing’s happens...
Here is the xml that I have been modifying (looks like it is an index of the different available reports but I haven’t found any official documentation regarding this) (note that I’ve added a number to each report title to see if something changes):
And the select options are still the same, as it can be seen in the following screenshot.
Am I’m missing something? It looks like these templates are located somewhere else and I’m editing these files without success (and restarting the Odoo server doesn’t work either...).
I'm using Odoo v12.
Thank you for your help!
<report> tag in odoo is actually shortcut of ir.action.report model record creation, qweb-pdf or qweb-html type of report needs a qweb template to render the report output, which is mentioned in name and file properties in the report tag.
After changing the files in a odoo module, if that module is already installed before change, you have to update the module. You can update from Apps menu of odoo web panel. For example, in this case, you are making change in product module which is named Products & Pricelists in odoo Apps. After making change, update that module and you will find the changes effective. Also, if you are adding new XML file, you have to add respective file name in __manifest.py__, or have to import in __init.py__ if you are adding new python file in the module.