diff --git a/addons/web/models/models.py b/addons/web/models/models.py index dcf349d1568..13507e54263 100644 --- a/addons/web/models/models.py +++ b/addons/web/models/models.py @@ -33,14 +33,6 @@ DISPLAY_DATE_FORMATS = { } -class IrActionsActWindowView(models.Model): - _inherit = 'ir.actions.act_window.view' - - view_mode = fields.Selection(selection_add=[ - ('qweb', 'QWeb') - ], ondelete={'qweb': 'cascade'}) - - class Base(models.AbstractModel): _inherit = 'base' @@ -221,32 +213,6 @@ class Base(models.AbstractModel): return records_values - ##### qweb view hooks ##### - @api.model - def qweb_render_view(self, view_id, domain): - assert view_id - return self.env['ir.qweb']._render( - view_id, - { - 'model': self, - 'domain': domain, - # not necessarily necessary as env is already part of the - # non-minimal qcontext - 'context': self.env.context, - 'records': lazy(self.search, domain), - }) - - @api.model - def _get_view(self, view_id=None, view_type='form', **options): - arch, view = super()._get_view(view_id, view_type, **options) - # avoid leaking the raw (un-rendered) template, also avoids bloating - # the response payload for no reason. Only send the root node, - # to send attributes such as `js_class`. - if view_type == 'qweb': - root = arch - arch = etree.Element('qweb', root.attrib) - return arch, view - @api.model def _search_panel_field_image(self, field_name, **kwargs): """ diff --git a/addons/web/static/src/legacy/js/views/qweb/qweb_view.js b/addons/web/static/src/legacy/js/views/qweb/qweb_view.js deleted file mode 100644 index 46ec5ab9ca4..00000000000 --- a/addons/web/static/src/legacy/js/views/qweb/qweb_view.js +++ /dev/null @@ -1,207 +0,0 @@ -/** @odoo-module alias=web.qweb **/ - -/** - * Client-side implementation of a qweb view. - */ - -import core from 'web.core'; -import AbstractView from '../abstract_view'; -import AbstractModel from '../abstract_model'; -import AbstractRenderer from '../abstract_renderer'; -import AbstractController from '../abstract_controller'; -import registry from 'web.view_registry'; - -var _lt = core._lt; - -/** - * model - */ -var Model = AbstractModel.extend({ - /** - * init - */ - init: function () { - this._super.apply(this, arguments); - this._state = { - viewId: false, - modelName: false, - body: '', - context: {}, - domain: [], - }; - }, - /** - * fetches the rendered qweb view - */ - _fetch: function () { - var state = this._state; - return this._rpc({ - model: state.modelName, - method: 'qweb_render_view', - kwargs: { - view_id: state.viewId, - domain: state.domain, - context: state.context - } - }).then(function (r) { - state.body = r; - return state.viewId; - }); - }, - /** - * get - */ - __get: function () { - return this._state; - }, - /** - * load - */ - __load: function (params) { - _.extend(this._state, _.pick(params, ['viewId', 'modelName', 'domain', 'context'])); - - return this._fetch(); - }, - /** - * reload - */ - __reload: function (_id, params) { - _.extend(this._state, _.pick(params, ['domain', 'context'])); - - return this._fetch(); - } -}); -/** - * renderer - */ -var Renderer = AbstractRenderer.extend({ - /** - * render - */ - _render: function () { - var self = this; - return this._super.apply(this, arguments).then(function () { - self.$el.html(self.state.body); - }); - } -}); -/** - * controller - */ -var Controller = AbstractController.extend({ - events: _.extend({}, AbstractController.prototype.events, { - 'click [type="toggle"]': '_onLazyToggle', - 'click [type="action"]' : '_onActionClicked', - }), - - init: function () { - this._super.apply(this, arguments); - }, - - /** - * @override - */ - renderButtons: function ($node) { - this.$buttons = $('