diff --git a/product_catalog/__init__.py b/product_catalog/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/product_catalog/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_catalog/__manifest__.py b/product_catalog/__manifest__.py new file mode 100644 index 00000000000..804e12cbc92 --- /dev/null +++ b/product_catalog/__manifest__.py @@ -0,0 +1,18 @@ +{ + "name": "Product Catalog Redesign", + "version": "1.0", + "category": "Sales", + "depends": ["product", "sale_management"], + "data": ["views/product_catalog_view.xml"], + "application": True, + "assets": { + "web.assets_backend": [ + "product_catalog/static/src/scss/product_catalog.scss", + "product_catalog/static/src/js/product_catalog.js", + "product_catalog/static/src/js/image_preview/image_preview.xml", + "product_catalog/static/src/js/screen_container/screen_container.xml", + ], + }, + "license": "LGPL-3", + "installable": True, +} diff --git a/product_catalog/models/__init__.py b/product_catalog/models/__init__.py new file mode 100644 index 00000000000..edb0a0784a9 --- /dev/null +++ b/product_catalog/models/__init__.py @@ -0,0 +1 @@ +from . import product_catalog_inherit diff --git a/product_catalog/models/product_catalog_inherit.py b/product_catalog/models/product_catalog_inherit.py new file mode 100644 index 00000000000..473557422cb --- /dev/null +++ b/product_catalog/models/product_catalog_inherit.py @@ -0,0 +1,14 @@ +from odoo import fields, models + + +class ProductCatalogInherited(models.Model): + _inherit = "product.template" + + package_field = fields.Selection( + [ + ("carton", "Carton"), + ("bulk", "Bulk"), + ("studio", "Studio"), + ], + string="Package Field", + ) diff --git a/product_catalog/static/src/js/image_preview/image_preview.xml b/product_catalog/static/src/js/image_preview/image_preview.xml new file mode 100644 index 00000000000..592183d41ce --- /dev/null +++ b/product_catalog/static/src/js/image_preview/image_preview.xml @@ -0,0 +1,8 @@ + + + + + openImageFullScreen + + + diff --git a/product_catalog/static/src/js/product_catalog.js b/product_catalog/static/src/js/product_catalog.js new file mode 100644 index 00000000000..51d90dcee6f --- /dev/null +++ b/product_catalog/static/src/js/product_catalog.js @@ -0,0 +1,34 @@ +import { registry } from "@web/core/registry"; +import { useService } from "@web/core/utils/hooks"; +import { ImageField } from "@web/views/fields/image/image_field"; +import { Component } from "@odoo/owl"; + +export class FullScreenImage extends Component { + static template = "product_kanban_inherit.popup_container"; + static props = { + src: { type: String }, + close: Function, + }; +} + +export class ImagePreviewField extends ImageField { + static template = "product_kanban_inherit.image_preview"; + + setup() { + super.setup(); + this.dialog = useService("dialog"); + } + + openImageFullScreen() { + if (this.env.isSmall) { + this.dialog.add(FullScreenImage, { + src: this.getUrl(this.props.name), + }); + } + } +} + +export const imageClickEnlarge = { + component: ImagePreviewField, +}; +registry.category("fields").add("image_preview_1", imageClickEnlarge); diff --git a/product_catalog/static/src/js/screen_container/screen_container.xml b/product_catalog/static/src/js/screen_container/screen_container.xml new file mode 100644 index 00000000000..f1ece372e64 --- /dev/null +++ b/product_catalog/static/src/js/screen_container/screen_container.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/product_catalog/static/src/scss/product_catalog.scss b/product_catalog/static/src/scss/product_catalog.scss new file mode 100644 index 00000000000..211af055e2f --- /dev/null +++ b/product_catalog/static/src/scss/product_catalog.scss @@ -0,0 +1,10 @@ +@media (max-width: 768px) { + .o_product_image { + div { + img { + max-width: 164px !important; + max-height: 164px !important; + } + } + } +} diff --git a/product_catalog/views/product_catalog_view.xml b/product_catalog/views/product_catalog_view.xml new file mode 100644 index 00000000000..c99407a2759 --- /dev/null +++ b/product_catalog/views/product_catalog_view.xml @@ -0,0 +1,29 @@ + + + + product.view.kanban.catalog.inherit + product.product + + + + ms-auto o_product_image + image_preview_1 + + + Package Type: + + + + + + + product.template.form.inherit.kit + product.template + + + + + + + +