Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purchase_stock_price_unit_sync: Stock Valuation Layer unit_cost and total_value not sync #2535

Open
Jaimermaccione opened this issue Jan 29, 2025 · 2 comments
Labels

Comments

@Jaimermaccione
Copy link

Stock Valuation Layer unit_cost and total_value desynchronization

Module

purchase_stock_price_unit_sync

Describe the bug

When updating the unit price or discount in a confirmed purchase order (purchase.order.line) after a receipt has been completed, the corresponding unit cost (unit_cost) in the stock valuation layer (stock.valuation.layer) is updated correctly, but the total value (total_value) is not recalculated. This leads to an inconsistent stock valuation, where the total inventory value does not match the expected computation:

The stock valuation should remain consistent when price updates affect received inventory.

To Reproduce

Affected versions

  • Odoo 14.0, 15.0, 16.0 (potentially others)

Steps to reproduce the behavior

  1. Create a purchase order with a product that uses one of the following cost methods:
    • Standard (standard)
    • FIFO (fifo)
    • Average Cost (avco)
  2. Confirm the purchase order and receive the product.
  3. Check the created stock valuation layer (stock.valuation.layer) entry.
  4. Go back to the purchase order line and update the price unit or discount.
  5. Observe that:
    • unit_cost in the stock valuation layer updates correctly.
    • value (total_value) remains unchanged, causing an inconsistency.

Image

Image

Expected behavior

When the unit cost (unit_cost) is updated, the corresponding total value should also be recalculated to maintain consistency in stock valuation.

The expected behavior is:

If unit_cost changes due to a price update in a confirmed purchase order, total_value should reflect this new cost.

Additional context

  • Odoo 14.0, 15.0, 16.0
  • Standard Odoo modules without modifications.
  • The issue has been tested with products using Standard, FIFO, and AVCO cost methods, and the behavior remains the same across all methodologies.

Impact

This issue affects accounting accuracy for companies relying on real-time inventory valuation methods (FIFO/AVCO). It may also impact cost-based margin calculations.

Please review and confirm if this is the intended behavior or if it should be adjusted to maintain valuation consistency. Thank you!

@Jaimermaccione Jaimermaccione changed the title Stock Valuation Layer unit_cost and total_value not sync Purchase_stock_price_unit_sync: Stock Valuation Layer unit_cost and total_value not sync Jan 29, 2025
@HaraldPanten
Copy link
Contributor

@pedrobaeza Could you confirm that this is a bug? We'll make a FIX, after confirmation.

THX!

@pedrobaeza
Copy link
Member

I don't think this is related to purchase_stock_price_unit_sync. In fact, that module has nothing to do with the totalized values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants