[IMP] pos_self_order, *: receipt tracking number

*: point_of_sale

- Makes the tracking number displayed on frontend receipt (in small `Order: <tracking number>`, preserving the big `<tracking number>` title for kiosk self-order receipt).
- Fixes printing of kiosk self-order receipt after a successful Adyen payment.

closes odoo/odoo#139694

closes odoo/odoo#140044

Task-id: 3570253
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Theo VINCENT (thvi)
2023-10-27 14:22:10 +00:00
parent e9ce5608dd
commit 455c3f8d5b
5 changed files with 15 additions and 8 deletions
@@ -3,7 +3,7 @@
<t t-name="point_of_sale.ReceiptHeader">
<img t-attf-src="/web/image?model=res.company&amp;id={{props.data.company.id}}&amp;field=logo" alt="Logo" class="pos-receipt-logo"/>
<br/>
<h1 class="text-center" style="font-size: 100px" t-if="props.data.trackingNumber" t-esc="props.data.trackingNumber" />
<h1 class="text-center" style="font-size: 100px" t-if="props.data.trackingNumber and props.data.bigTrackingNumber" t-esc="props.data.trackingNumber" />
<div class="pos-receipt-contact">
<!-- contact address -->
<div t-if="props.data.company.partner_id?.[1]" t-esc="props.data.company.partner_id[1]" />
@@ -17,8 +17,11 @@
<div t-if="props.data.company.website" t-esc="props.data.company.website" />
<div t-if="props.data.header" style="white-space:pre-line" t-esc="props.data.header" />
<div t-if="props.data.cashier" class="cashier">
<div>--------------------------------</div>
<div>Served by <t t-esc="props.data.cashier" /></div>
<div>--------------------------------</div>
<div>Served by <t t-esc="props.data.cashier" /></div>
</div>
<div t-if="props.data.trackingNumber and !props.data.bigTrackingNumber">
Order: <t t-esc="props.data.trackingNumber" />
</div>
</div>
<br /><br />
@@ -1530,7 +1530,10 @@ export class Order extends PosModel {
// FIXME: isn't there a better way to handle this date?
shippingDate:
this.shippingDate && formatDate(DateTime.fromJSDate(new Date(this.shippingDate))),
headerData: this.pos.getReceiptHeaderData(),
headerData: {
...this.pos.getReceiptHeaderData(),
trackingNumber: this.trackingNumber,
},
};
}
// This function send order change to printer
@@ -579,7 +579,7 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon):
'price_subtotal': 0.9,
'price_subtotal_incl': 1.04,
'qty': 1,
'tax_ids': [(6, 0, self.led_lamp.taxes_id.ids)]}]],
'tax_ids': [(6, 0, self.led_lamp.taxes_id.filtered(lambda t: t.company_id.id == self.env.company.id).ids)]}]],
'name': 'Order 00042-003-0014',
'partner_id': False,
'pos_session_id': current_session.id,
@@ -610,7 +610,7 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon):
'price_subtotal': 1.2,
'price_subtotal_incl': 1.38,
'qty': 1,
'tax_ids': [(6, 0, self.whiteboard_pen.taxes_id.ids)]}]],
'tax_ids': [(6, 0, self.whiteboard_pen.taxes_id.filtered(lambda t: t.company_id.id == self.env.company.id).ids)]}]],
'name': 'Order 00043-003-0014',
'partner_id': self.partner1.id,
'pos_session_id': current_session.id,
@@ -641,7 +641,7 @@ class TestPointOfSaleFlow(TestPointOfSaleCommon):
'price_subtotal': 1.28,
'price_subtotal_incl': 1.47,
'qty': 1,
'tax_ids': [[6, False, self.newspaper_rack.taxes_id.ids]]}]],
'tax_ids': [[6, False, self.newspaper_rack.taxes_id.filtered(lambda t: t.company_id.id == self.env.company.id).ids]]}]],
'name': 'Order 00044-003-0014',
'partner_id': False,
'pos_session_id': current_session.id,
+1 -1
View File
@@ -47,7 +47,7 @@ class PosOrder(models.Model):
def _compute_tax_details(self):
self.ensure_one()
taxes = sum([line.tax_ids.compute_all(line.price_unit, quantity=line.qty, product=line.product_id)['taxes']
taxes = sum([line.tax_ids.with_company(self.company_id).compute_all(line.price_unit, quantity=line.qty, product=line.product_id)['taxes']
for line in self.lines], [])
tax_percetanges = {tax['id']: tax['amount'] for tax in self.env['account.tax'].search([]).read(['amount'])}
merged_tax_details = {}
@@ -563,6 +563,7 @@ export class SelfOrder extends Reactive {
header: this.config.receipt_header,
company: this.company,
trackingNumber: order.trackingNumber,
bigTrackingNumber: true,
},
pos_qr_code:
this.company.point_of_sale_use_ticket_qr_code &&