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] sale: avoid crash when posting move linked to multiple SO #110560
[FIX] sale: avoid crash when posting move linked to multiple SO #110560
Conversation
Because of the M2M relation, an account.move.line can be linked to several sale.order.lines, making the cardinality of sale_line_ids superior to 1. Even if it is not possible to obtain this result with standard code, a custom module could create this situation and posting the invoice would result in a "ValueError: Expected singleton" exception. This commit prevents this exception by checking whether the line is linked to at least one downpayment SO line in the method action_post. The test also checks that the methods button_draft and button_cancel behave properly (spoiler alert: they will fail too in 16.0).
@robodoo delegate+ |
@Feyensv Thanks for the approval! |
Well, since there is no standard flow to have multiple linked lines, even less downpayment ones, I have no idea if we want an |
@robodoo r+ |
Because of the M2M relation, an account.move.line can be linked to several sale.order.lines, making the cardinality of sale_line_ids superior to 1. Even if it is not possible to obtain this result with standard code, a custom module could create this situation and posting the invoice would result in a "ValueError: Expected singleton" exception. This commit prevents this exception by checking whether the line is linked to at least one downpayment SO line in the method action_post. The test also checks that the methods button_draft and button_cancel behave properly (spoiler alert: they will fail too in 16.0). closes #110560 Signed-off-by: Paul Morelle (pmo) <pmo@odoo.com>
1 similar comment
Because of the M2M relation, an account.move.line can be linked to several sale.order.lines, making the cardinality of sale_line_ids superior to 1. Even if it is not possible to obtain this result with standard code, a custom module could create this situation and posting the invoice would result in a "ValueError: Expected singleton" exception. This commit prevents this exception by checking whether the line is linked to at least one downpayment SO line in the method action_post. The test also checks that the methods button_draft and button_cancel behave properly (spoiler alert: they will fail too in 16.0). closes odoo#110560 Signed-off-by: Paul Morelle (pmo) <pmo@odoo.com>
3 similar comments
Because of the M2M relation, an account.move.line can be linked to several sale.order.lines, making the cardinality of sale_line_ids superior to 1. Even if it is not possible to obtain this result with standard code, a custom module could create this situation and posting the invoice would result in a "ValueError: Expected singleton" exception. This commit prevents this exception by checking whether the line is linked to at least one downpayment SO line in the method action_post. The test also checks that the methods button_draft and button_cancel behave properly (spoiler alert: they will fail too in 16.0). closes odoo#110560 Signed-off-by: Paul Morelle (pmo) <pmo@odoo.com>
Because of the M2M relation, an account.move.line can be linked to several sale.order.lines, making the cardinality of sale_line_ids superior to 1. Even if it is not possible to obtain this result with standard code, a custom module could create this situation and posting the invoice would result in a "ValueError: Expected singleton" exception. This commit prevents this exception by checking whether the line is linked to at least one downpayment SO line in the method action_post. The test also checks that the methods button_draft and button_cancel behave properly (spoiler alert: they will fail too in 16.0). closes odoo#110560 Signed-off-by: Paul Morelle (pmo) <pmo@odoo.com>
Because of the M2M relation, an account.move.line can be linked to several sale.order.lines, making the cardinality of sale_line_ids superior to 1.
Even if it is not possible to obtain this result with standard code, a custom module could create this situation and posting the invoice would result in a "ValueError: Expected singleton" exception.
This commit prevents this exception by checking whether the line is linked to at least one downpayment SO line in the method action_post. The test also checks that the methods button_draft and button_cancel
behave properly (spoiler alert: they will fail too in 16.0).
Closes #77195
Fixes #77028