Skip to content

Commit

Permalink
ODOO-414 Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
amh-mw committed Sep 29, 2022
1 parent 9c52041 commit 9d8c064
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 35 deletions.
1 change: 0 additions & 1 deletion addons/web/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ def generate_views(action):
# providing at least one view mode is a requirement, not an option
view_modes = action['view_mode'].split(',')

# BLUE STINGRAY / METRIC WISE CUSTOM
# make sure the view_description is instantiated
view_description = action['view_description'] or False

Expand Down
13 changes: 0 additions & 13 deletions addons/web/static/src/legacy/js/chrome/abstract_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ const AbstractAction = Widget.extend(ActionMixin, {
*/
withSearchBar: false,

/**
* BLUE STINGRAY / METRIC WISE CUSTOM
* A client action might want to see the view description displayed in its
* control panel, or it choose not to use it.
*
* It also only makes sense if hasControlPanel is set to true.
*
* @type boolean
*/
withViewDescription: false,

/**
* This parameter can be set to customize the available sub menus in the
* controlpanel (Filters/Group By/Favorites). This is basically a list of
Expand Down Expand Up @@ -98,7 +87,6 @@ const AbstractAction = Widget.extend(ActionMixin, {
this.extensions.ControlPanel = {
actionId: action.id,
withSearchBar: this.withSearchBar,
withViewDescription: this.withViewDescription,
};

this.viewId = action.search_view_id && action.search_view_id[0];
Expand All @@ -108,7 +96,6 @@ const AbstractAction = Widget.extend(ActionMixin, {
breadcrumbs: options && options.breadcrumbs,
withSearchBar: this.withSearchBar,
searchMenuTypes: this.searchMenuTypes,
withViewDescription: this.withViewDescription,
};
}
},
Expand Down
2 changes: 0 additions & 2 deletions addons/web/static/src/legacy/js/chrome/action_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ odoo.define('web.ActionMixin', function (require) {
_title: '',

/**
* BLUE STINGRAY / METRIC WISE CUSTOM
* String containing the view description of the client action
*
* @see _setViewDescription
Expand Down Expand Up @@ -163,7 +162,6 @@ odoo.define('web.ActionMixin', function (require) {
},

/**
* BLUE STINGRAY / METRIC WISE CUSTOM
* Returns a view_description that may be displayed in center of the
* control panel area.
*
Expand Down
7 changes: 3 additions & 4 deletions addons/web/static/src/search/control_panel/control_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export class ControlPanel extends Component {
const originalSlots = {};
const transferredSlotNames = [
"control-panel-top-left",
"control-panel-top-right",
"control-panel-top-center",
"control-panel-top-right",
"control-panel-bottom-left",
"control-panel-bottom-right",
];
Expand All @@ -67,15 +67,14 @@ export class ControlPanel extends Component {
const display = Object.assign(
{
"top-left": true,
"top-center":true,
"top-center": true,
"top-right": true,
"bottom-left": true,
"bottom-right": true,
},
this.props.display || this.env.searchModel.display.controlPanel
);
display.top = display["top-left"] || display["top-center"] ||
display["top-right"];
display.top = display["top-left"] || display["top-center"] || display["top-right"];
display.bottom = display["bottom-left"] || display["bottom-right"];
return display;
}
Expand Down
7 changes: 3 additions & 4 deletions addons/web/static/src/search/control_panel/control_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
</div>
<div t-if="display['top-center']" class="o_cp_top_center">
<t t-slot="control-panel-top-center">
<t t-set="view_description" t-value="window.sessionStorage.current_action.split(':')[9].slice(1, window.sessionStorage.current_action.split(':')[9].search(','))"/>
<t t-if="view_description">
<p t-esc="view_description.slice(0,-1)" style="font-size: 18px;"/>
</t>
<t t-set="current_action" t-value="window.JSON.parse(window.sessionStorage.current_action)"/>
<p t-if="current_action.view_description" t-raw="current_action.view_description"/>
</t>
</div>
<div t-if="display['top-right']" class="o_cp_top_right">
Expand Down Expand Up @@ -72,4 +70,5 @@
</li>
</ol>
</t>

</templates>
6 changes: 0 additions & 6 deletions addons/web/static/src/webclient/actions/action_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,6 @@ function makeActionManager(env) {
const storedAction = browser.sessionStorage.getItem("current_action");
const lastAction = JSON.parse(storedAction || "{}");
if (lastAction.res_model === state.model) {
if (lastAction.context) {
// If this method is called because of a company switch, the
// stored allowed_company_ids is incorrect.
// (Fix will be improved in master)
delete lastAction.context.allowed_company_ids;
}
actionRequest = lastAction;
options.viewType = state.view_type;
}
Expand Down
9 changes: 5 additions & 4 deletions odoo/addons/base/models/ir_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class IrActions(models.Model):
('report', 'Report')],
required=True, default='action')
binding_view_types = fields.Char(default='list,form')
# BLUE STINGRAY / METRIC WISE CUSTOM
view_description = fields.Char(string='View Description')
view_description = fields.Html(string='View Description')

def _compute_xml_id(self):
res = self.get_external_id()
Expand Down Expand Up @@ -167,7 +166,8 @@ def _get_readable_fields(self):
"""
return {
"binding_model_id", "binding_type", "binding_view_types",
"display_name", "help", "id", "name", "type", "xml_id", "view_description",
"display_name", "help", "id", "name", "type", "xml_id",
"view_description",
}


Expand Down Expand Up @@ -295,7 +295,8 @@ def _get_readable_fields(self):
return super()._get_readable_fields() | {
"context", "domain", "filter", "groups_id", "limit", "res_id",
"res_model", "search_view", "search_view_id", "target", "view_id",
"view_description", "view_mode", "views",
"view_description",
"view_mode", "views",
# `flags` is not a real field of ir.actions.act_window but is used
# to give the parameters to generate the action
"flags"
Expand Down
2 changes: 1 addition & 1 deletion odoo/addons/base/views/ir_actions_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ env['res.partner'].create({'name': partner_name})
<header>
<button name="action_launch"
states="open" string="Launch"
type="object" icon="fa-cogs" class="oe_highlight"
type="object" icon="fa-cogs" class="oe_highlight"
help="Launch Configuration Wizard"/>
<button name="action_open" states="done"
string="Set as Todo" type="object"
Expand Down

0 comments on commit 9d8c064

Please sign in to comment.