[FIX] point_of_sale: Show correct tracking method on receipt

Current behavior:
The PoS receipt was always showing SN on receipt even when the tracking
method was set to Lot.

Steps to reproduce:
- Create a product with tracking method set to Lot
- Create a PoS order with that product
- Validate the order
- The receipt is going to show SN XXXX instead of Lot Number XXXXX

opw-3517788

closes odoo/odoo#141007

X-original-commit: fde614b80c90ce62598b6ddd3ddac4d3c6bb4dc7
Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
roen-odoo
2023-11-06 16:55:39 +00:00
parent f4e9dd9ec3
commit d66dcf820d
5 changed files with 45 additions and 2 deletions
@@ -11,8 +11,13 @@
<t t-esc="line.customerNote" />
</li>
<ul t-if="line.pack_lot_lines">
<li t-foreach="line.get_lot_lines()" t-as="lot" t-key="lot.cid">
SN <t t-esc="lot.lot_name"/>
<li t-foreach="line.pack_lot_lines" t-as="lot" t-key="lot.cid">
<t t-if="lot.order_line.product.tracking == 'lot'">
Lot Number <t t-esc="lot.lot_name"/>
</t>
<t t-else="">
SN <t t-esc="lot.lot_name"/>
</t>
</li>
</ul>
</Orderline>
@@ -1081,6 +1081,7 @@ export class Orderline extends PosModel {
customerNote: this.get_customer_note(),
internalNote: this.getNote(),
comboParent: this.comboParent?.get_full_product_name(),
pack_lot_lines: this.get_lot_lines(),
};
}
}
@@ -114,3 +114,19 @@ registry.category("web_tour.tours").add("OrderPaidInCash", {
ProductScreen.lastClosingCashIs("25.00"),
].flat(),
});
registry
.category("web_tour.tours")
.add("ReceiptTrackingMethodTour", {
test: true,
url: "/pos/ui",
steps: () => [
ProductScreen.clickHomeCategory(),
ProductScreen.clickDisplayedProduct('Product A'),
ProductScreen.enterLotNumber('123456789'),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod('Cash'),
PaymentScreen.clickValidate(),
ReceiptScreen.trackingMethodIsLot(),
].flat(),
});
@@ -89,3 +89,13 @@ export function emailIsSuccessful() {
export function nextOrder() {
return [...isShown(), ...clickNextOrder()];
}
export function trackingMethodIsLot() {
return [
{
content: `tracking method is Lot`,
trigger: `li:contains("Lot Number")`,
run: () => {},
},
];
}
@@ -1036,6 +1036,17 @@ class TestUi(TestPointOfSaleHttpCommon):
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'LotRefundTour', login="accountman")
def test_receipt_tracking_method(self):
self.product_a = self.env['product.product'].create({
'name': 'Product A',
'type': 'product',
'tracking': 'lot',
'categ_id': self.env.ref('product.product_category_all').id,
'available_in_pos': True,
})
self.main_pos_config.open_ui()
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ReceiptTrackingMethodTour', login="accountman")
# This class just runs the same tests as above but with mobile emulation
class MobileTestUi(TestUi):
browser_size = '375x667'