Browse Source

May 23 : [UPDT] Bug Fixed 'pos_receipt_extend'

pull/257/head
AjmalCybro 2 years ago
parent
commit
99ff86affc
  1. 0
      pos_receipt_extend/README.rst
  2. 0
      pos_receipt_extend/__init__.py
  3. 5
      pos_receipt_extend/__manifest__.py
  4. 6
      pos_receipt_extend/doc/RELEASE_NOTES.md
  5. 0
      pos_receipt_extend/models/__init__.py
  6. 8
      pos_receipt_extend/models/pos_session.py
  7. 16
      pos_receipt_extend/models/res_config_settings.py
  8. 0
      pos_receipt_extend/static/description/assets/icons/check.png
  9. 0
      pos_receipt_extend/static/description/assets/icons/chevron.png
  10. 0
      pos_receipt_extend/static/description/assets/icons/cogs.png
  11. 0
      pos_receipt_extend/static/description/assets/icons/consultation.png
  12. 0
      pos_receipt_extend/static/description/assets/icons/ecom-black.png
  13. 0
      pos_receipt_extend/static/description/assets/icons/education-black.png
  14. 0
      pos_receipt_extend/static/description/assets/icons/hotel-black.png
  15. 0
      pos_receipt_extend/static/description/assets/icons/license.png
  16. 0
      pos_receipt_extend/static/description/assets/icons/lifebuoy.png
  17. 0
      pos_receipt_extend/static/description/assets/icons/manufacturing-black.png
  18. 0
      pos_receipt_extend/static/description/assets/icons/pos-black.png
  19. 0
      pos_receipt_extend/static/description/assets/icons/puzzle.png
  20. 0
      pos_receipt_extend/static/description/assets/icons/restaurant-black.png
  21. 0
      pos_receipt_extend/static/description/assets/icons/service-black.png
  22. 0
      pos_receipt_extend/static/description/assets/icons/trading-black.png
  23. 0
      pos_receipt_extend/static/description/assets/icons/training.png
  24. 0
      pos_receipt_extend/static/description/assets/icons/update.png
  25. 0
      pos_receipt_extend/static/description/assets/icons/user.png
  26. 0
      pos_receipt_extend/static/description/assets/icons/wrench.png
  27. 0
      pos_receipt_extend/static/description/assets/misc/categories.png
  28. 0
      pos_receipt_extend/static/description/assets/misc/check-box.png
  29. 0
      pos_receipt_extend/static/description/assets/misc/compass.png
  30. 0
      pos_receipt_extend/static/description/assets/misc/corporate.png
  31. 0
      pos_receipt_extend/static/description/assets/misc/customer-support.png
  32. 0
      pos_receipt_extend/static/description/assets/misc/cybrosys-logo.png
  33. 0
      pos_receipt_extend/static/description/assets/misc/features.png
  34. 0
      pos_receipt_extend/static/description/assets/misc/logo.png
  35. 0
      pos_receipt_extend/static/description/assets/misc/pictures.png
  36. 0
      pos_receipt_extend/static/description/assets/misc/pie-chart.png
  37. 0
      pos_receipt_extend/static/description/assets/misc/right-arrow.png
  38. 0
      pos_receipt_extend/static/description/assets/misc/star.png
  39. 0
      pos_receipt_extend/static/description/assets/misc/support.png
  40. 0
      pos_receipt_extend/static/description/assets/misc/whatsapp.png
  41. 0
      pos_receipt_extend/static/description/assets/modules/1.png
  42. 0
      pos_receipt_extend/static/description/assets/modules/2.png
  43. 0
      pos_receipt_extend/static/description/assets/modules/3.png
  44. 0
      pos_receipt_extend/static/description/assets/modules/4.png
  45. 0
      pos_receipt_extend/static/description/assets/modules/5.gif
  46. 0
      pos_receipt_extend/static/description/assets/modules/6.png
  47. BIN
      pos_receipt_extend/static/description/assets/screenshots/hero.gif
  48. BIN
      pos_receipt_extend/static/description/assets/screenshots/herov16.gif
  49. BIN
      pos_receipt_extend/static/description/assets/screenshots/pos_receipt_01.png
  50. BIN
      pos_receipt_extend/static/description/assets/screenshots/pos_receipt_02.png
  51. BIN
      pos_receipt_extend/static/description/assets/screenshots/pos_receipt_03.png
  52. BIN
      pos_receipt_extend/static/description/assets/screenshots/pos_receipt_04.png
  53. BIN
      pos_receipt_extend/static/description/assets/screenshots/pos_receipt_05.png
  54. 0
      pos_receipt_extend/static/description/assets/screenshots/pos_receipt_06.png
  55. 0
      pos_receipt_extend/static/description/assets/screenshots/pos_receipt_07.png
  56. 0
      pos_receipt_extend/static/description/assets/screenshots/pos_receipt_08.png
  57. BIN
      pos_receipt_extend/static/description/assets/screenshots/receipt1.png
  58. BIN
      pos_receipt_extend/static/description/assets/screenshots/receipt2.png
  59. BIN
      pos_receipt_extend/static/description/assets/screenshots/receipt3.png
  60. 0
      pos_receipt_extend/static/description/banner.png
  61. 0
      pos_receipt_extend/static/description/icon.png
  62. 10
      pos_receipt_extend/static/description/index.html
  63. 46
      pos_receipt_extend/static/src/js/payment.js
  64. 2
      pos_receipt_extend/static/src/js/pos_order_receipt.js
  65. 42
      pos_receipt_extend/static/src/xml/OrderReceipt.xml
  66. 0
      pos_receipt_extend/views/pos_receipt_template.xml
  67. 13
      pos_receipt_extend/views/res_config_settings.xml

