[IMP] base, *: use a many2one for the company report layout

Before this rev. one could set the report layout on the company using a
hardcoded list (background, clean, standard, etc.). Other modules (typically
accounting modules) could add options in this list. The used template was built
on the layout key.

Now, the layout is a many2one field to a newly created model `report.layout`,
which is linked to a view with the layout architecture.

This gives more control to customize reports and create a new layout (without
creating a python module that extend the layout selection).
This commit is contained in:
Christophe Matthieu
2018-08-13 17:09:28 +02:00
parent 149eb38b07
commit 61eef73b52
35 changed files with 257 additions and 264 deletions
@@ -2826,56 +2826,6 @@ var AceEditor = DebouncedField.extend({
},
});
var ImageSelection = AbstractField.extend({
supportedFieldTypes: ['selection'],
events: _.extend({}, AbstractField.prototype.events, {
'click img': '_onImgClicked',
}),
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* @override
* @private
*/
_render: function () {
var self = this;
this.$el.empty();
_.each(this.nodeOptions, function (val, key) {
var $container = $('<div>').addClass('col-3 text-center');
var $img = $('<img>')
.addClass('img img-fluid img-thumbnail ml16')
.toggleClass('btn-info', key === self.value)
.attr('src', val.image_link)
.data('key', key);
$container.append($img);
if (val.preview_link) {
var $previewLink = $('<a>')
.text('Preview')
.attr('href', val.preview_link)
.attr('target', '_blank');
$container.append($previewLink);
}
self.$el.append($container);
});
},
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
/**
* @override
* @private
* @param {MouseEvent} event
*/
_onImgClicked: function (event) {
this._setValue($(event.currentTarget).data('key'));
},
});
return {
TranslatableFieldMixin: TranslatableFieldMixin,
DebouncedField: DebouncedField,
@@ -2906,7 +2856,6 @@ return {
HandleWidget: HandleWidget,
InputField: InputField,
AttachmentImage: AttachmentImage,
ImageSelection: ImageSelection,
LabelSelection: LabelSelection,
StateSelectionWidget: StateSelectionWidget,
FavoriteWidget: FavoriteWidget,