Files
odoo_source/addons/project_purchase/models
Paul Stroobant 2283f1105b [FIX] project_purchase: split ids when calculating analytic contribution
Steps to reproduce issue:

1. Create a Project with an Analytic Account and ensure it is Billable
2. Create a Purchase Order and add a Product
3. Add an Analytic Distribution to the Product with, on one line, the Project Account and an Account from another Plan
4. Confirm the Purchase Order
5. Open the Project's Updates
6. You get the error :

>     analytic_contribution = pol_read['analytic_distribution'][str(self.analytic_account_id.id)] / 100.
>     KeyError: '[int]'

Explanation:

This issue is related to odoo@73fa88c44ae64b2fc93ef1233f1ab8f8dbe2b0cc: the IDs are now stored in a csv string instead of separate values to allow for cross-analytics. In this case, `self.analytic_account_id.id` is not a key but part of a key.
The line causing the issue was overlooked during the resolution of the previous one.

Suggested fix:

Similar lines have been fixed in the previous commit. Applying the same correction solves the issue.
https://github.com/odoo/odoo/commit/73fa88c44ae64b2fc93ef1233f1ab8f8dbe2b0cc#diff-7af98465d7e344b935b9f2327a30b2da17a4df73d64bfee5b9b7a497362083e7L48-R59
https://github.com/odoo/odoo/commit/73fa88c44ae64b2fc93ef1233f1ab8f8dbe2b0cc#diff-2f1670bdaecbb290806818cc80aff338e2f956d89f3a71f6c2ed1b9805795fd3L575-R600

opw-3773509

closes odoo/odoo#158325

Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
2024-03-22 14:47:54 +00:00
..