[FIX] pos_self_order: compute price product variants in self order
Issue: ====== When choosing product with attributes that have attributes which have variant creation mode never it will not take into account the extra price. Steps to reproduce the issue: ============================= - Install pos , restaurant - Create a product which have `Size` attribute and add some values in it, 'S' and 'M' for example , then add extra prices in each one of them. Enable available in POS setting in Sales page of the product. - Got to point of sala , click on 3 dots in restaurant and open mobile menu. - Added the created product to cart and click review. - The price shown is the original price of the product and not taking into account the extra price of the attribute. Origin of the issue: ==================== This was not supported before Solution: ========= Using the attribute_value_ids value in the line we can calculate the extra_price of those attributes and add it to the price_unit so we can get taxed_amount and untaxed_amount correctly. opw-3511374 closes odoo/odoo#142485 X-original-commit: a54fddd9270b3431a8cde0a6bf30349c5671b0ac Signed-off-by: David Monnom (moda) <moda@odoo.com> Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
This commit is contained in:
@@ -223,6 +223,8 @@ class PosSelfOrderController(http.Controller):
|
||||
line_qty = line.get('qty')
|
||||
product = pos_config.env['product.product'].browse(int(line.get('product_id')))
|
||||
lst_price = pricelist._get_product_price(product, quantity=line_qty) if pricelist else product.lst_price
|
||||
selected_attributes = fetched_attributes.browse(line.get('attribute_value_ids', []))
|
||||
lst_price += sum([attr.price_extra for attr in selected_attributes])
|
||||
|
||||
children = [l for l in lines if l.get('combo_parent_uuid') == line.get('uuid')]
|
||||
pos_combo_lines = combo_lines.browse([child.get('combo_line_id') for child in children])
|
||||
|
||||
@@ -19,6 +19,7 @@ registry.category("web_tour.tours").add("self_attribute_selector", {
|
||||
{ name: "Size", value: "M" },
|
||||
{ name: "Fabric", value: "Leather" },
|
||||
]),
|
||||
CartPage.checkProduct("Desk Organizer", "7.02", "1"),
|
||||
CartPage.clickBack(),
|
||||
ProductPage.clickProduct("Desk Organizer"),
|
||||
...ProductPage.setupAttribute([
|
||||
@@ -30,6 +31,7 @@ registry.category("web_tour.tours").add("self_attribute_selector", {
|
||||
{ name: "Size", value: "L" },
|
||||
{ name: "Fabric", value: "Leather" },
|
||||
]),
|
||||
CartPage.checkProduct("Desk Organizer", "8.17", "1"),
|
||||
Utils.clickBtn("Pay"),
|
||||
Utils.clickBtn("Ok"),
|
||||
Utils.clickBtn("My Order"),
|
||||
|
||||
@@ -16,6 +16,11 @@ class TestSelfOrderAttribute(SelfOrderCommonTest):
|
||||
'self_ordering_service_mode': 'counter',
|
||||
})
|
||||
|
||||
product = self.env['product.product'].search([('name', '=', 'Desk Organizer')])[0]
|
||||
product.attribute_line_ids[0].product_template_value_ids[0].price_extra = 0.0
|
||||
product.attribute_line_ids[0].product_template_value_ids[1].price_extra = 1.0
|
||||
product.attribute_line_ids[0].product_template_value_ids[2].price_extra = 2.0
|
||||
|
||||
self.pos_config.with_user(self.pos_user).open_ui()
|
||||
self_route = self.pos_config._get_self_order_route()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user