[REF] sales_team, web: remove sales_team_dashboard view
The view `sale_team_dashboard` (which extends kanban) has been removed and replaced by a default kanban view. To use it in the ViewManager, an option `js_class` is added on the arch description and this class be used as the View. This avoids creating a new view type just for one view.
This commit is contained in:
@@ -4,4 +4,3 @@ import crm_team
|
||||
import res_partner
|
||||
import res_users
|
||||
import res_config
|
||||
import ir_ui_view
|
||||
@@ -1,9 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
class View(models.Model):
|
||||
_inherit = 'ir.ui.view'
|
||||
|
||||
type = fields.Selection(selection_add=[('sales_team_dashboard', 'Sales Team Dashboard')])
|
||||
@@ -51,7 +51,7 @@
|
||||
<field name="name">Dashboard</field>
|
||||
<field name="res_model">crm.team</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">sales_team_dashboard,form</field>
|
||||
<field name="view_mode">kanban,form</field>
|
||||
<field name="context">{}</field>
|
||||
<field name="view_id" ref="crm_team_salesteams_search"/>
|
||||
<field name="help" type="html">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<field name="name">crm.team.dashboard</field>
|
||||
<field name="model">crm.team</field>
|
||||
<field name="arch" type="xml">
|
||||
<sales_team_dashboard class="oe_background_grey o_kanban_dashboard o_salesteam_kanban" create="0">
|
||||
<kanban class="oe_background_grey o_kanban_dashboard o_salesteam_kanban" create="0" js_class="sales_team_dashboard">
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="member_ids"/>
|
||||
@@ -58,7 +58,7 @@
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</sales_team_dashboard>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -274,7 +274,8 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
|
||||
},
|
||||
create_view: function(view, view_options) {
|
||||
var self = this;
|
||||
var View = this.registry.get(view.type);
|
||||
var js_class = view.fields_view.arch.attrs && view.fields_view.arch.attrs.js_class;
|
||||
var View = this.registry.get(js_class || view.type);
|
||||
var options = _.clone(view.options);
|
||||
if (view.type === "form" && ((this.action.target === 'new' || this.action.target === 'inline') ||
|
||||
(view_options && view_options.mode === 'edit'))) {
|
||||
|
||||
Reference in New Issue
Block a user