[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:
@@ -40,8 +40,6 @@ QUnit.module('basic_fields', {
|
||||
selection: {string: "Selection", type: "selection", searchable:true,
|
||||
selection: [['normal', 'Normal'],['blocked', 'Blocked'],['done', 'Done']]},
|
||||
document: {string: "Binary", type: "binary"},
|
||||
image_selection: {string: "Image Selection", type: "selection", searchable:true,
|
||||
selection: [['background', 'Background'],['boxed', 'Boxed'],['clean', 'Clean'],['standard', 'Standard']]},
|
||||
},
|
||||
records: [{
|
||||
id: 1,
|
||||
@@ -4828,45 +4826,6 @@ QUnit.module('basic_fields', {
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.module('FieldImageSelection');
|
||||
|
||||
QUnit.test('image selection widget in form view', function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
var nodeOptions = {
|
||||
background: {
|
||||
image_link: '/base/static/img/preview_background.png',
|
||||
preview_link: '/base/static/pdf/preview_background.pdf',
|
||||
},
|
||||
boxed: {
|
||||
image_link: '/base/static/img/preview_boxed.png',
|
||||
preview_link: '/base/static/pdf/preview_boxed.pdf',
|
||||
},
|
||||
};
|
||||
var form = createView({
|
||||
View: FormView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch: '<form>' +
|
||||
'<field name="image_selection" widget="image_selection"' +
|
||||
' options=\'' + JSON.stringify(nodeOptions) + '\'/> '+
|
||||
'</form>',
|
||||
res_id: 2,
|
||||
});
|
||||
|
||||
assert.strictEqual(form.$('.img.img-fluid').length, 2,
|
||||
"Two images should be rendered");
|
||||
assert.strictEqual(form.$('.img.btn-info').length, 0,
|
||||
"No image should be selected");
|
||||
|
||||
// select first image
|
||||
form.$(".img.img-fluid:first").click();
|
||||
assert.ok(form.$(".img.img-fluid:first").hasClass('btn-info'),
|
||||
"First image should be selected");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user