Browse Source

Jun 15: [FIX] Bug Fixed 'custom_receipts_for_pos'

pull/331/head
RisvanaCybro 11 months ago
parent
commit
9c623e81ee
  1. 10
      custom_receipts_for_pos/README.rst
  2. 21
      custom_receipts_for_pos/__init__.py
  3. 23
      custom_receipts_for_pos/__manifest__.py
  4. 60
      custom_receipts_for_pos/data/pos_receipt_data.xml
  5. 5
      custom_receipts_for_pos/doc/RELEASE_NOTES.md
  6. 6
      custom_receipts_for_pos/models/__init__.py
  7. 21
      custom_receipts_for_pos/models/pos_config.py
  8. 7
      custom_receipts_for_pos/models/pos_receipt.py
  9. 6
      custom_receipts_for_pos/models/pos_session.py
  10. 31
      custom_receipts_for_pos/models/res_config_settings.py
  11. 3
      custom_receipts_for_pos/security/ir.model.access.csv
  12. BIN
      custom_receipts_for_pos/static/description/assets/screenshots/1.png
  13. BIN
      custom_receipts_for_pos/static/description/assets/screenshots/2.png
  14. BIN
      custom_receipts_for_pos/static/description/assets/screenshots/3.png
  15. BIN
      custom_receipts_for_pos/static/description/assets/screenshots/4.png
  16. BIN
      custom_receipts_for_pos/static/description/assets/screenshots/5.png
  17. BIN
      custom_receipts_for_pos/static/description/assets/screenshots/6.png
  18. BIN
      custom_receipts_for_pos/static/description/assets/screenshots/7.png
  19. BIN
      custom_receipts_for_pos/static/description/assets/screenshots/hero.gif
  20. 38
      custom_receipts_for_pos/static/description/index.html
  21. 13
      custom_receipts_for_pos/static/src/js/receipt_design.js
  22. 0
      custom_receipts_for_pos/static/src/xml/order_receipt.xml
  23. 15
      custom_receipts_for_pos/views/point_of_sale_views.xml
  24. 29
      custom_receipts_for_pos/views/pos_config_views.xml
  25. 23
      custom_receipts_for_pos/views/pos_receipt_views.xml
  26. 8
      custom_receipts_for_pos/views/res_config_settings_views.xml

10
custom_receipts_for_pos/README.rst

@ -2,10 +2,9 @@
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
POS Receipt Designs
===================
POS Receipt Design POS Receipt Design
===================
Option to select the customised Receipts for each POS
Company Company
------- -------
@ -13,7 +12,10 @@ Company
Credits Credits
------- -------
Developer: Sadique Kottekkat @cybrosys, Contact: odoo@cybrosys.com Developer: (V14) Syamili K,
(V15) Sajna Sherin T,
(V16 & V17) Sadique Kottekkat, Abhishek E T @cybrosys
Contact: odoo@cybrosys.com
Contacts Contacts
-------- --------

21
custom_receipts_for_pos/__init__.py

@ -1,22 +1,23 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################# ################################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) # Author: Sadique Kottekkat (<https://www.cybrosys.com>)
# #
# You can modify it under the terms of the GNU LESSER # This program is free software: you can modify
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # it under the terms of the GNU Affero General Public License (AGPL) as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE # You should have received a copy of the GNU Affero General Public License
# (LGPL v3) along with this program. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# ################################################################################
from . import models from . import models

