Skip to content

Commit

Permalink
[FIX] stock_analytic
Browse files Browse the repository at this point in the history
This commit fixes analytic_distribution not being passed from move to move line when updated after the move line is created.
  • Loading branch information
AungKoKoLin1997 committed Oct 23, 2024
1 parent a3b8d65 commit b43d912
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion stock_analytic/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@
# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, models
from odoo import api, fields, models


class StockMove(models.Model):
_name = "stock.move"
_inherit = ["stock.move", "analytic.mixin"]

analytic_distribution = fields.Json(
inverse="_inverse_analytic_distribution",
)

def _inverse_analytic_distribution(self):
"""If analytic distribution is set on move, write it on all move lines"""
for move in self:
move.move_line_ids.write(
{"analytic_distribution": move.analytic_distribution}
)

def _prepare_account_move_line(
self, qty, cost, credit_account_id, debit_account_id, svl_id, description
):
Expand Down

0 comments on commit b43d912

Please sign in to comment.