Skip to content

[ADD] Extended Product Description: Adding extended description for product #705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 18.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extended_product_description/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions extended_product_description/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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',
]
}
}
1 change: 1 addition & 0 deletions extended_product_description/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_template
12 changes: 12 additions & 0 deletions extended_product_description/models/product_template.py
Original file line number Diff line number Diff line change
@@ -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,
)
1 change: 1 addition & 0 deletions extended_product_description/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
Original file line number Diff line number Diff line change
@@ -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;
}
17 changes: 17 additions & 0 deletions extended_product_description/views/product_template_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<odoo>

<record id="product_template_form_view" model="ir.ui.view">
<field name="name">product.template.inherit.extended.product.description</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<xpath expr="//group[@name='extra_info']" position="inside">
<label for="extended_product_description" />
<newline/>
<field name="extended_product_description" nolabel="1" placeholder="A detailed,formatted extended product description to promote your product on this page. Use '/' to discover more features."/>
</xpath>
</field>
</record>

</odoo>
25 changes: 25 additions & 0 deletions extended_product_description/views/templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<odoo>

<template id="extended_product_description_template" inherit_id="website_sale.product">
<xpath expr="//t[@t-call='website_sale.product_accordion']" position="before">
<t t-if="product.extended_product_description" >
<div class="extended-product-description accordion" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
More Details
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordionExample">
<div class="accordion-body">
<t t-out="product.extended_product_description" />
</div>
</div>
</div>
</div>
</t>
</xpath>
</template>

</odoo>