AH-Yussef 0eeee0cd53 [FIX] sale_management: maintain template lines order on Confirm
Steps to reproduce:
- Install Sales app
- Open Sales app, Go to Configuration > Quotation Templates
- Open a template, or create an new one
- Add sections with product(s) under each, so we have a structure like:
        - Section 1
        - Product 1
        - Section 2
        - Product 2
- Go to Orders > Quotations
- Create a New Quotation
- Select the recently created/updated template in the Quotation Template field
- Click on Confirm
- U can notice how the sections are moved to the top, missing up the structure

Investigation:
- Each sale order order_line has a sequence property associated to it which defaults to 10 if not explicitly specified https://github.com/odoo/odoo/blob/55b452ac0056c7075097fa1324ef53fc5090fb7a/addons/sale/models/sale_order_line.py#L41
- On Choosing a template, the _prepare_order_line_values() method returns the needed properties for each template line https://github.com/odoo/odoo/blob/55b452ac0056c7075097fa1324ef53fc5090fb7a/addons/sale_management/models/sale_order.py#L108
- The returned object for each template is missing the sequence property, resulting in it falling back to 10 when assigning it to the sale order order_line https://github.com/odoo/odoo/blob/55b452ac0056c7075097fa1324ef53fc5090fb7a/addons/sale_management/models/sale_order.py#L117
- Now all order_line(s) has the same sequence -except for the first one which has a sequence value of -99- https://github.com/odoo/odoo/blob/55b452ac0056c7075097fa1324ef53fc5090fb7a/addons/sale_management/models/sale_order.py#L114-L115

opw-3602781

closes odoo/odoo#144700

Signed-off-by: Ali Hassan Youssef (alhy) <alhy@odoo.com>
2023-12-11 08:29:17 +00:00
2023-11-02 21:02:44 +00:00
2023-12-11 05:29:19 +00:00
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%