Skip to content
Snippets Groups Projects
Commit 365dc62c authored by Anh Thao Pham (pta)'s avatar Anh Thao Pham (pta)
Browse files

[FIX] purchase/sale_product_matrix: fix sequence of order lines


- Install Sales and Sale Matrix
- Go to Sales > Configuration > Settings and activate "Variant Grid Entry"
- Go to Products and edit a product with variants (lets call it "Product A"):
  * For "Sales Variant Selection" in "Variants tab", choose "Order Grid Entry"
- Go to Sales > Orders > Quotations and create a quotation
  * Add any product without Variant Selection set to "Order Grid Entry"
  * Add "Product A" with 1 attribute
  * Add any product without Variant Selection set to "Order Grid Entry"
- Here there are 3 products in the quotation with "Product A" at the second position
- Save the quotation
After the save the position of "Product A" is moved to the last position.

In a new quotation, every new order line has a sequence set to 10, except for products
with Variant Selection set to "Order Grid Entry" that set the sequence to the previous one +1,
which will put it in the last position even if another product is added after it.

[All of the above steps and explanations can also be applied to Purchase]

opw-2303096

closes odoo/odoo#55342

X-original-commit: 17c1caec
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent e106c6af
Branches
Tags
No related merge requests found
......@@ -90,7 +90,7 @@ class PurchaseOrder(models.Model):
default_po_line_vals = OrderLine.default_get(OrderLine._fields.keys())
last_sequence = self.order_line[-1:].sequence
if last_sequence:
default_po_line_vals['sequence'] = last_sequence + 1
default_po_line_vals['sequence'] = last_sequence
new_lines.append((0, 0, dict(
default_po_line_vals,
product_id=product.id,
......
......@@ -101,7 +101,7 @@ class SaleOrder(models.Model):
default_so_line_vals = OrderLine.default_get(OrderLine._fields.keys())
last_sequence = self.order_line[-1:].sequence
if last_sequence:
default_so_line_vals['sequence'] = last_sequence + 1
default_so_line_vals['sequence'] = last_sequence
new_lines.append((0, 0, dict(
default_so_line_vals,
product_id=product.id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment