[FIX] *: hide technical field widgets in non-debug mode (Studio)

*:
- account
- barcodes
- calenndar
- hr_timesheet
- mail
- mass_mailing
- partner_autocomplete
- web
- website_slides

This commit removes description of fields that should not be shown in
non-debug mode Studio. Only field widgets whose own description is
set are displayed in non-debug mode Studio in "Widget" of sidebar.
In other words, even if any ancestor has a description but not the
current widget, it won't be displayed in the sidebar in non-debug
mode.

Task-Id 2056992

closes odoo/odoo#35902

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Juhil Somaiya
2019-09-23 15:00:44 +00:00
committed by Alexandre Kühn
parent e4fc7568c1
commit ececa1f7bf
12 changed files with 11 additions and 15 deletions
@@ -76,7 +76,6 @@ var SectionAndNoteListRenderer = ListRenderer.extend({
// to be sure this custom code will only impact selected fields having the widget
// and not applied to any other existing ListRenderer.
var SectionAndNoteFieldOne2Many = FieldOne2Many.extend({
description: "",
/**
* We want to use our custom renderer for the list.
*
@@ -9,7 +9,6 @@ var BarcodeEvents = require('barcodes.BarcodeEvents').BarcodeEvents;
// Field in which the user can both type normally and scan barcodes
var FieldFloatScannable = basicFields.FieldFloat.extend({
description: "",
events: _.extend({}, basicFields.FieldFloat.prototype.events, {
// The barcode_events component intercepts keypresses and releases them when it
// appears they are not part of a barcode. But since released keypresses don't
@@ -139,7 +139,6 @@ var Many2ManyAttendee = FieldMany2ManyTags.extend({
// as this widget is model dependant (rpc on res.partner), use it in another
// context probably won't work
// supportedFieldTypes: ['many2many'],
description: "",
tag_template: "Many2ManyAttendeeTag",
specialData: "_fetchSpecialAttendeeStatus",
@@ -82,9 +82,14 @@ var FieldTimesheetToggle = basicFields.FieldFloatToggle.extend({
**/
var widgetName = 'timesheet_uom' in session ?
session.timesheet_uom.timesheet_widget : 'float_factor';
var FieldTimesheetUom = widgetName === 'float_toggle' ?
FieldTimesheetToggle : (fieldRegistry.get(widgetName) || FieldTimesheetFactor);
FieldTimesheetUom.prototype.description = "";
var FieldTimesheetUom = widgetName === 'float_toggle' ? FieldTimesheetToggle
: (
(
fieldRegistry.get(widgetName) &&
fieldRegistry.get(widgetName).extend({})
) ||
FieldTimesheetFactor
);
fieldRegistry.add('timesheet_uom', FieldTimesheetUom);
@@ -51,7 +51,6 @@ BasicModel.include({
});
var FieldMany2ManyTagsEmail = M2MTags.extend({
description: "",
tag_template: "FieldMany2ManyTagsEmail",
fieldsToFetch: _.extend({}, M2MTags.prototype.fieldsToFetch, {
email: {type: 'char'},
@@ -11,7 +11,6 @@ var _t = core._t;
var MassMailingFieldHtml = FieldHtml.extend({
description: "",
xmlDependencies: (FieldHtml.prototype.xmlDependencies || []).concat(["/mass_mailing/static/src/xml/mass_mailing.xml"]),
jsLibs: [
'/mass_mailing/static/src/js/mass_mailing_snippets.js',
@@ -16,7 +16,6 @@ var FieldChar = basic_fields.FieldChar;
* "website" and "image" fields of records of this model).
*/
var FieldAutocomplete = FieldChar.extend(AutocompleteMixin, {
description: "",
className: 'o_field_partner_autocomplete',
debounceSuggestions: 400,
resetOnAnyFieldChange: true,
@@ -9,7 +9,6 @@ var field_registry = require('web.field_registry');
var _t = core._t;
var PartnerField = FieldMany2One.extend(AutocompleteMixin, {
description: "",
jsLibs: [
'/partner_autocomplete/static/lib/jsvat.js'
],
@@ -1166,7 +1166,6 @@ var FieldFloatTime = FieldFloat.extend({
});
var FieldFloatFactor = FieldFloat.extend({
description: "",
supportedFieldTypes: ['float'],
className: 'o_field_float_factor',
formatType: 'float_factor',
@@ -817,7 +817,9 @@ var FieldMany2One = AbstractField.extend({
});
var Many2oneBarcode = FieldMany2One.extend({
description: "",
// We don't require this widget to be displayed in studio sidebar in
// non-debug mode hence just extended it from its original widget, so that
// description comes from parent and hasOwnProperty based condition fails
});
var ListFieldMany2One = FieldMany2One.extend({
@@ -16,7 +16,6 @@ var _t = core._t;
* the time difference between UTC time and local time, in minutes.
*/
var FieldTimezoneMismatch = FieldSelection.extend({
description: "",
/**
* @override
*/
@@ -129,7 +128,6 @@ var FieldTimezoneMismatch = FieldSelection.extend({
var FieldReportLayout = relational_fields.FieldMany2One.extend({
// this widget is not generic, so we disable its studio use
// supportedFieldTypes: ['many2one', 'selection'],
description: "",
events: _.extend({}, relational_fields.FieldMany2One.prototype.events, {
'click img': '_onImgClicked',
}),
@@ -13,7 +13,6 @@ var FieldFloatRating = basicFields.FieldFloat.extend({
['/website_rating/static/src/xml/portal_tools.xml'] : basicFields.FieldFloat.prototype.xmlDependencies.concat(
['/website_rating/static/src/xml/portal_tools.xml']
),
description: "",
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------