Hi Everyone
I'm new to Odoo, currently running a custom module on odoo 11 that works perfectly in Community edition but when uploaded to the Enterprise edition, it doesn't work for some reason.
I've also notice that some manifest metadata is empty from the module view page, metadata like the Dependencies, and Category even though the module is install successfully.
Module has one Model that add attributes to HTML head script tags using lxml
Any form of assistance is highly appreciated
__manifest__.py
{
'name': "Script Mod",
'summary':'Script attributes',
'description': 'Add attributes to script tags',
'website':'',
'author': 'jhon-117',
'category': 'Website',
'version': '11.0.1.0.0',
'depends': ['base', 'website'],
'data': [],
'installable': True
}
models/scriptmodel.py
from odoo import api, models
import lxml
class Scriptmodel(models.Model):
_inherit = 'ir.ui.view'
@api.model
def render_template(self, template, values=None, engine='ir.qweb'):
res = super(ScriptModel, self).render_template(template, values, engine)
website_id = self.env.context.get('website_id')
if website_id and not self.env['website'].browse(website_id).is_publisher():
html = lxml.html.fromstring(res.decode('UTF-8'))
head = html.find('.//head')
scripts = html.xpath('//head//script[@src]')
for script in scripts:
src = script.attrib['src']
script.attrib['async'] = 'async'
res = lxml.etree.tostring(html, method='html', encoding='UTF-8')
return res