23
custom_receipts_for_pos/__manifest__.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
################################################################################### ################################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sadique Kottekkat (<https://www.cybrosys.com>) # Author: Sadique Kottekkat (<https://www.cybrosys.com>)
# #
# This program is free software: you can modify # This program is free software: you can modify
@ -19,30 +19,31 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
################################################################################### ################################################################################
{ {
'name': 'POS Receipt Design', 'name': 'POS Receipt Design',
'version': '17.0.1.0.1', 'version': '17.0.1.0.2',
'category': 'Point of Sale', 'category': 'Point of Sale',
'summary': """POS Receipt, Receipt Design, POS Receipt Template, Design Report, Custom Receipt,POS Report, Customis Receipt, Odoo17, Odoo Apps """, 'summary': "POS Receipt, Receipt Design, POS Receipt Template, Design "
'description': "Option to select the customised Receipts for each POS," "Report, Custom Receipt, POS Report, Customise Receipt, Odoo17, "
"So we can easily updated the Recipet Design for better styles", "Odoo Apps",
'description': "Option to select the customised Receipts for each POS. So, "
"we can easily updated the Receipt Design for better styles",
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com", 'website': 'https://www.cybrosys.com',
'depends': ['base', 'point_of_sale'], 'depends': ['base', 'point_of_sale'],
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'data/pos_receipt_views_data.xml', 'data/pos_receipt_data.xml',
'views/point_of_sale_views.xml',
'views/pos_receipt_views.xml', 'views/pos_receipt_views.xml',
'views/res_config_settings_views.xml', 'views/res_config_settings_views.xml',
], ],
'assets': { 'assets': {
'point_of_sale._assets_pos': [ 'point_of_sale._assets_pos': [
'custom_receipts_for_pos/static/src/js/receipt_design.js', 'custom_receipts_for_pos/static/src/js/receipt_design.js',
'custom_receipts_for_pos/static/src/xml/receipt_design_template_views.xml', 'custom_receipts_for_pos/static/src/xml/order_receipt.xml',
], ],
}, },
'images': ['static/description/banner.png'], 'images': ['static/description/banner.png'],

