[FIX] point_of_sale: long product name completely visible

Current behavior:
When a product had a too long name, the name was truncated and couldn't
be completely seen.

Steps to reproduce:
- Change the name of a product to a very long name with spaces
- Open the POS
- The product name is truncated

Note:
To fix this we stop showing placeholders when a product doesn't have an
image set.

opw-3245538

closes odoo/odoo#121982

X-original-commit: 13a20470238e14465b4010096f0f6914c1e93a3f
Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
roen-odoo
2023-05-23 14:51:59 +02:00
parent 1347909ede
commit bd1acd4877
3 changed files with 18 additions and 11 deletions
+2 -1
View File
@@ -1925,7 +1925,7 @@ class PosSession(models.Model):
'fields': [
'display_name', 'lst_price', 'standard_price', 'categ_id', 'pos_categ_id', 'taxes_id', 'barcode',
'default_code', 'to_weight', 'uom_id', 'description_sale', 'description', 'product_tmpl_id', 'tracking',
'write_date', 'available_in_pos', 'attribute_line_ids', 'active'
'write_date', 'available_in_pos', 'attribute_line_ids', 'active', 'image_128'
],
'order': 'sequence,default_code,name',
},
@@ -1945,6 +1945,7 @@ class PosSession(models.Model):
product_category_by_id = {category['id']: category for category in categories}
for product in products:
product['categ'] = product_category_by_id[product['categ_id'][0]]
product['image_128'] = bool(product['image_128'])
def _get_pos_ui_product_product(self, params):
self = self.with_context(**params['context'])
@@ -1145,6 +1145,10 @@ td {
padding: 0 map-get($spacers, 2) map-get($spacers, 2);
}
.pos .product .product-name.no-image {
-webkit-line-clamp: 9;
}
.pos .product .product-info-button {
position: absolute;
top: 2px;
@@ -6,17 +6,19 @@
t-on-click="() => this.pos.addProductToCurrentOrder(props.product)"
t-att-data-product-id="props.product.id"
t-attf-aria-labelledby="article_product_{{props.product.id}}">
<div class="product-img">
<img t-att-src="imageUrl" t-att-alt="props.product.display_name" />
</div>
<div class="product-content">
<div class="product-name" t-attf-id="article_product_{{props.product.id}}">
<t t-esc="props.product.display_name" />
<t t-if="props.product.image_128">
<div class="product-img">
<img t-att-src="imageUrl" t-att-alt="props.product.display_name" />
</div>
</t>
<div class="product-content">
<div t-attf-class="#{props.product.image_128 ? 'product-name' : 'product-name no-image' }" t-attf-id="article_product_{{props.product.id}}">
<t t-esc="props.product.display_name" />
</div>
<span class="price-tag">
<t t-esc="price" />
</span>
</div>
<span class="price-tag">
<t t-esc="price" />
</span>
</div>
</article>
</t>