Skip to content

Commit c002467

Browse files
committed
Merge branch 'fix/attachments_tree_domain_issue' into alpha
2 parents ff60ce6 + 201e9d8 commit c002467

File tree

3 files changed

+47
-14
lines changed

3 files changed

+47
-14
lines changed

src/actionbar/FormActionBar.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -415,14 +415,7 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
415415
const res_id = result.currentId as number;
416416
const res_model = currentModel as string;
417417
openDefaultActionForModel({
418-
model: "ir.attachment",
419-
values: {
420-
selection_associated_object: `${res_model},${res_id}`,
421-
},
422-
forced_values: {
423-
res_model,
424-
res_id,
425-
},
418+
...getAttachmentActionPayload(res_model, res_id),
426419
initialViewType: "form",
427420
});
428421
}}
@@ -438,11 +431,7 @@ function FormActionBar({ toolbar }: { toolbar: any }) {
438431
const res_id = result.currentId as number;
439432
const res_model = currentModel as string;
440433
openDefaultActionForModel({
441-
model: "ir.attachment",
442-
domain: [
443-
["res_model", "=", `${res_model}`],
444-
["res_id", "=", `${res_id}`],
445-
],
434+
...getAttachmentActionPayload(res_model, res_id),
446435
initialViewType: "tree",
447436
});
448437
}}
@@ -483,4 +472,20 @@ async function saveDocument({
483472
}
484473
}
485474

475+
function getAttachmentActionPayload(res_model: string, res_id: number) {
476+
return {
477+
model: "ir.attachment",
478+
domain: [
479+
["res_model", "=", `${res_model}`],
480+
["res_id", "=", `${res_id}`],
481+
],
482+
values: {
483+
selection_associated_object: `${res_model},${res_id}`,
484+
},
485+
forced_values: {
486+
res_model,
487+
res_id,
488+
},
489+
};
490+
}
486491
export default FormActionBar;

src/common/Field.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default function Field({
4545
name={id}
4646
valuePropName={valuePropName}
4747
rules={rules}
48+
help={ooui.tooltipInline ? ooui.tooltip : null}
4849
>
4950
{children}
5051
</Form.Item>
@@ -60,7 +61,7 @@ export default function Field({
6061
new LabelOoui({
6162
name: id + "_label",
6263
string: label,
63-
help: tooltip,
64+
help: ooui.tooltipInline ? false : tooltip,
6465
fieldForLabel: id,
6566
})
6667
}

src/stories/Char.stories.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,30 @@ export const Translatable = (): React.ReactElement => {
4747
</LocaleProvider>
4848
);
4949
};
50+
51+
export const Tooltip = (): React.ReactElement => {
52+
const ooui = new CharOoui({
53+
name: "field",
54+
string: "Lorem ipsum",
55+
help: "This is a simple help",
56+
});
57+
return (
58+
<LocaleProvider lang="en_US">
59+
<Char ooui={ooui} showLabel />
60+
</LocaleProvider>
61+
);
62+
};
63+
64+
export const TooltipInline = (): React.ReactElement => {
65+
const ooui = new CharOoui({
66+
name: "field",
67+
string: "Lorem ipsum",
68+
help: "This is a simple help",
69+
help_inline: "true",
70+
});
71+
return (
72+
<LocaleProvider lang="en_US">
73+
<Char ooui={ooui} showLabel />
74+
</LocaleProvider>
75+
);
76+
};

0 commit comments

Comments
 (0)