Skip to Content
Menu
This question has been flagged
1 Reply
8962 Views

Hi there,

Am trying to inherit a <templates id="template" xml:space="preserve">, but no succedd in almost a full week. What was fun to learn, bcamed a nightmare, just bcause of this, so far.
I have done the following come (below). Can someone pleeeeaaassseee, have a look and let me know what am I doing wrong?

I want to inherit the SEO widget. to add a new field, but for a full week I couldn't touch that popup window. It's on odoo 12.

 So,

- I have added the js file (ad_jas.xml)

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="inherit_seo" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/fk_website_seo/static/js/extend_seo_widget.js"></script>
</xpath>
</template>
</odoo>

- the content of the js file (extend_seo_widget.js)

odoo.define('fk_website_seo.extend_seo_widget', function (require) {
'use strict';

var core = require('web.core');
var ajax = require('web.ajax');
var qweb = core.qweb;
ajax.loadXML('/fk_website_seo/static/src/xml/extend_seo_widget.xml', qweb);
});

- added the xml extension to manifest as qweb

'qweb': [
'static/src/xml/extend_seo_widget.xml'
],
'data': [
    'views/add_jas.xml',
],

- and tried to inherit the SEO widget, with extend_seo_widget.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<templates id="template" xml:space="preserve">
<t t-name="website.seo_preview" t-extend="website.seo_preview">
<t t-jquery=".oe_seo_preview_g" t-operation="after">
<h1>TEST TEST TEST TSET</h1>
<label for="test">Frequency</label>
<field name="test"/>
</t>
</t>
</templates>
</odoo>

- and inherited the website.seo.metadata model, as follow

class inheritedSEOwidget(models.Model):
# this website.seo.metadata is an Abstract model, andthe only way I could inherited it it was using models.Model...
_inherit = 'website.seo.metadata'
_name = "extended.website.seo.metadata"

test = fields.Char(string="Test")

I'm not getting any errors, but still nothing changed there.

that is driving me crazy.

Can you have a look pls?

What am I doing wrong? Google it a lot, and tested everything I got..nothing worked o far.

pls and thank you

Avatar
Discard
Best Answer

Hello Banita,

Please remove the odoo tag and it work perfectly.

<?xml version="1.0" encoding="utf-8"?>
 
<templates id="template" xml:space="preserve">
<t t-name="website.seo_preview" t-extend="website.seo_preview">
<t t-jquery=".oe_seo_preview_g" t-operation="after">
<h1>TEST TEST TEST TSET</h1>
<label for="test">Frequency</label>
<field name="test"/>
</t>
</t>
</templates>

Avatar
Discard
Author

Hi Eman,

Thank you for your answer!

I tried your solution and removed odoo tags but unfortunatelly when trying to upgrade I'm getting a "debug=true" (http://localhost:8070/web?debug=true) link and nothing changes.

Beside that nothing in the backend is not loading bcause of the template issue i suppose.

Am I missing something? :((

If it's working for you, and for me is not working... there is something I miss, but the code is the same. What am I missing ... do you have a clue? I checked everything a hundread times...so my eyes is missing something :((

Author

ok, so, removed the odoo tags and used <template instead of <templates tags.... and now the backend is back and running, but still no changes in the extended template. it's seems that is having no effect at all.

is this working for ODOO 12? On my research I have found that working only on odoo10.

Related Posts Replies Views Activity
1
May 20
2910
7
Jun 24
21680
2
Dec 22
21328
2
Oct 22
4549
2
Mar 21
2503