We refactored the publicWidget
system in the public (website/...) JavaScript codebase. The initial plan was to convert them to OWL components, but after some experiments, the idea was discarded (it did not feel right, and it would prevent serving pages without OWL in the future).
See:
- PR odoo/odoo#185998
- Main file:
web/static/src/public/interaction.js
Silent in the nest,
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @odoo-module **/ | |
import { registry } from "@web/core/registry"; | |
import { KeepLast } from "@web/core/utils/concurrency"; | |
import { useService } from "@web/core/utils/hooks"; | |
import { XMLParser } from "@web/core/utils/xml"; | |
import { Model, useModel } from "@web/views/helpers/model"; | |
import { ViewLayout } from "@web/views/view_layout"; | |
// ----------------------------------------------------------------------------- |
This gist describes our current work at using native JS modules in Odoo, and what it implies for the source code and for the developer experience.
PR: odoo/odoo#63177 (still work in progress)
The current PR allows us to use native JS modules in odoo. It works. It is
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a detailed explanation on the compiled code generated by the | |
// t-widget directive for a given template: | |
// <div><t t-widget="child" t-key="'somestring'" t-props="{flag:state.flag}"/></div> | |
// | |
// Hopefully, this may help someday some poor developer that has to maintain | |
// this code! Good luck, my friend... | |
// This is the virtual node representing the parent div | |
let c1 = [], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<tree string="Product Variants" order="name desc,price asc"> | |
<field name="default_code"/> | |
<field name="name" order="1"/> | |
<field name="attribute_value_ids" widget="many2many_tags"/> | |
<field name="lst_price"/> | |
<field name="price" invisible="not context.get('pricelist',False)"/> | |
<field name="uom_id"/> | |
<field name="ean13"/> | |
<field name="state" invisible="1"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<openerp> | |
<data> | |
<template id="assets_backend" name="custom assets" inherit_id="web.assets_backend"> | |
<xpath expr="." position="inside"> | |
<link rel="stylesheet" href="/custom_stuff/custom.css"/> | |
</xpath> | |
</template> | |
</data> | |
</openerp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'name': 'Custom Settings for Odoo', | |
'category': 'Custom', | |
'description': """ | |
Custom Settings for Odoo | |
""", | |
'version': '1.0', | |
'data' : [ | |
'view.xml', | |
] |