0
pos_receipt_extend/README.rst

0
pos_receipt_extend/__init__.py

5
pos_receipt_extend/__manifest__.py

@ -19,8 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
{ {
'name': "Advanced POS Receipt", 'name': "Advanced POS Receipt",
"description": """Advanced POS Receipt with Customer Details and Invoice Details""", "description": """Advanced POS Receipt with Customer Details and Invoice Details""",
@ -42,8 +40,7 @@
'pos_receipt_extend/static/src/js/payment.js', 'pos_receipt_extend/static/src/js/payment.js',
] ]
}, },
'images': [ 'images': ['static/description/banner.png', ],
'static/description/banner.png', ],
'license': 'LGPL-3', 'license': 'LGPL-3',
'installable': True, 'installable': True,
'application': False, 'application': False,

6
pos_receipt_extend/doc/RELEASE_NOTES.md

@ -4,3 +4,9 @@
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
#### ADD #### ADD
- Initial commit for pos_receipt_extend - Initial commit for pos_receipt_extend
#### 23.05.2023
#### Version 16.0.2.0.1
##### FIX
-Removed the error of not displaying customer details in pos receipt.
-Changed the index file.

0
pos_receipt_extend/models/__init__.py

8
pos_receipt_extend/models/pos_session.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
import re import re
from odoo import models, fields, api from odoo import models, fields, api
@ -40,10 +39,9 @@ class PosSessionLoadFields(models.Model):
def _loader_params_res_config_settings(self): def _loader_params_res_config_settings(self):
return { return {
'search_params': { 'search_params': {
'fields': ['barcode', 'invoice_number', 'fields': ['qr_code', 'invoice_number', 'customer_name',
'customer_address', 'customer_mobile', 'customer_address', 'customer_mobile',
'customer_phone', 'customer_email', 'customer_vat', 'customer_phone', 'customer_email', 'customer_vat'],
'barcode_type'],
}, },
} }
@ -68,7 +66,7 @@ class PosOrder(models.Model):
'invoice_id': invoice_id.id, 'invoice_id': invoice_id.id,
'invoice_name': invoice_id.name, 'invoice_name': invoice_id.name,
'base_url': base_url, 'base_url': base_url,
'barcode': invoice_id.account_barcode, 'qr_code': invoice_id.account_barcode,
} }

16
pos_receipt_extend/models/res_config_settings.py

