In `_compute_analytic_distribution`, we're dealing with recordset and so, should iterate on it. Also, the distribution expects an id, not the record. closes odoo/odoo#104458 X-original-commit: d41d5ef7aebc9f65066ecf86939e3f60aa515539 Related: odoo/enterprise#33378 Signed-off-by: William André (wan) <wan@odoo.com> Signed-off-by: Wala Gauthier (gawa) <gawa@odoo.com>
15 lines
511 B
Python
15 lines
511 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
|
|
|
|
class PurchaseOrderLine(models.Model):
|
|
_inherit = 'purchase.order.line'
|
|
|
|
def _compute_analytic_distribution(self):
|
|
super()._compute_analytic_distribution()
|
|
for line in self:
|
|
if line._context.get('project_id'):
|
|
line.analytic_distribution = {line.env['project.project'].browse(line._context['project_id']).analytic_account_id.id: 100}
|