-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
[FIX] account_invoice_margin: avoid traceback in invoice #221
Conversation
When creating an invoice, associating a product (the uom is associated), deleting the product from the line and saving, an error is obtained: File "/home/odoo/src/user/margin-analysis/account_invoice_margin/models/account_invoice.py", line 108, in _compute_purchase_price purchase_price = line.product_id.uom_id._compute_price( File "/home/odoo/src/odoo/addons/uom/models/uom_uom.py", line 247, in _compute_price self.ensure_one() File "/home/odoo/src/odoo/odoo/models.py", line 5243, in ensure_one raise ValueError("Expected singleton: %s" % self) This is because it attempts to take the uom of the product to calculate the purchase price and the product is empty. The product is validated before performing the calculation, to avoid the error.
Hi @sergio-teruel, |
Hi @moylop260 could you check this, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ocabot merge patch
On my way to merge this fine PR! |
Congratulations, your PR was merged at 76042f8. Thanks a lot for contributing to OCA. ❤️ |
When creating an invoice, associating a product (the uom is associated), deleting the product from the line and saving, an error is obtained:
This is because it attempts to use the product's uom to calculate the purchase price, and the product is empty.
The product is validated before performing the calculation, to avoid the error.
Functional test before the fix
https://youtu.be/ZbEGpCJR-xI
Functional test after the fix
https://youtu.be/W2pW2myxQU8