60
custom_receipts_for_pos/data/pos_receipt_views_data.xml → custom_receipts_for_pos/data/pos_receipt_data.xml

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<!-- Sub Categories --> <!-- Examples for receipt design: which can be used or modified -->
<record id="pos_receipt_design1" model="pos.receipt"> <record id="pos_receipt_design1" model="pos.receipt">
<field name="name">Design 1</field> <field name="name">Design 1</field>
<field name="design_receipt"><![CDATA[<div class="pos-receipt"> <field name="design_receipt"><![CDATA[<div class="pos-receipt">
@ -38,8 +38,7 @@
<br /> <br />
</t> </t>
<div> <div>
<table class='receipt-orderlines' style="font-size:15px; border-style: double; <table class='receipt-orderlines' style="font-size:15px; border-style:double; border-left:none; border-right:none; border-bottom:none; width:100%;">
border-left: none;border-right: none;border-bottom: none;width: 100%;">
<colgroup> <colgroup>
<col width='40%' /> <col width='40%' />
<col width='30%' /> <col width='30%' />
@ -47,11 +46,11 @@
</colgroup> </colgroup>
<tr style="border-bottom:1px dashed black;"> <tr style="border-bottom:1px dashed black;">
<th style="text-align:left;">Product</th> <th style="text-align:left;">Product</th>
<th style="text-align:center;">Qty</th> <th style="text-align:right;">Qty</th>
<th style="text-align:center;">Amount</th> <th style="text-align:right;">Amount</th>
</tr> </tr>
<tr t-foreach="props.orderlines" t-as="orderline" t-key="index_orderlines"> <tr t-foreach="props.orderlines" t-as="orderline" t-key="index_orderlines">
<td style="padding-top: 1%;padding-bottom: 1%;"> <td style="padding-top:1%; padding-bottom:1%; text-align:left;">
<t t-esc="orderline.get_product().display_name"/> <t t-esc="orderline.get_product().display_name"/>
<t t-if="orderline.get_discount() > 0"> <t t-if="orderline.get_discount() > 0">
<div style="font-size:12px; font-style:italic; color:#808080;"> <div style="font-size:12px; font-style:italic; color:#808080;">
@ -62,11 +61,11 @@
<div style="font-size:14px;" t-esc="orderline.customerNote"/> <div style="font-size:14px;" t-esc="orderline.customerNote"/>
</t> </t>
</td> </td>
<td class="pos-center-align"> <td style="text-align:right; font-size:14px;">
<t t-esc="orderline.get_quantity_str_with_unit()"/> <t t-esc="orderline.get_quantity_str_with_unit()"/>
</td> </td>
<td class="pos-center-align"> <td style="text-align:right; font-size:14px;">
<t t-esc="orderline.get_display_price()"/> <t t-esc="env.utils.formatCurrency(orderline.get_display_price())"/>
</td> </td>
</tr> </tr>
</table> </table>
@ -77,11 +76,11 @@
<t t-set='taxincluded' t-value='Math.abs(props.receipt.amount_total - props.receipt.total_with_tax) &lt;= 0.000001' /> <t t-set='taxincluded' t-value='Math.abs(props.receipt.amount_total - props.receipt.total_with_tax) &lt;= 0.000001' />
<t t-if='!taxincluded'> <t t-if='!taxincluded'>
<br/> <br/>
<div style="font-weight: 700; font-size: 14px; border-top:1px dashed;"><span style="margin-left: 40%;">Subtotal : </span><span t-esc='props.receipt.amount_total' class="pos-receipt-right-align"/></div> <div style="font-weight:700; font-size:14px; border-top:1px dashed;"><span style="margin-left:40%;">Subtotal : </span><span t-esc='env.utils.formatCurrency(props.data.total_without_tax)' class="pos-receipt-right-align"/></div>
<t t-foreach='props.receipt.tax_details' t-as='tax' t-key="index_tax_details"> <t t-foreach='props.receipt.tax_details' t-as='tax' t-key="index_tax_details">
<div style="font-weight:700; font-size:14px;"> <div style="font-weight:700; font-size:14px;">
<span style="margin-left:40%;"><t t-esc='tax.name' /></span> <span style="margin-left:40%;"><t t-esc='tax.name' /></span>
<span t-esc='tax.amount' class="pos-receipt-right-align"/> <span t-esc='env.utils.formatCurrency(tax.amount)' class="pos-receipt-right-align"/>
</div> </div>
</t> </t>
</t> </t>
@ -89,17 +88,15 @@
<br/> <br/>
<div style="font-weight:700; font-size:14px;"> <div style="font-weight:700; font-size:14px;">
<span style="margin-left:40%;">TOTAL : </span> <span style="margin-left:40%;">TOTAL : </span>
<span t-esc='props.receipt.amount_total' class="pos-receipt-right-align"/> <span t-esc='env.utils.formatCurrency(props.receipt.amount_total)' class="pos-receipt-right-align"/>
</div> </div>
</div> </div>
<div class='before-footer' /> <div class='before-footer' />
<br/> <br/><br/>
<br/>
<!-- Footer --> <!-- Footer -->
<div class="pos-receipt-order-data"> <div class="pos-receipt-order-data">
<div><t t-esc="props.receipt.name" /></div> <div><t t-esc="props.receipt.name" />
</div>
<t t-if="props.receipt.date"> <t t-if="props.receipt.date">
<div><t t-esc="props.receipt.date" /></div> <div><t t-esc="props.receipt.date" /></div>
</t> </t>
@ -107,7 +104,6 @@
<div><t t-esc="props.receipt.date" /></div> <div><t t-esc="props.receipt.date" /></div>
</t> </t>
</div> </div>
<br/><br/> <br/><br/>
<div style="font-size:14px; text-align:center;"> <div style="font-size:14px; text-align:center;">
Thank You... Please Visit Again ... Thank You... Please Visit Again ...
@ -159,11 +155,11 @@
</colgroup> </colgroup>
<tr style="border-bottom:1px dashed black;"> <tr style="border-bottom:1px dashed black;">
<th style="text-align:left;">Product</th> <th style="text-align:left;">Product</th>
<th style="text-align:center;">Qty</th> <th style="text-align:right;">Qty</th>
<th style="text-align:center;">Amount</th> <th style="text-align:right;">Amount</th>
</tr> </tr>
<tr t-foreach="props.orderlines" t-as="orderline" t-key="index_props_orderlines"> <tr t-foreach="props.orderlines" t-as="orderline" t-key="index_props_orderlines">
<td style="padding-top: 1%;padding-bottom: 1%;"> <td style="padding-top:1%; padding-bottom:1%; text-align:left;">
<t t-esc="orderline.get_product().display_name"/> <t t-esc="orderline.get_product().display_name"/>
<t t-if="orderline.get_discount() > 0"> <t t-if="orderline.get_discount() > 0">
<div style="font-size:12px; font-style:italic; color:#808080;"> <div style="font-size:12px; font-style:italic; color:#808080;">
@ -174,11 +170,11 @@
<div style="font-size:14px;" t-esc="orderline.customerNote"/> <div style="font-size:14px;" t-esc="orderline.customerNote"/>
</t> </t>
</td> </td>
<td class="pos-center-align"> <td style="text-align:right;">
<t t-esc="orderline.get_quantity_str_with_unit()"/> <t t-esc="orderline.get_quantity_str_with_unit()"/>
</td> </td>
<td class="pos-center-align"> <td style="text-align:right;">
<t t-esc="orderline.get_display_price()"/> <t t-esc="env.utils.formatCurrency(orderline.get_display_price())"/>
</td> </td>
</tr> </tr>
</table> </table>
@ -189,11 +185,11 @@
<t t-set='taxincluded' t-value='Math.abs(props.receipt.amount_total - props.receipt.total_with_tax) &lt;= 0.000001' /> <t t-set='taxincluded' t-value='Math.abs(props.receipt.amount_total - props.receipt.total_with_tax) &lt;= 0.000001' />
<t t-if='!taxincluded'> <t t-if='!taxincluded'>
<br/> <br/>
<div style="font-weight: 700; font-size: 14px; border-top:1px dashed;"><span style="margin-left: 40%;">Subtotal : </span><span t-esc='props.receipt.amount_total' class="pos-receipt-right-align"/></div> <div style="font-weight:700; font-size:14px; border-top:1px dashed;"><span style="margin-left:40%;">Subtotal : </span><span t-esc='env.utils.formatCurrency(props.data.total_without_tax)' class="pos-receipt-right-align"/></div>
<t t-foreach='props.receipt.tax_details' t-as='tax' t-key="index_tax_details"> <t t-foreach='props.receipt.tax_details' t-as='tax' t-key="index_tax_details">
<div style="font-weight:700; font-size:14px;"> <div style="font-weight:700; font-size:14px;">
<span style="margin-left:40%;"><t t-esc='tax.name' /></span> <span style="margin-left:40%;"><t t-esc='tax.name' /></span>
<span t-esc='tax.amount' class="pos-receipt-right-align"/> <span t-esc='env.utils.formatCurrency(tax.amount)' class="pos-receipt-right-align"/>
</div> </div>
</t> </t>
</t> </t>
@ -201,7 +197,7 @@
<br/> <br/>
<div style="font-weight:700; font-size:14px;"> <div style="font-weight:700; font-size:14px;">
<span style="margin-left:40%;">TOTAL : </span> <span style="margin-left:40%;">TOTAL : </span>
<span t-esc='props.receipt.amount_total' class="pos-receipt-right-align"/> <span t-esc='env.utils.formatCurrency(props.receipt.amount_total)' class="pos-receipt-right-align"/>
</div> </div>
<br/><br/> <br/><br/>
</div> </div>
@ -209,32 +205,32 @@
<t t-foreach='props.paymentlines' t-as='line' t-key="index_paymentlines"> <t t-foreach='props.paymentlines' t-as='line' t-key="index_paymentlines">
<div style="font-size:14px; border-top:1px dashed; padding-top:5px;"> <div style="font-size:14px; border-top:1px dashed; padding-top:5px;">
<span style="margin-left:40%;"><t t-esc='line.name' /></span> <span style="margin-left:40%;"><t t-esc='line.name' /></span>
<span t-esc='line.get_amount()' class="pos-receipt-right-align"/> <span t-esc='env.utils.formatCurrency(line.get_amount())' class="pos-receipt-right-align"/>
</div> </div>
</t> </t>
<br/> <br/>
<div class="receipt-change" style="font-size:14px;"> <div class="receipt-change" style="font-size:14px;">
<span style="margin-left:40%;">CHANGE : </span> <span style="margin-left:40%;">CHANGE : </span>
<span t-esc='props.receipt.change' class="pos-receipt-right-align"/> <span t-esc='env.utils.formatCurrency(props.receipt.change)' class="pos-receipt-right-align"/>
</div> </div>
<br/> <br/>
<!-- Extra Payment Info --> <!-- Extra Payment Info -->
<t t-if='props.receipt.total_discount'> <t t-if='props.receipt.total_discount'>
<div style="font-size:14px; border-top:1px dashed; padding-top:5px;"> <div style="font-size:14px; border-top:1px dashed; padding-top:5px;">
<span style="margin-left:40%;">Discounts : </span> <span style="margin-left:40%;">Discounts : </span>
<span t-esc='props.receipt.total_discount' class="pos-receipt-right-align"/> <span t-esc='env.utils.formatCurrency(props.receipt.total_discount)' class="pos-receipt-right-align"/>
</div> </div>
</t> </t>
<t t-if='taxincluded'> <t t-if='taxincluded'>
<t t-foreach='props.receipt.tax_details' t-as='tax' t-key="index_receipt_tax_details"> <t t-foreach='props.receipt.tax_details' t-as='tax' t-key="index_receipt_tax_details">
<div style="font-size:14px;"> <div style="font-size:14px;">
<span style="margin-left:40%;"><t t-esc='tax.name' /></span> <span style="margin-left:40%;"><t t-esc='tax.name' /></span>
<span t-esc='tax.amount' class="pos-receipt-right-align"/> <span t-esc='env.utils.formatCurrency(tax.amount)' class="pos-receipt-right-align"/>
</div> </div>
</t> </t>
<div style="font-size:14px;"> <div style="font-size:14px;">
<span style="margin-left:40%;">Total Taxes : </span> <span style="margin-left:40%;">Total Taxes : </span>
<span t-esc='props.receipt.total_tax' class="pos-receipt-right-align"/> <span t-esc='penv.utils.formatCurrency(rops.receipt.total_tax)' class="pos-receipt-right-align"/>
</div> </div>
</t> </t>
<div class='before-footer' /> <div class='before-footer' />

5
custom_receipts_for_pos/doc/RELEASE_NOTES.md

@ -9,3 +9,8 @@
#### Version 17.0.1.0.1 #### Version 17.0.1.0.1
##### BUGFIX ##### BUGFIX
- Fixed the error in printing the receipt - Fixed the error in printing the receipt
#### 15.06.2024
#### Version 17.0.1.0.2
##### BUGFIX
- Fix the receipt selection for each point of sales

6
custom_receipts_for_pos/models/__init__.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
################################################################################### ################################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies (<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sadique Kottekkat (<https://www.cybrosys.com>) # Author: Sadique Kottekkat (<https://www.cybrosys.com>)
# #
# This program is free software: you can modify # This program is free software: you can modify
@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
################################################################################### ################################################################################
from .import pos_receipt from .import pos_receipt
from .import pos_config from .import pos_config
from .import res_config_settings from .import res_config_settings

21
custom_receipts_for_pos/models/pos_config.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### ################################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sadique Kottekkat (<https://www.cybrosys.com>) # Author: Sadique Kottekkat (<https://www.cybrosys.com>)
# #
# This program is free software: you can modify # This program is free software: you can modify
@ -19,22 +19,23 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################### ################################################################################
from odoo import fields, models from odoo import fields, models
class PosConfig(models.Model): class PosConfig(models.Model):
""" """
This is an Odoo model for Point of Sale (POS). This is an Odoo model for Point of Sale (POS).
It inherits from the 'pos.config' model and extends its functionality. It inherits the 'pos.config' model to add new fields.
""" """
_inherit = "pos.config" _inherit = 'pos.config'
receipt_design = fields.Many2one('pos.receipt', receipt_design = fields.Many2one('pos.receipt', string='Receipt Design',
string="Receipt Design", help='Choose any receipt design',
help="Choose any receipt design") default=lambda self: self.env[
'pos.receipt'].search([], limit=1))
design_receipt = fields.Text(related='receipt_design.design_receipt', design_receipt = fields.Text(related='receipt_design.design_receipt',
string='Receipt XML') string='Receipt XML')
is_custom_receipt = fields.Boolean(string='Is Custom Receipt', is_custom_receipt = fields.Boolean(string='Is Custom Receipt',
help='Boolean indicating the receipt' help='Indicates the receipt design is '
' design is custom or not') 'custom or not')

7
custom_receipts_for_pos/models/pos_receipt.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### ################################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sadique Kottekkat (<https://www.cybrosys.com>) # Author: Sadique Kottekkat (<https://www.cybrosys.com>)
# #
# This program is free software: you can modify # This program is free software: you can modify
@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################### ################################################################################
from odoo import fields, models from odoo import fields, models
@ -30,6 +30,7 @@ class PosReceipt(models.Model):
receipt design. receipt design.
""" """
_name = 'pos.receipt' _name = 'pos.receipt'
_description = 'POS Receipts'
name = fields.Char(string='Name', help='Name of the pos receipt') name = fields.Char(string='Name', help='Name of the pos receipt')
design_receipt = fields.Text(string='Receipt XML', design_receipt = fields.Text(string='Receipt XML',

6
custom_receipts_for_pos/models/pos_session.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### ################################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sadique Kottekkat (<https://www.cybrosys.com>) # Author: Sadique Kottekkat (<https://www.cybrosys.com>)
# #
# This program is free software: you can modify # This program is free software: you can modify
@ -19,7 +19,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################### ################################################################################
from odoo import models from odoo import models

31
custom_receipts_for_pos/models/res_config_settings.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################### ################################################################################
# #
# Cybrosys Technologies Pvt. Ltd. # Cybrosys Technologies Pvt. Ltd.
# #
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). # Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sadique Kottekkat (<https://www.cybrosys.com>) # Author: Sadique Kottekkat (<https://www.cybrosys.com>)
# #
# This program is free software: you can modify # This program is free software: you can modify
@ -19,8 +19,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
############################################################################### ################################################################################
from odoo import api, fields, models from odoo import fields, models
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
@ -31,23 +31,10 @@ class ResConfigSettings(models.TransientModel):
""" """
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
pos_receipt_design = fields.Many2one(related='pos_config_id.receipt_design', pos_receipt_design = fields.Many2one(
string="Receipt Design", related='pos_config_id.receipt_design', readonly=False,
help="Choose any receipt design", string='Receipt Design', help='Choose any receipt design')
compute='_compute_pos_is_custom_receipt',
readonly=False, store=True,
default=lambda self: self.env['pos.receipt'].search([], limit=1))
pos_design_receipt = fields.Text(related='pos_config_id.design_receipt', pos_design_receipt = fields.Text(related='pos_config_id.design_receipt',
string='Receipt XML') string='Receipt XML')
pos_is_custom_receipt = fields.Boolean(related='pos_config_id.' pos_is_custom_receipt = fields.Boolean(
'is_custom_receipt', related='pos_config_id.is_custom_receipt', readonly=False, store=True)
readonly=False, store=True)
@api.depends('pos_is_custom_receipt', 'pos_config_id')
def _compute_pos_is_custom_receipt(self):
"""The compute function for finding the Receipt status"""
for res_config in self:
if res_config.pos_is_custom_receipt:
res_config.pos_receipt_design = res_config.pos_config_id.receipt_design
else:
res_config.pos_receipt_design = False

3
custom_receipts_for_pos/security/ir.model.access.csv

@ -1,3 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_pos_receipt,access_pos_receipt,model_pos_receipt,base.group_user,1,1,1,1 access_pos_receipt_user,access.pos.receipt.user,model_pos_receipt,base.group_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_pos_receipt access_pos_receipt_user access_pos_receipt access.pos.receipt.user model_pos_receipt base.group_user 1 1 1 1

BIN
custom_receipts_for_pos/static/description/assets/screenshots/1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 111 KiB

BIN
custom_receipts_for_pos/static/description/assets/screenshots/2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 63 KiB

BIN
custom_receipts_for_pos/static/description/assets/screenshots/3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 39 KiB

BIN
custom_receipts_for_pos/static/description/assets/screenshots/4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 116 KiB

BIN
custom_receipts_for_pos/static/description/assets/screenshots/5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 194 KiB

BIN
custom_receipts_for_pos/static/description/assets/screenshots/6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 97 KiB

BIN
custom_receipts_for_pos/static/description/assets/screenshots/7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 92 KiB

BIN
custom_receipts_for_pos/static/description/assets/screenshots/hero.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 224 KiB

38
custom_receipts_for_pos/static/description/index.html

@ -277,13 +277,37 @@
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);"> style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="d-flex mb-3" style="font-size: 0.8rem; font-weight: 500;"><span>Version <div class="d-flex mb-3" style="font-size: 0.8rem; font-weight: 500;"><span>Version
17.0.1.0.0</span><span class="px-2">|</span><span 17.0.1.0.0</span><span class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on:05th Feb 2024</span> style="color: #714B67;font-weight: 600;">Released on: February 05, 2024</span>
</div> </div>
<p class="m-0" <p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;"> style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial Commit for POS Receipt Designs.</p> Initial Commit for POS Receipt Designs.</p>
</div> </div>
</div> </div>
<div class="col-mg-12 active" style="padding: 1rem 4rem;">
<div class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="d-flex mb-3" style="font-size: 0.8rem; font-weight: 500;"><span>Version
17.0.1.0.0</span><span class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on: April 17, 2024</span>
</div>
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Fixed the error in printing the receipt.</p>
</div>
</div>
<div class="col-mg-12 active" style="padding: 1rem 4rem;">
<div class="py-3"
style="font-weight: 500;background-color: #fff; border-radius: 4px; padding: 1rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="d-flex mb-3" style="font-size: 0.8rem; font-weight: 500;"><span>Version
17.0.1.0.0</span><span class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on: May 21, 2024</span>
</div>
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Fix the receipt selection for each point of sales.</p>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -304,7 +328,7 @@
<img src="assets/modules/1.png" alt="" width="100%" height="auto"> <img src="assets/modules/1.png" alt="" width="100%" height="auto">
</div> </div>
<p class="text-center pt-2 text-black font-weight-bold">Manufacturing Reports</p> <p class="text-center pt-2 text-black font-weight-bold">Odoo17 Invoice Format Editor</p>
</div> </div>
</a> </a>
</div> </div>
@ -317,7 +341,7 @@
<img src="assets/modules/2.png" alt="" width="100%" height="auto"> <img src="assets/modules/2.png" alt="" width="100%" height="auto">
</div> </div>
<p class="text-center pt-2 text-black font-weight-bold">Print Work Order Details</p> <p class="text-center pt-2 text-black font-weight-bold">POS Booking Order</p>
</div> </div>
</a> </a>
</div> </div>
@ -330,7 +354,7 @@
<img src="assets/modules/3.png" alt="" width="100%" height="auto"> <img src="assets/modules/3.png" alt="" width="100%" height="auto">
</div> </div>
<p class="text-center pt-2 text-black font-weight-bold">Show Total Cost On BOM</p> <p class="text-center pt-2 text-black font-weight-bold">Pos Product Magnify Image</p>
</div> </div>
</a> </a>
</div> </div>
@ -347,7 +371,7 @@
<img src="assets/modules/4.png" alt="" width="100%" height="auto"> <img src="assets/modules/4.png" alt="" width="100%" height="auto">
</div> </div>
<p class="text-center pt-2 text-black font-weight-bold">Simple Manufacturing Orders</p> <p class="text-center pt-2 text-black font-weight-bold">Make MRP Orders from POS</p>
</div> </div>
</a> </a>
</div> </div>
@ -360,7 +384,7 @@
<img src="assets/modules/5.png" alt="" width="100%" height="auto"> <img src="assets/modules/5.png" alt="" width="100%" height="auto">
</div> </div>
<p class="text-center pt-2 text-black font-weight-bold">BOM Multiple Product Selection</p> <p class="text-center pt-2 text-black font-weight-bold">Service Charges POS</p>
</div> </div>
</a> </a>
</div> </div>
@ -372,7 +396,7 @@
<div style="width: 300px;"> <div style="width: 300px;">
<img src="assets/modules/6.png" alt="" width="100%" height="auto"> <img src="assets/modules/6.png" alt="" width="100%" height="auto">
</div> </div>
<p class="text-center pt-2 text-black font-weight-bold"> Catch Weight Management: Manufacturing</p> <p class="text-center pt-2 text-black font-weight-bold">Make MRP Orders from POS</p>
</div> </div>
</a> </a>
</div> </div>

13
custom_receipts_for_pos/static/src/js/receipt_design.js

@ -1,7 +1,6 @@
/** @odoo-module */ /** @odoo-module */
import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/order_receipt"; import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/order_receipt";
import { patch } from "@web/core/utils/patch"; import { patch } from "@web/core/utils/patch";
import { Orderline } from "@point_of_sale/app/generic_components/orderline/orderline";
import { useState, Component, xml } from "@odoo/owl"; import { useState, Component, xml } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks"; import { useService } from "@web/core/utils/hooks";
@ -20,21 +19,19 @@ patch(OrderReceipt.prototype, {
receipt: this.pos.orders[0].export_for_printing(), receipt: this.pos.orders[0].export_for_printing(),
orderlines:this.pos.orders[0].get_orderlines(), orderlines:this.pos.orders[0].get_orderlines(),
paymentlines:this.pos.orders[0].get_paymentlines() paymentlines:this.pos.orders[0].get_paymentlines()
} };
}, },
get templateComponent() { get templateComponent() {
var mainRef = this var mainRef = this;
return class extends Component { return class extends Component {
setup() {} setup() {}
static template = xml`${mainRef.pos.config.design_receipt}` static template = xml`${mainRef.pos.config.design_receipt}`
} };
}, },
get isTrue() { get isTrue() {
if (this.env.services.pos.config.is_custom_receipt == false) { if (this.env.services.pos.config.is_custom_receipt == false) {
return true return true;
}
else {
return false
} }
return false;
} }
}); });