@ -26,7 +26,7 @@ from odoo import fields, models, api
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings" _inherit = "res.config.settings"
barcode = fields.Boolean(string='Order Barcode') qr_code = fields.Boolean(string='Order QRCode')
invoice_number = fields.Boolean() invoice_number = fields.Boolean()
customer_details = fields.Boolean() customer_details = fields.Boolean()
customer_name = fields.Boolean() customer_name = fields.Boolean()
@ -35,7 +35,6 @@ class ResConfigSettings(models.TransientModel):
customer_phone = fields.Boolean() customer_phone = fields.Boolean()
customer_email = fields.Boolean() customer_email = fields.Boolean()
customer_vat = fields.Boolean() customer_vat = fields.Boolean()
barcode_type = fields.Selection(selection=[('barcode', 'Barcode'), ('qr_code', 'QRCode')])
def set_values(self): def set_values(self):
super(ResConfigSettings, self).set_values() super(ResConfigSettings, self).set_values()
@ -54,13 +53,10 @@ class ResConfigSettings(models.TransientModel):
int(self.customer_email)) int(self.customer_email))
set_param('res.config.settings.customer_vat', set_param('res.config.settings.customer_vat',
int(self.customer_vat)) int(self.customer_vat))
set_param('res.config.settings.barcode', set_param('res.config.settings.qr_code',
int(self.barcode)) int(self.qr_code))
set_param('res.config.settings.invoice_number', set_param('res.config.settings.invoice_number',
int(self.invoice_number)) int(self.invoice_number))
set_param('res.config.settings.barcode_type',
(self.barcode_type))
@api.model @api.model
def get_values(self): def get_values(self):
res = super(ResConfigSettings, self).get_values() res = super(ResConfigSettings, self).get_values()
@ -79,10 +75,8 @@ class ResConfigSettings(models.TransientModel):
get_param('res.config.settings.customer_email')) get_param('res.config.settings.customer_email'))
res['customer_vat'] = int( res['customer_vat'] = int(
get_param('res.config.settings.customer_vat')) get_param('res.config.settings.customer_vat'))
res['barcode'] = int( res['qr_code'] = int(
get_param('res.config.settings.barcode')) get_param('res.config.settings.qr_code'))
res['invoice_number'] = int( res['invoice_number'] = int(
get_param('res.config.settings.invoice_number')) get_param('res.config.settings.invoice_number'))
res['barcode_type'] = (
get_param('res.config.settings.barcode_type'))
return res return res

0
pos_receipt_extend/static/description/assets/icons/check.png

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

0
pos_receipt_extend/static/description/assets/icons/chevron.png

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 310 B

0
pos_receipt_extend/static/description/assets/icons/cogs.png

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

0
pos_receipt_extend/static/description/assets/icons/consultation.png

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
pos_receipt_extend/static/description/assets/icons/ecom-black.png

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 576 B

0
pos_receipt_extend/static/description/assets/icons/education-black.png

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 733 B

0
pos_receipt_extend/static/description/assets/icons/hotel-black.png

Before

Width:  |  Height:  |  Size: 911 B

After

Width:  |  Height:  |  Size: 911 B

0
pos_receipt_extend/static/description/assets/icons/license.png

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
pos_receipt_extend/static/description/assets/icons/lifebuoy.png

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
pos_receipt_extend/static/description/assets/icons/manufacturing-black.png

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

0
pos_receipt_extend/static/description/assets/icons/pos-black.png

Before

Width:  |  Height:  |  Size: 878 B

After

Width:  |  Height:  |  Size: 878 B

0
pos_receipt_extend/static/description/assets/icons/puzzle.png

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 653 B

0
pos_receipt_extend/static/description/assets/icons/restaurant-black.png

Before

Width:  |  Height:  |  Size: 905 B

After

Width:  |  Height:  |  Size: 905 B

0
pos_receipt_extend/static/description/assets/icons/service-black.png

Before

Width:  |  Height:  |  Size: 839 B

After

Width:  |  Height:  |  Size: 839 B

0
pos_receipt_extend/static/description/assets/icons/trading-black.png

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 427 B

0
pos_receipt_extend/static/description/assets/icons/training.png

Before

Width:  |  Height:  |  Size: 627 B

After

Width:  |  Height:  |  Size: 627 B

0
pos_receipt_extend/static/description/assets/icons/update.png

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
pos_receipt_extend/static/description/assets/icons/user.png

Before

Width:  |  Height:  |  Size: 988 B

After

Width:  |  Height:  |  Size: 988 B

0
pos_receipt_extend/static/description/assets/icons/wrench.png

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
pos_receipt_extend/static/description/assets/misc/categories.png

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
pos_receipt_extend/static/description/assets/misc/check-box.png

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
pos_receipt_extend/static/description/assets/misc/compass.png

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

0
pos_receipt_extend/static/description/assets/misc/corporate.png

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
pos_receipt_extend/static/description/assets/misc/customer-support.png

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
pos_receipt_extend/static/description/assets/misc/cybrosys-logo.png

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

