Browse Source

Aug 30 [UPDT] Updated 'total_quantity_pos'

pull/331/head
AjmalCybro 9 months ago
parent
commit
78f64749b3
  1. 1
      total_quantity_pos/__init__.py
  2. 3
      total_quantity_pos/__manifest__.py
  3. 5
      total_quantity_pos/doc/RELEASE_NOTES.md
  4. 23
      total_quantity_pos/models/__init__.py
  5. 39
      total_quantity_pos/models/pos_config.py
  6. 44
      total_quantity_pos/models/res_config_settings.py
  7. BIN
      total_quantity_pos/static/description/assets/modules/6.gif
  8. BIN
      total_quantity_pos/static/description/assets/screenshots/screenshot_5.png
  9. BIN
      total_quantity_pos/static/description/assets/screenshots/screenshot_6.png
  10. BIN
      total_quantity_pos/static/description/assets/screenshots/screenshot_7.png
  11. BIN
      total_quantity_pos/static/description/assets/screenshots/screenshot_8.png
  12. 18
      total_quantity_pos/static/src/overrides/components/order_receipt.xml
  13. 35
      total_quantity_pos/static/src/overrides/components/order_widget.xml
  14. 32
      total_quantity_pos/static/src/xml/order_receipt.xml
  15. 33
      total_quantity_pos/static/src/xml/product_screen.xml
  16. 43
      total_quantity_pos/views/res_config_settings_views.xml

1
total_quantity_pos/__init__.py

@ -19,3 +19,4 @@
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import models

3
total_quantity_pos/__manifest__.py