0
custom_receipts_for_pos/static/src/xml/receipt_design_template_views.xml → custom_receipts_for_pos/static/src/xml/order_receipt.xml

15
custom_receipts_for_pos/views/point_of_sale_views.xml

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--Inherit the menu for pos receipt-->
<record id="action_pos_receipt" model="ir.actions.act_window">
<field name="name">Receipt Designs</field>
<field name="res_model">pos.receipt</field>
<field name="view_mode">tree,form</field>
<field name="target">current</field>
</record>
<menuitem
id="menu_pos_receipt"
parent="point_of_sale.menu_point_config_product"
action="action_pos_receipt"
sequence="50"/>
</odoo>

29
custom_receipts_for_pos/views/pos_config_views.xml

@ -1,29 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<!--Inherit pos.config for giving the fields in configuration for custom
receipt design-->
<record id="pos_config_receipt_view" model="ir.ui.view">
<field name="name">pos.config.view</field>
<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="//div[@id='order_reference']" position="after">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="is_custom_receipt"/>
</div>
<div class="o_setting_right_pane">
<label for="receipt_design"/>
<div class="text-muted">
Use Custom Receipt Design
</div>
<div class="content-group mt16">
<field name="receipt_design"
attrs="{'invisible': [('is_custom_receipt', '=', False)]}"/>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