0
pos_receipt_extend/static/description/assets/misc/features.png

Before

Width:  |  Height:  |  Size: 589 B

After

Width:  |  Height:  |  Size: 589 B

0
pos_receipt_extend/static/description/assets/misc/logo.png

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

0
pos_receipt_extend/static/description/assets/misc/pictures.png

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
pos_receipt_extend/static/description/assets/misc/pie-chart.png

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
pos_receipt_extend/static/description/assets/misc/right-arrow.png

Before

Width:  |  Height:  |  Size: 967 B

After

Width:  |  Height:  |  Size: 967 B

0
pos_receipt_extend/static/description/assets/misc/star.png

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
pos_receipt_extend/static/description/assets/misc/support.png

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

0
pos_receipt_extend/static/description/assets/misc/whatsapp.png

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

0
pos_receipt_extend/static/description/assets/modules/1.png

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

0
pos_receipt_extend/static/description/assets/modules/2.png

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

0
pos_receipt_extend/static/description/assets/modules/3.png

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

0
pos_receipt_extend/static/description/assets/modules/4.png

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

0
pos_receipt_extend/static/description/assets/modules/5.gif

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

0
pos_receipt_extend/static/description/assets/modules/6.png

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/herov16.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/pos_receipt_01.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/pos_receipt_02.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/pos_receipt_03.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/pos_receipt_04.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/pos_receipt_05.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

0
pos_receipt_extend/static/description/assets/screenshots/pos_receipt_06.png

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

0
pos_receipt_extend/static/description/assets/screenshots/pos_receipt_07.png

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

0
pos_receipt_extend/static/description/assets/screenshots/pos_receipt_08.png

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/receipt1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/receipt2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
pos_receipt_extend/static/description/assets/screenshots/receipt3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

0
pos_receipt_extend/static/description/banner.png

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
pos_receipt_extend/static/description/icon.png

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

10
pos_receipt_extend/static/description/index.html

@ -18,9 +18,9 @@
<!-- APP HERO --> <!-- APP HERO -->
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;"> ADVANCED POS RECEIPT <h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;"> ADVANCED POS RECEIPT
</h1> </h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">Advanced POS Receipt with Customer Details, Invoice Details and QR/Barcode</p> <p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">Advanced POS Receipt with Customer Details, Invoice Details and QR</p>
<!-- END OF APP HERO --> <!-- END OF APP HERO -->
<img src="assets/screenshots/hero.gif" class="img-responsive" <img src="assets/screenshots/herov16.gif" class="img-responsive"
style="width: 100%; margin-left: auto; margin-right: auto;" /> style="width: 100%; margin-left: auto; margin-right: auto;" />
</div> </div>
</div> </div>
@ -170,7 +170,7 @@
-> ->
We can enable the checkbox for customer details and we can enable the required data to visible in the receipt We can enable the checkbox for customer details and we can enable the required data to visible in the receipt
</p> </p>
<img src="assets/screenshots/pos_receipt_05.png" class="img-thumbnail"> <img src="assets/screenshots/receipt1.png" class="img-thumbnail">
</div> </div>
<div style="display: block; margin: 30px auto;"> <div style="display: block; margin: 30px auto;">
@ -189,7 +189,7 @@
-> ->
We can enable the checkbox for invoice number to view invoice number on the receipt We can enable the checkbox for invoice number to view invoice number on the receipt
</p> </p>
<img src="assets/screenshots/pos_receipt_04.png" class="img-thumbnail"> <img src="assets/screenshots/receipt3.png" class="img-thumbnail">
</div> </div>
<div style="display: block; margin: 30px auto;"> <div style="display: block; margin: 30px auto;">
@ -209,7 +209,7 @@
Go to Point of Sale -> Configuration ->settings Go to Point of Sale -> Configuration ->settings
-> ->
We can enable the checkbox for QR code and select QR code option </p> We can enable the checkbox for QR code and select QR code option </p>
<img src="assets/screenshots/pos_receipt_03.png" class="img-thumbnail"> <img src="assets/screenshots/receipt2.png" class="img-thumbnail">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">QR code in receipt <h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">QR code in receipt
</h3> </h3>

46
pos_receipt_extend/static/src/js/payment.js

