Browse Source

Aug 08: [FIX] Bug Fixed 'point_of_sale_logo'

18.0
Risvana Cybro 2 days ago
parent
commit
3623fa28fb
  1. 5
      point_of_sale_logo/__manifest__.py
  2. 5
      point_of_sale_logo/doc/RELEASE_NOTES.md
  3. 8
      point_of_sale_logo/models/pos_config.py
  4. 18
      point_of_sale_logo/static/src/xml/receipt_header_logo.xml
  5. 9
      point_of_sale_logo/static/src/xml/receipt_screen_logo.xml
  6. 14
      point_of_sale_logo/views/pos_config_views.xml

5
point_of_sale_logo/__manifest__.py

@ -21,7 +21,7 @@
################################################################################
{
'name': 'Point of Sale Logo',
'version': '18.0.1.0.0',
'version': '18.0.2.1.1',
'category': 'Point of Sale',
'summary': "Logo For Every Point of Sale (Screen & Receipt)",
'description': "This module helps you to set a logo for every POS"
@ -36,7 +36,8 @@
'assets': {
'point_of_sale._assets_pos': [
'point_of_sale_logo/static/src/xml/navbar_logo.xml',
'point_of_sale_logo/static/src/xml/receipt_logo.xml'
'point_of_sale_logo/static/src/xml/receipt_header_logo.xml',
'point_of_sale_logo/static/src/xml/receipt_screen_logo.xml',
],
},
'images': ['static/description/banner.jpg'],

5
point_of_sale_logo/doc/RELEASE_NOTES.md

@ -5,3 +5,8 @@
#### ADD
- Initial commit for Point of Sale Logo
#### 07.08.2025
#### Version 18.0.2.1.1
#### UPDT
- Introduced a configurable logo feature for POS receipts, allowing users to select between displaying the POS logo, the company logo, or both.

8
point_of_sale_logo/models/pos_config.py

@ -28,3 +28,11 @@ class PosConfig(models.Model):
image = fields.Binary(string='Image', help="Set logo image for viewing it"
"in POS Screen and Receipt")
logo_option = fields.Selection(
selection=[
('pos', 'Show POS Logo Only'),
('company', 'Show Company Logo Only'),
('both', 'Show Both POS and Company Logos')],
string="Receipt Logo Option",
default='pos',
help="Choose which logo(s) to display on the printed POS receipt.")

18
point_of_sale_logo/static/src/xml/receipt_header_logo.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Adding the logo in the pos ReceiptHeader-->
<templates id="point_of_sale.template" xml:space="preserve">
<t t-inherit="point_of_sale.ReceiptHeader" t-inherit-mode="extension"
owl="1">
<xpath expr="//img" position="replace">
<t t-if="this.env.services.pos.config.logo_option === 'pos'">
<img t-attf-src="/web/image?model=pos.config&amp;field=image&amp;id={{ this.env.services.pos.config.id }}"
alt="Logo" class="pos-receipt-logo"/>
</t>
<t t-else="">
<img t-attf-src="/web/image?model=res.company&amp;id={{props.data.company.id}}&amp;field=logo"
alt="Logo" class="pos-receipt-logo"/>
</t>
</xpath>
</t>
</templates>

9
point_of_sale_logo/static/src/xml/receipt_logo.xml → point_of_sale_logo/static/src/xml/receipt_screen_logo.xml

@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Adding the logo in the pos receipt-->
<templates id="point_of_sale.template" xml:space="preserve">
<!--Adding the logo in the pos Receipt-->
<templates id="point_of_sale.receipt_template" xml:space="preserve">
<t t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension"
owl="1">
<xpath expr="//div[hasclass('pos-receipt')]/ReceiptHeader"
position="before">
<t t-log="this.env.services.pos.config.id"/>
<img t-if="this.env.services.pos.config.image"
<img t-if="this.env.services.pos.config.logo_option === 'both'"
t-attf-src="/web/image?model=pos.config&amp;field=image&amp;id={{ this.env.services.pos.config.id }}"
style="width:10%"/>
</xpath>
</t>
</templates>
</templates>

14
point_of_sale_logo/views/pos_config_views.xml

@ -7,9 +7,17 @@
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.pos_config_view_form"/>
<field name="arch" type="xml">
<field name="name" position="before">
<field name="image" widget='image' class="oe_avatar"/>
</field>
<xpath expr="//div" position="after">
<div class="row mt16 o_settings_container">
<setting string="Receipt Logo Option"
help="Select which logo to display on the POS receipt: POS Logo, Company Logo, or Both.">
<field name="logo_option" widget="radio" options="{'horizontal': true}"/>
<div style="margin:10px;">
<field name="image" widget="image" invisible="logo_option == 'company'" required="logo_option != 'company'"/>
</div>
</setting>
</div>
</xpath>
</field>
</record>
</odoo>

Loading…
Cancel
Save