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

[16] purchase_order_uninvoiced_amount - Calculation error if control policy is changed #2040

Open
Gelojr opened this issue Oct 18, 2023 · 3 comments
Labels
Milestone

Comments

@Gelojr
Copy link

Gelojr commented Oct 18, 2023

Module

purchase_order_uninvoiced_amount

Describe the bug

Let's take a product with a control policy based on received quantities. When a purchase order is placed, the uninvoiced amount is calculated based on this control policy.
If the control policy of the product is changed to On Ordered Quantities and, for example, the product line description in the purchase order is changed, the uninvoiced amount will be recalculated according to the new control policy of the product based On Ordered Quantities.

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Set a (storable or cosumable) product with control policy based On Received Quantities.
  2. Place an order for 10 units of this product at $10 per unit.
  3. Make a reception of 4 units.
  4. The uninvoiced amount will be 40$.
  5. Change product policy control to On Ordered Quantities
  6. Go to the created purchase order and change the product description and save.
  7. The uninvoiced amount has been recalculated to 100$.

https://www.loom.com/share/4cd899b1380c4d4b9f0a1062dc3395a4?sid=b33a0c06-9fed-4722-b395-862648cb99f7

Expected behavior
Even if the product policy control is changed the uninvoiced amount of the order should not be recalculated with the new product policy control but with the policy control that the product had when the order was validated.

@moduon MT-3976

@Gelojr Gelojr added the bug label Oct 18, 2023
@rafaelbn
Copy link
Member

Hello @pedrobaeza @victoralmau , in the case of a FIX, how would be your approach in order to agree it? Thank you! 🙂

@pedrobaeza
Copy link
Member

Is there any qty_to_invoice field in purchase? If so, you should hook to it. If not, please see how Odoo evaluate this thing.

@rafaelbn rafaelbn added this to the 16.0 milestone Oct 18, 2023
@rafaelbn
Copy link
Member

Is there any qty_to_invoice field in purchase? If so, you should hook to it. If not, please see how Odoo evaluate this thing.

  • No, there isn't.
  • The OCA module purchase_open_qty add it but it's not core one.

In my opinion the best way, is to create a new module purchase_order_control_policy_method (incompatibly with purchase_open_qty (OCA) which add qty_to_invoice in purchase_order and you could, from purchase order (in other information tab), set de Control Policy (purchase_method) and overwrite the same field in purchase_order_lines

If not, please see how Odoo evaluate this thing.

Then the BUG is in core in any case.

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