deja de usar website_description_limited porque javascript de
website_description ya lo recorta.
This commit is contained in:
parent
d74b925235
commit
7faf0459f6
9 changed files with 23 additions and 89 deletions
|
@ -1,9 +1,9 @@
|
|||
.custom_website_description {
|
||||
font-size: 20px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
padding: 15px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #efefff;
|
||||
border: 1px solid #99c;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<template id="product_full_description_inherit" inherit_id="website_sale.product">
|
||||
<xpath expr="//div[@t-field='product.website_description']" position="replace">
|
||||
<div id="product_description" class="oe_structure oe_empty mt16 custom_website_description"
|
||||
data-oe-type="html" data-oe-expressioni="product.website_description"
|
||||
data-oe-type="html" data-oe-expression="product.website_description"
|
||||
>
|
||||
<t t-out="product.website_description"/>
|
||||
</div>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
from . import models
|
|
@ -8,9 +8,9 @@
|
|||
"installable": True,
|
||||
"depends": ["website_sale"],
|
||||
"data": ["data/snippet_filter_data.xml", "views/website_sale_views.xml"],
|
||||
'assets': {
|
||||
'web.assets_frontend': [
|
||||
'website_sale_product_description_displayed/static/src/scss/custom.scss',
|
||||
"assets": {
|
||||
"web.assets_frontend": [
|
||||
"website_sale_product_description_displayed/static/src/scss/custom.scss",
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
from . import website_snippet_filter
|
||||
from . import product_template
|
|
@ -1,19 +0,0 @@
|
|||
from odoo import models, fields, api
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
website_description_limited = fields.Html(
|
||||
compute='_compute_website_description_limited',
|
||||
string='Website Description Limited'
|
||||
)
|
||||
|
||||
@api.depends('website_description')
|
||||
def _compute_website_description_limited(self):
|
||||
for product in self:
|
||||
if product.website_description:
|
||||
product.website_description_limited = product.website_description.splitlines()[0]
|
||||
if len(product.website_description_limited) > 240:
|
||||
product.website_description_limited = product.website_description_limited[:240] + '...'
|
||||
else:
|
||||
product.website_description_limited = ''
|
|
@ -1,44 +0,0 @@
|
|||
from odoo import models
|
||||
|
||||
|
||||
class WebsiteSnippetFilter(models.Model):
|
||||
_inherit = "website.snippet.filter"
|
||||
|
||||
def _get_products_latest_sold(self, website, limit, domain, context):
|
||||
products = super()._get_products_latest_sold(website, limit, domain, context)
|
||||
if products:
|
||||
return products.with_context(display_website_description=True)
|
||||
else:
|
||||
return products
|
||||
|
||||
def _get_products_latest_viewed(self, website, limit, domain, context):
|
||||
products = super()._get_products_latest_viewed(website, limit, domain, context)
|
||||
if products:
|
||||
return products.with_context(display_website_description=True)
|
||||
else:
|
||||
return products
|
||||
|
||||
def _get_products_recently_sold_with(self, website, limit, domain, context):
|
||||
products = super()._get_products_recently_sold_with(
|
||||
website, limit, domain, context
|
||||
)
|
||||
if products:
|
||||
return products.with_context(display_website_description=True)
|
||||
else:
|
||||
return products
|
||||
|
||||
def _get_products_accessories(self, website, limit, domain, context):
|
||||
products = super()._get_products_accessories(website, limit, domain, context)
|
||||
if products:
|
||||
return products.with_context(display_website_description=True)
|
||||
else:
|
||||
return products
|
||||
|
||||
def _get_products_alternative_products(self, website, limit, domain, context):
|
||||
products = super()._get_products_alternative_products(
|
||||
website, limit, domain, context
|
||||
)
|
||||
if products:
|
||||
return products.with_context(display_website_description=True)
|
||||
else:
|
||||
return products
|
|
@ -1,9 +1,9 @@
|
|||
.custom_website_description_excerpt {
|
||||
font-size: 15px;
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
font-size: 16px;
|
||||
color: #444;
|
||||
line-height: 1.0;
|
||||
padding: 4px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 12px;
|
||||
background-color: #f6f6ff;
|
||||
border: 1px solid #99d;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
<template
|
||||
id="products_item"
|
||||
name="Display product description"
|
||||
inherit_id="website_sale.products_item"
|
||||
inherit_id="website_sale.products_description"
|
||||
customize_show="True"
|
||||
>
|
||||
<xpath expr="//a[@t-field='product.name']" position="after">
|
||||
<div class="product-desription custom_website_description_excerpt" >
|
||||
<b><div t-if="product.autor">Autor: <t t-out="product.autor" /></div>
|
||||
<div t-if="product.editorial">Editora: <t t-out="product.editorial" /></div>
|
||||
<div t-if="product.genero"><t t-out="product.genero" /></div></b>
|
||||
<div t-if="product.website_description_limited" class="oe_structure oe_empty custom_website_description_excerpt" data-oe-type="html" data-oe-expressioni="product.website_description">
|
||||
<p><t t-out="product.website_description_limited"/></p>
|
||||
<xpath expr="//div[@t-field='product.description_sale']" position="replace">
|
||||
<div class="oe_structure oe_empty custom_website_description_excerpt" >
|
||||
<span t-if="product.autor"><b><t t-out="product.autor" /></b></span>
|
||||
<span t-if="product.genero" class="text-muted small"> (<t t-out="product.genero" />)</span>
|
||||
<span t-if="product.formato" class="text-muted small"><t t-out="product.formato" /></span>
|
||||
<div t-if="product.website_description">
|
||||
<t t-out="product.website_description"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
|
Loading…
Add table
Reference in a new issue