From ce34104a31b1be7212bb8659f353790626516be6 Mon Sep 17 00:00:00 2001 From: amas-odoo Date: Wed, 9 Apr 2025 15:47:08 +0530 Subject: [PATCH] [ADD] Extended Product Description: Adding extended description for products In this commit: - Added a new field in product for extended, list-formatable descriptions - Displayed the extended description below product details on the website - Provided Danish and Swedish translations for the field - Enabled import/export support for the extended description --- extended_product_description/__init__.py | 1 + extended_product_description/__manifest__.py | 15 +++++++ .../models/__init__.py | 1 + .../models/product_template.py | 12 +++++ .../security/ir.model.access.csv | 1 + .../src/scss/extended_product_decription.scss | 45 +++++++++++++++++++ .../views/product_template_views.xml | 17 +++++++ .../views/templates.xml | 25 +++++++++++ 8 files changed, 117 insertions(+) create mode 100644 extended_product_description/__init__.py create mode 100644 extended_product_description/__manifest__.py create mode 100644 extended_product_description/models/__init__.py create mode 100644 extended_product_description/models/product_template.py create mode 100644 extended_product_description/security/ir.model.access.csv create mode 100644 extended_product_description/static/src/scss/extended_product_decription.scss create mode 100644 extended_product_description/views/product_template_views.xml create mode 100644 extended_product_description/views/templates.xml diff --git a/extended_product_description/__init__.py b/extended_product_description/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/extended_product_description/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/extended_product_description/__manifest__.py b/extended_product_description/__manifest__.py new file mode 100644 index 00000000000..8c3cb390256 --- /dev/null +++ b/extended_product_description/__manifest__.py @@ -0,0 +1,15 @@ +{ + 'name': "Extended Product Description", + 'installable': True, + 'license': 'LGPL-3', + 'depends': ['website_sale'], + 'data': [ + 'views/product_template_views.xml', + 'views/templates.xml', + ], + 'assets': { + 'web.assets_frontend': [ + 'extended_product_description/static/src/**/*.scss', + ] + } +} diff --git a/extended_product_description/models/__init__.py b/extended_product_description/models/__init__.py new file mode 100644 index 00000000000..e8fa8f6bf1e --- /dev/null +++ b/extended_product_description/models/__init__.py @@ -0,0 +1 @@ +from . import product_template diff --git a/extended_product_description/models/product_template.py b/extended_product_description/models/product_template.py new file mode 100644 index 00000000000..0dfaeb185d0 --- /dev/null +++ b/extended_product_description/models/product_template.py @@ -0,0 +1,12 @@ +from odoo import fields, models +from odoo.tools.translate import html_translate + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + extended_product_description = fields.Html(string='Extended product description', + translate=html_translate, + sanitize_overridable=True, + sanitize_attributes=False, + ) diff --git a/extended_product_description/security/ir.model.access.csv b/extended_product_description/security/ir.model.access.csv new file mode 100644 index 00000000000..97dd8b917b8 --- /dev/null +++ b/extended_product_description/security/ir.model.access.csv @@ -0,0 +1 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink diff --git a/extended_product_description/static/src/scss/extended_product_decription.scss b/extended_product_description/static/src/scss/extended_product_decription.scss new file mode 100644 index 00000000000..af5c1614b89 --- /dev/null +++ b/extended_product_description/static/src/scss/extended_product_decription.scss @@ -0,0 +1,45 @@ +.extended-product-description .accordion-item{ + border: none; + box-shadow: -1px 3px 10px -7px #714B67; +} +.extended-product-description button{ + background-color: #714B67 !important; + color: #fff !important; + font-weight: 600; +} +.accordion-button::after{ + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 5L8 11L14 5'/%3e%3c/svg%3e"); +} +.extended-product-description .accordion-button:not(.collapsed)::after { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 5L8 11L14 5'/%3e%3c/svg%3e"); +} +.extended-product-description P{ + text-align: justify; +} +.extended-product-description ul{ + margin: 0; + padding: 0; + list-style: none; +} +.extended-product-description ol{ + padding: 0; + margin: 0; + padding-left: 20px; +} +.extended-product-description ul li{ + position: relative; + padding-left: 20px; + text-align: justify; +} +.extended-product-description ol li{ + text-align: justify; +} +.extended-product-description ul li:before{ + content: "\f101"; + font-family: "FontAwesome" !important; + font-weight: 500; + position: absolute; + top: 0; + left: 0; + color: #714B67; +} diff --git a/extended_product_description/views/product_template_views.xml b/extended_product_description/views/product_template_views.xml new file mode 100644 index 00000000000..8247fe1fe2a --- /dev/null +++ b/extended_product_description/views/product_template_views.xml @@ -0,0 +1,17 @@ + + + + + product.template.inherit.extended.product.description + product.template + + + + + + + + diff --git a/extended_product_description/views/templates.xml b/extended_product_description/views/templates.xml new file mode 100644 index 00000000000..cc469d76d6c --- /dev/null +++ b/extended_product_description/views/templates.xml @@ -0,0 +1,25 @@ + + + + + +