23
custom_receipts_for_pos/views/pos_receipt_views.xml

@ -1,22 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<odoo> <odoo>
<!--Inherit pos.receipt for giving the fields of name and design_receipt--> <!-- Form view for the model `pos.receipt` -->
<record id="pos_receipt_form" model="ir.ui.view"> <record id="pos_receipt_view_form" model="ir.ui.view">
<field name="name">pos.receipt.form</field> <field name="name">pos.receipt.view.form</field>
<field name="model">pos.receipt</field> <field name="model">pos.receipt</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Receipt Designs"> <form string="Receipt Designs">
<sheet> <sheet>
<group> <group>
<field name="name"/> <field name="name"/>
<field name="design_receipt" widget="ace" options="{'mode': 'xml'}" <field name="design_receipt" widget="code" options="{'mode': 'xml'}"/>
/>
</group> </group>
</sheet> </sheet>
</form> </form>
</field> </field>
</record> </record>
<record id="pos_receipt_tree" model="ir.ui.view"> <!-- Tree view for the model `pos.receipt` -->
<record id="pos_receipt_view_tree" model="ir.ui.view">
<field name="name">pos.receipt.view.tree</field>
<field name="model">pos.receipt</field> <field name="model">pos.receipt</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Receipt Designs"> <tree string="Receipt Designs">
@ -24,4 +25,14 @@
</tree> </tree>
</field> </field>
</record> </record>
<!-- Add action window for `pos.receipt` -->
<record id="pos_receipt_action" model="ir.actions.act_window">
<field name="name">Receipt Designs</field>
<field name="res_model">pos.receipt</field>
<field name="view_mode">tree,form</field>
<field name="target">current</field>
</record>
<!-- Add menu for `pos.receipt` -->
<menuitem name="Receipt Designs" id="pos_receipt_menu_action" parent="point_of_sale.menu_point_config_product"
action="pos_receipt_action" sequence="50"/>
</odoo> </odoo>

8
custom_receipts_for_pos/views/res_config_settings_views.xml

@ -3,7 +3,7 @@
<!--Inherit res.config.settings for giving the fields in configuration <!--Inherit res.config.settings for giving the fields in configuration
settings--> settings-->
<record id="res_config_settings_view_form" model="ir.ui.view"> <record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.point_of_sale</field> <field name="name">res.config.settings.view.form.inherit.custom.receipts.for.pos</field>
<field name="model">res.config.settings</field> <field name="model">res.config.settings</field>
<field name="priority" eval="95"/> <field name="priority" eval="95"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/> <field name="inherit_id" ref="base.res_config_settings_view_form"/>
@ -20,12 +20,10 @@
Use Custom Receipt Design Use Custom Receipt Design
</div> </div>
<div class="content-group mt16"> <div class="content-group mt16">
<field name="pos_receipt_design" <field name="pos_receipt_design" invisible="not pos_is_custom_receipt" required="pos_is_custom_receipt"/>
invisible="not pos_is_custom_receipt"/>
</div> </div>
<div class="content-group mt16"> <div class="content-group mt16">
<field name="pos_design_receipt" <field name="pos_design_receipt" invisible="1"/>
invisible="1"/>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save