[IMP] FireFox Side-Navbar Scroll Issue Fixed
Kanban Image Issue: If Image is unset then in kanban its showing error(NaN bytes) -- (FIX forward port from Odoo)
This commit is contained in:
parent
40da1d3d45
commit
a6c8f12991
@ -30,7 +30,7 @@ var _t = core._t;
|
|||||||
/**
|
/**
|
||||||
* Convert binary to bin_size
|
* Convert binary to bin_size
|
||||||
*
|
*
|
||||||
* @param {string} value base64 representation of the binary (might be already a bin_size!)
|
* @param {string} [value] base64 representation of the binary (might be already a bin_size!)
|
||||||
* @param {Object} [field]
|
* @param {Object} [field]
|
||||||
* a description of the field (note: this parameter is ignored)
|
* a description of the field (note: this parameter is ignored)
|
||||||
* @param {Object} [options] additional options (note: this parameter is ignored)
|
* @param {Object} [options] additional options (note: this parameter is ignored)
|
||||||
@ -38,6 +38,9 @@ var _t = core._t;
|
|||||||
* @returns {string} bin_size (which is human-readable)
|
* @returns {string} bin_size (which is human-readable)
|
||||||
*/
|
*/
|
||||||
function formatBinary(value, field, options) {
|
function formatBinary(value, field, options) {
|
||||||
|
if (!value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
return utils.binaryToBinsize(value);
|
return utils.binaryToBinsize(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +140,8 @@
|
|||||||
}
|
}
|
||||||
.more-less {
|
.more-less {
|
||||||
margin: 13px;
|
margin: 13px;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
> a {
|
> a {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: @flectra-main-text-color;
|
color: @flectra-main-text-color;
|
||||||
|
@ -33,9 +33,10 @@ QUnit.module('Views', {
|
|||||||
state: { string: "State", type: "selection", selection: [["abc", "ABC"], ["def", "DEF"], ["ghi", "GHI"]]},
|
state: { string: "State", type: "selection", selection: [["abc", "ABC"], ["def", "DEF"], ["ghi", "GHI"]]},
|
||||||
date: {string: "Date Field", type: 'date'},
|
date: {string: "Date Field", type: 'date'},
|
||||||
datetime: {string: "Datetime Field", type: 'datetime'},
|
datetime: {string: "Datetime Field", type: 'datetime'},
|
||||||
|
image: {string: "Image", type: "binary"},
|
||||||
},
|
},
|
||||||
records: [
|
records: [
|
||||||
{id: 1, bar: true, foo: "yop", int_field: 10, qux: 0.4, product_id: 3, state: "abc", category_ids: []},
|
{id: 1, bar: true, foo: "yop", int_field: 10, qux: 0.4, product_id: 3, state: "abc", category_ids: [], 'image': 'R0lGODlhAQABAAD/ACwAAAAAAQABAAACAA=='},
|
||||||
{id: 2, bar: true, foo: "blip", int_field: 9, qux: 13, product_id: 5, state: "def", category_ids: [6]},
|
{id: 2, bar: true, foo: "blip", int_field: 9, qux: 13, product_id: 5, state: "def", category_ids: [6]},
|
||||||
{id: 3, bar: true, foo: "gnap", int_field: 17, qux: -3, product_id: 3, state: "ghi", category_ids: [7]},
|
{id: 3, bar: true, foo: "gnap", int_field: 17, qux: -3, product_id: 3, state: "ghi", category_ids: [7]},
|
||||||
{id: 4, bar: false, foo: "blip", int_field: -4, qux: 9, product_id: 5, state: "ghi", category_ids: []},
|
{id: 4, bar: false, foo: "blip", int_field: -4, qux: 9, product_id: 5, state: "ghi", category_ids: []},
|
||||||
@ -2339,6 +2340,32 @@ QUnit.module('Views', {
|
|||||||
"quick create should have been added in the first column");
|
"quick create should have been added in the first column");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('test displaying image', function (assert) {
|
||||||
|
assert.expect(2);
|
||||||
|
|
||||||
|
var kanban = createView({
|
||||||
|
View: KanbanView,
|
||||||
|
model: 'partner',
|
||||||
|
data: this.data,
|
||||||
|
arch: '<kanban class="o_kanban_test">' +
|
||||||
|
'<field name="id"/>' +
|
||||||
|
'<field name="image"/>' +
|
||||||
|
'<templates><t t-name="kanban-box"><div>' +
|
||||||
|
'<img t-att-src="kanban_image(\'partner\', \'image\', record.id.raw_value)"/>' +
|
||||||
|
'</div></t></templates>' +
|
||||||
|
'</kanban>',
|
||||||
|
});
|
||||||
|
|
||||||
|
var imageOnRecord = kanban.$('img[src*="/web/image"][src*="&id=1"]');
|
||||||
|
assert.strictEqual(imageOnRecord.length, 1, "partner with image display image");
|
||||||
|
|
||||||
|
var placeholders = kanban.$('img[src$="/web/static/src/img/placeholder.png"]');
|
||||||
|
assert.strictEqual(placeholders.length, this.data.partner.records.length - 1,
|
||||||
|
"partner with image should displaiy");
|
||||||
|
|
||||||
|
kanban.destroy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user