@ -21,7 +21,7 @@
###############################################################################
{
'name': 'Total Items and Total Quantity in POS',
'version': '17.0.1.0.0',
'version': '17.0.1.0.1',
'category': 'Point of Sale',
'summary': "To Show the Total Quantity and Total Items Ordered in POS",
'description': "This app will shows the number of "
@ -34,6 +34,7 @@
'website': 'https://www.cybrosys.com',
'depends': ['point_of_sale'],
'data': [
'views/res_config_settings_views.xml',
],
'assets': {
'point_of_sale._assets_pos': [

5
total_quantity_pos/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 17.0.1.0.0
#### ADD
Initial Commit for Total Items and Total Quantity in POS.
#### 28.08.2024
#### Version 17.0.1.0.1
##### UPDT
- Bug Fix-Added the boolean field in the settings.

23
total_quantity_pos/models/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Prathyunnan R (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import pos_config
from . import res_config_settings

39
total_quantity_pos/models/pos_config.py

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Subina (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import fields, models
class PosConfig(models.Model):
""" Class for adding the fields in the pos config"""
_inherit = "pos.config"
pos_total_items = fields.Boolean(string="Total Items",
help="The boolean field"
" in pos.config respective"
" to the total_items field"
" in res.config.settings")
pos_total_quantity = fields.Boolean(string="Total Quantity",
help="The boolean field"
" in pos.config respective"
" to the total_quantity field"
" in res.config.settings")

44
total_quantity_pos/models/res_config_settings.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Subina (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import fields, models
class ConfigSettings(models.TransientModel):
"""Class for adding the fields in res.config.settings"""
_inherit = 'res.config.settings'
total_items = fields.Boolean(string="Enable Total Items",
related="pos_config_id.pos_total_items",
readonly=False, help="Enable this option "
"will show the total"
" number of items and"
" total quantities of"
" product in the "
"PoS screen.")
total_quantity = fields.Boolean(string="Enable Total Quantity",
related="pos_config_id.pos_total_quantity",
readonly=False, help="Enable this option "
"will show the total"
" number of items and"
" total quantities of"
" product in the"
" receipt.")

BIN
total_quantity_pos/static/description/assets/modules/6.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 KiB

BIN
total_quantity_pos/static/description/assets/screenshots/screenshot_5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
total_quantity_pos/static/description/assets/screenshots/screenshot_6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
total_quantity_pos/static/description/assets/screenshots/screenshot_7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

BIN
total_quantity_pos/static/description/assets/screenshots/screenshot_8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

18
total_quantity_pos/static/src/overrides/components/order_receipt.xml

@ -4,14 +4,16 @@
t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension">
<xpath expr="//t[@t-if='props.data.rounding_applied']" position="after">
<!-- Display the total number of items in the order -->
<div class="total_items pos-receipt-amount">Total Items:
<span class="pos-receipt-right-align"><t t-esc="props.data.ItemCount"/></span>
</div>
<!-- Display the total quantities (custom variable) -->
<div class="pos-receipt-amount">
Total Quantity:
<span class="pos-receipt-right-align"><t t-esc="props.data.TotalQuantity"/></span>
</div>
<t t-if="this.env.services.pos.config.pos_total_quantity"/>
<div class="total_items pos-receipt-amount">Total Items:
<span class="pos-receipt-right-align"><t t-esc="props.data.ItemCount"/></span>
</div>
<!-- Display the total quantities (custom variable) -->
<div class="pos-receipt-amount">
Total Quantity:
<span class="pos-receipt-right-align"><t t-esc="props.data.TotalQuantity"/></span>
</div>
<t/>
</xpath>
</t>
</templates>

35
total_quantity_pos/static/src/overrides/components/order_widget.xml

@ -5,25 +5,28 @@
t-inherit="point_of_sale.OrderWidget" t-inherit-mode="extension"
owl="1">
<!-- Insert additional content inside the summary section -->
<xpath expr="//div[hasclass('order-summary')]" position="inside">
<!-- Display the item count -->
<div class="line">
<div class="subentry fs-6 text-muted">
Item Count:
<span class="value">
<!-- Render the calculated item count -->
<t t-esc="ItemCount"/>
</span>
<t t-if="this.env.services.pos.config.pos_total_items">
<div class="line">
<div class="subentry fs-6 text-muted">
Item Count:
<span class="value">
<!-- Render the calculated item count -->
<t t-esc="ItemCount"/>
</span>
</div>
<!-- Display the total quantity -->
<div class="subentry fs-6 text-muted">
Total Quantity:
<span class="value">
<!-- Render the calculated total quantity -->
<t t-esc="TotalQuantity"/>
</span>
</div>
</div>
<!-- Display the total quantity -->
<div class="subentry fs-6 text-muted">
Total Quantity:
<span class="value">
<!-- Render the calculated total quantity -->
<t t-esc="TotalQuantity"/>
</span>
</div>
</div>
</t>
</xpath>
</t>
</templates>

32
total_quantity_pos/static/src/xml/order_receipt.xml

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<!-- Inherit OrderReceipt to Modify it -->
<t t-name="total_quantity_pos.OrderReceipt"
t-inherit="point_of_sale.OrderReceipt"
t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('pos-receipt-amount')]" position="before">
<t t-set="order" t-value="this.env.services.pos.get_order()"/>
<t t-if="this.env.services.pos.config.pos_total_quantity">
<div class="total_qty" style="margin-left:150px">
<div class="values" style="font-weight: bold;">
<span class="badge" style="font-size: 16px;">Total Items:
<t t-esc="order.orderlines.length"/></span>
<br/>
<span class="badge" style="font-size: 16px;">Total Quantity:
<t t-set="total_qty" t-value="0"/>
<t t-foreach="order.orderlines" t-as="line"
t-key="line">
<t t-esc=""/>
<t t-set="total_qty"
t-value="total_qty + line.quantity"/>
</t>
<t t-esc="total_qty"/>
</span>
<br/>
<br/>
</div>
</div>
</t>
</xpath>
</t>
</templates>

33
total_quantity_pos/static/src/xml/product_screen.xml

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<!-- Inherit ProductScreen to Modify it -->
<t t-name="total_quantity_pos.ProductScreen"
t-inherit="point_of_sale.ProductScreen"
t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('control-buttons')]" position="before">
<t t-set="order" t-value="this.env.services.pos.get_order()"/>
<t t-if="this.pos.config.pos_total_items">
<div class="total_qty" style="margin-left:350px">
<div class="values" style="font-weight: bold;">
<span class="badge" style="font-size: 16px;">Total Items:
<t t-esc="order.orderlines.length"/></span>
<br/>
<span class="badge" style="font-size: 16px;">Total Quantity:
<t t-set="total_qty" t-value="0"/>
<t t-foreach="order.orderlines" t-as="line"
t-key="line">
<t t-esc=""/>
<t t-set="total_qty"
t-value="total_qty + line.quantity"/>
</t>
<t t-esc="total_qty"/>
<t t-log="total_qty,'total_qty'"/>
</span>
<br/>
<br/>
</div>
</div>
</t>
</xpath>
</t>
</templates>

43
total_quantity_pos/views/res_config_settings_views.xml

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Views adding in the Configuration view of PoS settings -->
<record id="res_config_settings_inheit_view" model="ir.ui.view">
<field name="name">res.config.settings.inherit.view</field>
<field name="model">res.config.settings</field>
<field name="inherit_id"
ref="point_of_sale.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//block[@id='pos_interface_section']" position="after">
<div class="row mt16 o_settings_container">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="total_items"/>
</div>
<div class="o_setting_right_pane">
<label for="total_items" string="Enable Total Items"/>
<div class="text-muted">
Allow to show the total items and quantities in pos screen.
</div>
</div>
</div>
</div>
</xpath>
<xpath expr="//block[@id='pos_bills_and_receipts_section']" position="inside">
<div class="row mt16 o_settings_container">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="total_quantity"/>
</div>
<div class="o_setting_right_pane">
<label for="total_quantity" string="Enable Total Items"/>
<div class="text-muted">
Allow to add the total items and quantities in the bill.
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save