Sylvain LE GAL
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
72 additions and
2 deletions
-
pos_default_empty_image/__manifest__.py
-
pos_default_empty_image/models/__init__.py
-
pos_default_empty_image/models/pos_config.py
-
pos_default_empty_image/readme/CONFIGURATION.rst
-
BIN
pos_default_empty_image/static/description/pos_config_form.png
-
pos_default_empty_image/static/src/css/pos_default_empty_image.css
-
pos_default_empty_image/static/src/xml/pos_default_empty_image.xml
-
pos_default_empty_image/views/pos_config.xml
|
|
@ -13,6 +13,7 @@ |
|
|
|
], |
|
|
|
'data': [ |
|
|
|
'views/templates.xml', |
|
|
|
'views/pos_config.xml', |
|
|
|
], |
|
|
|
'qweb': [ |
|
|
|
'static/src/xml/pos_default_empty_image.xml', |
|
|
|
|
|
@ -1 +1,2 @@ |
|
|
|
from . import pos_config |
|
|
|
from . import product_product |
|
|
@ -0,0 +1,16 @@ |
|
|
|
# Copyright (C) 2020 - Today: |
|
|
|
# GRAP (http://www.grap.coop) |
|
|
|
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
from odoo import models, fields |
|
|
|
|
|
|
|
|
|
|
|
class PosConfig(models.Model): |
|
|
|
_inherit = 'pos.config' |
|
|
|
|
|
|
|
iface_fixed_font_size = fields.Integer( |
|
|
|
string="Fixed Font Size", |
|
|
|
help="Font size of the product name, when it has no image." |
|
|
|
" Set '0' will set adaptative font-size, depending on the" |
|
|
|
" length of the name.") |
|
|
@ -0,0 +1,7 @@ |
|
|
|
* Go to your PoS Configuration |
|
|
|
|
|
|
|
.. figure:: ../static/description/pos_config_form.png |
|
|
|
|
|
|
|
* Select the font size used to display product name, when there is no image. |
|
|
|
|
|
|
|
* If not set, the font size will depend on the name length. |
Width: 839
|
Height: 222
|
Size: 20 KiB
|
|
|
@ -14,7 +14,6 @@ |
|
|
|
top:25px !important; |
|
|
|
padding-top:3px !important; |
|
|
|
height:80px !important; |
|
|
|
font-size: 24px !important; |
|
|
|
line-height: 20px; |
|
|
|
text-align: center; |
|
|
|
word-wrap: break-word; |
|
|
|
|
|
@ -2,6 +2,19 @@ |
|
|
|
<templates id="template" xml:space="preserve"> |
|
|
|
<t t-name="ProductNoImage"> |
|
|
|
<article class='product' t-att-data-product-id="product.id" tabindex="0" t-attf-aria-labelledby="article_product_#{product.id}"> |
|
|
|
<t t-set="name_length" t-value="product.display_name.length" /> |
|
|
|
<t t-if='widget.pos.config.iface_fixed_font_size'> |
|
|
|
<t t-set="font_size" t-value="widget.pos.config.iface_fixed_font_size" /> |
|
|
|
</t> |
|
|
|
<t t-else=""> |
|
|
|
<t t-set="font_size" t-value=" |
|
|
|
name_length >=120 and 11 |
|
|
|
or name_length >=90 and 12 |
|
|
|
or name_length >=60 and 13 |
|
|
|
or name_length>=50 and 14 |
|
|
|
or name_length>=40 and 16 |
|
|
|
or 20"/> |
|
|
|
</t> |
|
|
|
<div class="product-img-without-image"> |
|
|
|
<t t-if="!product.to_weight"> |
|
|
|
<span class="price-tag"> |
|
|
@ -14,7 +27,7 @@ |
|
|
|
</span> |
|
|
|
</t> |
|
|
|
</div> |
|
|
|
<div class="product-name-without-image" t-attf-id="article_product_#{product.id}"> |
|
|
|
<div class="product-name-without-image" t-attf-id="article_product_#{product.id}" t-attf-style="font-size: #{font_size}px !important; line-height: #{font_size}px !important;"> |
|
|
|
<t t-esc="product.display_name"/> |
|
|
|
</div> |
|
|
|
</article> |
|
|
|
|
|
@ -0,0 +1,33 @@ |
|
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
<!-- Copyright 2020 Creu Blanca |
|
|
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|
|
|
|
|
|
|
<odoo> |
|
|
|
|
|
|
|
<record model="ir.ui.view" id="pos_config_view_form"> |
|
|
|
<field name="model">pos.config</field> |
|
|
|
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/> |
|
|
|
<field name="arch" type="xml"> |
|
|
|
<xpath expr="//field[@name='iface_big_scrollbars']/../.." position="after"> |
|
|
|
|
|
|
|
<div class="col-12 col-lg-6 o_setting_box"> |
|
|
|
<div class="o_setting_right_pane"> |
|
|
|
<label for="iface_fixed_font_size" string="Fixed Font Size"/> |
|
|
|
<div class="text-muted"> |
|
|
|
Font size of the product name, when it has no image. Set '0' will set adaptative font-size, depending on the length of the name. |
|
|
|
</div> |
|
|
|
<div class="content-group mt16"> |
|
|
|
<field name="iface_fixed_font_size"/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</xpath> |
|
|
|
</field> |
|
|
|
</record> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</odoo> |