Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions stock_picking_report_valued/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,18 @@ def _compute_sale_order_line_fields(self):
# Create virtual sale line with stock move line quantity
sol_vals = line.sale_line._convert_to_write(line.sale_line._cache)
sol_vals["product_uom_qty"] = quantity
if not sol_vals.get("product_id", None):
sol_vals.update(
{
"product_id": line.sale_line.product_id.id,
"order_id": line.sale_line.order_id.id,
"discount": line.sale_line.discount,
"price_unit": line.sale_line.price_unit,
}
)
sol_vals.pop("price_subtotal", None)
valued_line = line.sale_line.new(sol_vals)
valued_line._compute_amount()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
valued_line._compute_amount()

Are you sure this is really needed? From the description, the motivation seemed to be about safeguarding. An explicit call to something that should be ORM‑triggered feels a bit forced, and it also doesn't look very performance‑friendly.

line.update(
{
"sale_tax_description": ", ".join(
Expand Down
Loading