[FIX] web : typo t-if vs if

To reproduce
=============
- on settings upload a custom background on document layout and save it
- open document layout again and try to download the image -> Traceback

Problem
=======
when calling download method we will ask server for a record with `id=false`
which gives an error

Solution
========
download button shouldn't be visible when `record.resId == false`

opw-3138230

closes odoo/odoo#113029

X-original-commit: 2e2cdee563dd645cabe2d361489d6eb17b174a33
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Abdelouahab (abla)
2023-02-18 02:49:50 +01:00
parent f95c95b44f
commit 5b4c93e387
2 changed files with 16 additions and 1 deletions
@@ -9,7 +9,7 @@
acceptedFileExtensions="props.acceptedFileExtensions"
onUploaded.bind="update"
>
<t if="props.record.resId">
<t t-if="props.record.resId">
<button
class="btn btn-secondary fa fa-download"
data-tooltip="Download"
@@ -415,4 +415,19 @@ QUnit.module("Fields", (hooks) => {
"93.43 Bytes"
);
});
QUnit.test("Binary field for new record has no download button", async function (assert) {
serverData.models.partner.fields.document.default = BINARY_FILE;
await makeView({
serverData,
type: "form",
resModel: "partner",
arch: `
<form>
<field name="document" filename="foo"/>
</form>
`,
});
assert.containsNone(target, "button.fa-download");
});
});