[FIX] point_of_sale,pos_sale: take all customer note into account
Current behavior: When you add multiple note in a sale order, only the last one was taken into account in the POS. Now we show all notes on the ProductScreen and on the ReceiptScreen. Steps to reproduce: - Install pos_sale - Create a sale order with a product and 2 notes - Open the POS and load the sale order - Only one note appears under the product - Validate the order - Only one note appears on the receipt under the product opw-3551331 closes odoo/odoo#146891 X-original-commit: f7c5e7fd772d9700fe16589eea0ad51dda873c5f Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -76,7 +76,11 @@ class SaleOrderLine(models.Model):
|
||||
|
||||
elif sale_line.display_type == 'line_note':
|
||||
if results:
|
||||
results[-1]['customer_note'] = sale_line.name
|
||||
if results[-1].get('customer_note'):
|
||||
results[-1]['customer_note'] += "--" + sale_line.name
|
||||
else:
|
||||
results[-1]['customer_note'] = sale_line.name
|
||||
|
||||
|
||||
return results
|
||||
|
||||
|
||||
@@ -52,3 +52,12 @@ export function downPaymentFirstOrder() {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function checkCustomerNotes(note) {
|
||||
return [
|
||||
{
|
||||
content: `check customer notes`,
|
||||
trigger: `.customer-note:contains(${note})`,
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//** @odoo-module */
|
||||
|
||||
export function checkCustomerNotes(note) {
|
||||
return [
|
||||
{
|
||||
content: `check customer notes`,
|
||||
trigger: `.customer-note:contains(${note})`,
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
import * as Chrome from "@point_of_sale/../tests/tours/helpers/ChromeTourMethods";
|
||||
import * as PaymentScreen from "@point_of_sale/../tests/tours/helpers/PaymentScreenTourMethods";
|
||||
import * as ReceiptScreen from "@point_of_sale/../tests/tours/helpers/ReceiptScreenTourMethods";
|
||||
import * as ReceiptScreenPos from "@point_of_sale/../tests/tours/helpers/ReceiptScreenTourMethods";
|
||||
import * as ReceiptScreenSale from "@pos_sale/../tests/helpers/ReceiptScreenTourMethods";
|
||||
import * as ProductScreenPos from "@point_of_sale/../tests/tours/helpers/ProductScreenTourMethods";
|
||||
import * as ProductScreenSale from "@pos_sale/../tests/helpers/ProductScreenTourMethods";
|
||||
const ProductScreen = { ...ProductScreenPos, ...ProductScreenSale };
|
||||
const ReceiptScreen = { ...ReceiptScreenPos, ...ReceiptScreenSale };
|
||||
import * as TicketScreen from "@point_of_sale/../tests/tours/helpers/TicketScreenTourMethods";
|
||||
import * as Order from "@point_of_sale/../tests/tours/helpers/generic_components/OrderWidgetMethods";
|
||||
import { registry } from "@web/core/registry";
|
||||
@@ -149,3 +151,22 @@ registry
|
||||
ProductScreen.checkOrderlinesNumber(4),
|
||||
].flat(),
|
||||
});
|
||||
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add('PosSettleOrderWithNote', {
|
||||
test: true,
|
||||
url: '/pos/ui',
|
||||
steps: () => [
|
||||
ProductScreen.confirmOpeningPopup(),
|
||||
ProductScreen.clickQuotationButton(),
|
||||
ProductScreen.selectFirstOrder(),
|
||||
ProductScreen.checkCustomerNotes("Customer note 2--Customer note 3"),
|
||||
ProductScreen.clickPayButton(),
|
||||
PaymentScreen.clickPaymentMethod('Bank'),
|
||||
PaymentScreen.clickValidate(),
|
||||
ReceiptScreen.checkCustomerNotes("Customer note 2--Customer note 3"),
|
||||
ReceiptScreen.clickNextOrder(),
|
||||
|
||||
].flat(),
|
||||
});
|
||||
|
||||
@@ -331,3 +331,32 @@ class TestPoSSale(TestPointOfSaleHttpCommon):
|
||||
})
|
||||
self.main_pos_config.open_ui()
|
||||
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PosSettleOrderNotGroupable', login="accountman")
|
||||
|
||||
def test_customer_notes(self):
|
||||
"""This test create an order and settle it in the PoS. It also uses multistep delivery
|
||||
and we need to make sure that all the picking are cancelled if the order is fully delivered.
|
||||
"""
|
||||
|
||||
#create a sale order with 2 customer notes
|
||||
sale_order = self.env['sale.order'].create({
|
||||
'partner_id': self.env.ref('base.res_partner_2').id,
|
||||
'note': 'Customer note 1',
|
||||
'order_line': [(0, 0, {
|
||||
'product_id': self.whiteboard_pen.id,
|
||||
'name': self.whiteboard_pen.name,
|
||||
'product_uom_qty': 1,
|
||||
'product_uom': self.whiteboard_pen.uom_id.id,
|
||||
'price_unit': self.whiteboard_pen.lst_price,
|
||||
}), (0, 0, {
|
||||
'name': 'Customer note 2',
|
||||
'display_type': 'line_note',
|
||||
}), (0, 0, {
|
||||
'name': 'Customer note 3',
|
||||
'display_type': 'line_note',
|
||||
})],
|
||||
})
|
||||
|
||||
sale_order.action_confirm()
|
||||
|
||||
self.main_pos_config.open_ui()
|
||||
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PosSettleOrderWithNote', login="accountman")
|
||||
|
||||
Reference in New Issue
Block a user