oca-ocb-sale/odoo-bringout-oca-ocb-sale_project/sale_project/models/account_move.py
2025-08-29 15:20:49 +02:00

13 lines
574 B
Python

# -*- coding: utf-8 -*-
from odoo import models
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
def _compute_analytic_distribution(self):
# when a project creates an aml, it adds an analytic account to it. the following filter is to save this
# analytic account from being overridden by analytic default rules and lack thereof
project_amls = self.filtered(lambda aml: aml.analytic_distribution and any(aml.sale_line_ids.project_id))
super(AccountMoveLine, self - project_amls)._compute_analytic_distribution()