@ -8,36 +8,66 @@ odoo.define('pos_receipt_extend.PaymentScreen', function (require) {
const PosPaymentReceiptExtend = PaymentScreen => class extends PaymentScreen { const PosPaymentReceiptExtend = PaymentScreen => class extends PaymentScreen {
setup() { setup() {
super.setup(); super.setup();
} }
async validateOrder(isForceValidate) { async validateOrder(isForceValidate) {
var receipt_number = this.env.pos.selectedOrder.name var receipt_number = this.env.pos.selectedOrder.name
var orders = this.env.pos.selectedOrder var orders = this.env.pos.selectedOrder
var datas = this.env.pos.session_orders
const receipt_order = await super.validateOrder(...arguments); const receipt_order = await super.validateOrder(...arguments);
const codeWriter = new window.ZXing.BrowserQRCodeSvgWriter(); const codeWriter = new window.ZXing.BrowserQRCodeSvgWriter();
const data = this.env.pos.session_orders;
var length = data.length-1
var order = data[length]
var mobile = order.customer_mobile;
var phone = order.customer_phone;
var email = order.customer_email;
var vat = order.customer_vat;
var address = order.customer_address;
var name = order.customer_name;
var number = order.invoice_number;
var qr_code = order.qr_code;
if (!address) {
this.env.pos.selectedOrder.partner.street = null;
}
if (!name) {
this.env.pos.selectedOrder.partner.name = null;
}
if (!mobile) {
this.env.pos.selectedOrder.partner.mobile = null;
}
if (!phone) {
this.env.pos.selectedOrder.partner.phone = null;
}
if (!email) {
this.env.pos.selectedOrder.partner.email = null;
}
if (!vat) {
this.env.pos.selectedOrder.partner.vat = null;
}
if (!number) {
this.env.pos.selectedOrder.name = null;
}
var self= this; var self= this;
rpc.query({ rpc.query({
model: 'pos.order', model: 'pos.order',
method: 'get_invoice', method: 'get_invoice',
args: [receipt_number] args: [receipt_number]
}).then(function(result){ }).then(function(result){
const address = `${result.base_url}/my/invoices/${result.invoice_id}?` const address = `${result.base_url}/my/invoices/${result.invoice_id}?`
const barcode = result.barcode
let qr_code_svg = new XMLSerializer().serializeToString(codeWriter.write(address, 150, 150)); let qr_code_svg = new XMLSerializer().serializeToString(codeWriter.write(address, 150, 150));
if (qr_code) {
self.env.pos.qr_image = "data:image/svg+xml;base64,"+ window.btoa(qr_code_svg); self.env.pos.qr_image = "data:image/svg+xml;base64,"+ window.btoa(qr_code_svg);
let barcode_svg = new XMLSerializer().serializeToString(codeWriter.write(barcode, 150, 150)); }
self.env.pos.barcode_image = "data:image/svg+xml;base64,"+ window.btoa(barcode_svg); if (number) {
self.env.pos.barcode = barcode
self.env.pos.invoice = result.invoice_name self.env.pos.invoice = result.invoice_name
}
}); });
return receipt_order return receipt_order
} }
} }
Registries.Component.extend(PaymentScreen, PosPaymentReceiptExtend); Registries.Component.extend(PaymentScreen, PosPaymentReceiptExtend);
return PaymentScreen; return PaymentScreen;

2
pos_receipt_extend/static/src/js/pos_order_receipt.js

@ -18,8 +18,6 @@ const { batched, uuidv4 } = require("point_of_sale.utils");
this.access_token = uuidv4(); this.access_token = uuidv4();
const address = `${this.pos.base_url}/pos/ticket/validate?access_token=${this.access_token}` const address = `${this.pos.base_url}/pos/ticket/validate?access_token=${this.access_token}`
var receipt_number = this.env.pos.selectedOrder var receipt_number = this.env.pos.selectedOrder
$(".orderlines").change(function (){ $(".orderlines").change(function (){
const address = `${this.base_url}/pos/ticket/validate?access_token=${this.access_token}` const address = `${this.base_url}/pos/ticket/validate?access_token=${this.access_token}`
}); });

42
pos_receipt_extend/static/src/xml/OrderReceipt.xml

@ -3,66 +3,44 @@
<t t-name="OrderReceipt" t-inherit="point_of_sale.OrderReceipt" <t t-name="OrderReceipt" t-inherit="point_of_sale.OrderReceipt"
t-inherit-mode="extension" owl="1"> t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('pos-receipt-contact')]" position="inside"> <xpath expr="//div[hasclass('pos-receipt-contact')]" position="inside">
<t t-if="this.env.pos.selectedOrder.partner.name">
<div style="font-weight:bold;">Customer Name: <div style="font-weight:bold;">Customer Name:
<!-- <t t-if="this.env.pos.session_orders[0].customer_name">-->
<t t-esc="this.env.pos.selectedOrder.partner.name"/> <t t-esc="this.env.pos.selectedOrder.partner.name"/>
<!-- </t>-->
</div> </div>
</t>
<t t-if="this.env.pos.selectedOrder.partner.street">
<t t-if="this.env.pos.session_orders[0].customer_name">
<div style="font-weight:bold;">Customer Address: <div style="font-weight:bold;">Customer Address:
<t t-esc="this.env.pos.selectedOrder.partner.name"/> <t t-esc="this.env.pos.selectedOrder.partner.street"/>
</div> </div>
</t> </t>
<t t-if="this.env.pos.selectedOrder.partner.mobile">
<t t-if="this.env.pos.session_orders[0].customer_mobile">
<div style="font-weight:bold;">Customer Mobile: <div style="font-weight:bold;">Customer Mobile:
<t t-esc="this.env.pos.selectedOrder.partner.mobile"/> <t t-esc="this.env.pos.selectedOrder.partner.mobile"/>
</div> </div>
</t> </t>
<t t-if="this.env.pos.selectedOrder.partner.phone">
<t t-if="this.env.pos.session_orders[0].customer_phone">
<div style="font-weight:bold;">Customer Phone: <div style="font-weight:bold;">Customer Phone:
<t t-esc="this.env.pos.selectedOrder.partner.phone"/> <t t-esc="this.env.pos.selectedOrder.partner.phone"/>
</div> </div>
</t> </t>
<t t-if="this.env.pos.selectedOrder.partner.email">
<t t-if="this.env.pos.session_orders[0].customer_email">
<div style="font-weight:bold;">Customer Email: <div style="font-weight:bold;">Customer Email:
<t t-esc="this.env.pos.selectedOrder.partner.email"/> <t t-esc="this.env.pos.selectedOrder.partner.email"/>
</div> </div>
</t> </t>
<t t-if="this.env.pos.selectedOrder.partner.vat">
<t t-if="this.env.pos.session_orders[0].customer_vat">
<div style="font-weight:bold;">Customer Vat: <div style="font-weight:bold;">Customer Vat:
<t t-esc="this.env.pos.selectedOrder.partner.vat"/> <t t-esc="this.env.pos.selectedOrder.partner.vat"/>
</div> </div>
</t> </t>
<t t-if="this.env.pos.invoice">
<t t-if="this.env.pos.session_orders[0].invoice_number">
<div style="font-weight:bold;">Invoice Number: <div style="font-weight:bold;">Invoice Number:
<t t-esc="this.env.pos.invoice"/> <t t-esc="this.env.pos.invoice"/>
</div> </div>
</t> </t>
<t t-if="this.env.pos.session_orders[0].barcode_type === 'qr_code' ">
<div style="font-weight:bold;"> <div style="font-weight:bold;">
<img t-attf-src="{{this.env.pos.qr_image}}" <img t-attf-src="{{this.env.pos.qr_image}}" style="width:50%;"/>
style="width:50%;"/>
</div> </div>
</t>
</xpath> </xpath>
</t> </t>
</templates> </templates>

0
pos_receipt_extend/views/pos_receipt_template.xml

13
pos_receipt_extend/views/res_config_settings.xml

@ -10,20 +10,13 @@
position="inside"> position="inside">
<div class="col-12 col-lg-6 o_setting_box"> <div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane"> <div class="o_setting_left_pane">
<field name="barcode"/> <field name="qr_code"/>
</div> </div>
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<label for="barcode"/> <label for="qr_code"/>
<div class="content-group" <div class="content-group"
id="warning_text_pos_restaurant"> id="warning_text_pos_restaurant">
Enable to show barcode on receipt Enable to show QRCode on receipt
</div>
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane"
attrs="{'invisible': [('barcode','=',False)]}">
<field name="barcode_type" widget="radio"/>
</div>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save