diff --git a/addons/product/static/src/js/product_document_kanban/product_document_kanban_record.js b/addons/product/static/src/js/product_document_kanban/product_document_kanban_record.js index e32872a2ce5..bc13c1b6428 100644 --- a/addons/product/static/src/js/product_document_kanban/product_document_kanban_record.js +++ b/addons/product/static/src/js/product_document_kanban/product_document_kanban_record.js @@ -7,7 +7,7 @@ import { useFileViewer } from "@web/core/file_viewer/file_viewer_hook"; export class ProductDocumentKanbanRecord extends KanbanRecord { setup() { super.setup(); - this.attachmentService = useService("mail.attachment"); + this.store = useService("mail.store"); this.fileViewer = useFileViewer(); } /** @@ -19,7 +19,7 @@ export class ProductDocumentKanbanRecord extends KanbanRecord { if (ev.target.closest(CANCEL_GLOBAL_CLICK)) { return; } else if (ev.target.closest(".o_kanban_previewer")) { - const attachment = this.attachmentService.insert({ + const attachment = this.store.Attachment.insert({ id: this.props.record.data.ir_attachment_id[0], filename: this.props.record.data.name, name: this.props.record.data.name, diff --git a/addons/product/static/src/js/product_document_kanban/product_document_kanban_view.scss b/addons/product/static/src/js/product_document_kanban/product_document_kanban_view.scss new file mode 100644 index 00000000000..06450ecc2e4 --- /dev/null +++ b/addons/product/static/src/js/product_document_kanban/product_document_kanban_view.scss @@ -0,0 +1,3 @@ +.o_kanban_previewer:hover { + cursor: pointer; +} diff --git a/addons/product/views/product_document_views.xml b/addons/product/views/product_document_views.xml index ac26b2b480e..8ca09d34b57 100644 --- a/addons/product/views/product_document_views.xml +++ b/addons/product/views/product_document_views.xml @@ -50,7 +50,7 @@ Download -
+
Archived
@@ -69,16 +69,12 @@
-
+
-
- - -
- -
-
+
diff --git a/addons/sale/views/product_document_views.xml b/addons/sale/views/product_document_views.xml index aee080986af..77854a86f60 100644 --- a/addons/sale/views/product_document_views.xml +++ b/addons/sale/views/product_document_views.xml @@ -19,12 +19,12 @@ product.document - - - Visible at - - - +
+
+ Visible at + +
+
diff --git a/addons/web/static/src/views/fields/selection/selection_field.js b/addons/web/static/src/views/fields/selection/selection_field.js index 69d1801728b..8c8f269990c 100644 --- a/addons/web/static/src/views/fields/selection/selection_field.js +++ b/addons/web/static/src/views/fields/selection/selection_field.js @@ -13,6 +13,10 @@ export class SelectionField extends Component { placeholder: { type: String, optional: true }, required: { type: Boolean, optional: true }, domain: { type: Array, optional: true }, + autosave: { type: Boolean, optional: true }, + }; + static defaultProps = { + autosave: false, }; setup() { @@ -68,15 +72,15 @@ export class SelectionField extends Component { switch (this.type) { case "many2one": if (value === false) { - this.props.record.update({ [this.props.name]: false }); + this.props.record.update({ [this.props.name]: false }, { save: this.props.autosave }); } else { this.props.record.update({ [this.props.name]: this.options.find((option) => option[0] === value), - }); + }, { save: this.props.autosave }); } break; case "selection": - this.props.record.update({ [this.props.name]: value }); + this.props.record.update({ [this.props.name]: value }, { save: this.props.autosave }); break; } } @@ -87,13 +91,19 @@ export const selectionField = { displayName: _t("Selection"), supportedTypes: ["many2one", "selection"], isEmpty: (record, fieldName) => record.data[fieldName] === false, - extractProps({ attrs }, dynamicInfo) { - return { + extractProps({ attrs, viewType }, dynamicInfo) { + const props = { + autosave: viewType === "kanban", placeholder: attrs.placeholder, required: dynamicInfo.required, domain: dynamicInfo.domain(), }; + if (viewType === "kanban") { + props.readonly = dynamicInfo.readonly; + }; + return props; }, }; registry.category("fields").add("selection", selectionField); +registry.category("fields").add("kanban.selection", selectionField); diff --git a/addons/web/static/src/views/fields/selection/selection_field.xml b/addons/web/static/src/views/fields/selection/selection_field.xml index a2ab2e9910a..31f81467f41 100644 --- a/addons/web/static/src/views/fields/selection/selection_field.xml +++ b/addons/web/static/src/views/fields/selection/selection_field.xml @@ -6,7 +6,11 @@ -