Currently when unbuild a MO, we create journal entries the same as receiving components (add credit to input account) and deliver finished product (add debit to output account). But since the unbuild is just a revesal of the MO, the journal entries should alse be revesals. In this commit, when unbuild a MO, for the journal entry about the component change, we add credit to the output account, and for the journal entry of the finished product change, we add debit to input account make sure the journal entries are also reversals. Task 2312828 PR #58150 closes odoo/odoo#60730 X-original-commit: 83a3230706e1e2f4eaf9718156647821341d192b Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
13 lines
389 B
Python
13 lines
389 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
from odoo import api, fields, models, _
|
|
|
|
|
|
class StockMove(models.Model):
|
|
_inherit = "stock.move"
|
|
|
|
def _is_returned(self, valued_type):
|
|
if self.unbuild_id and self.unbuild_id.mo_id: # unbuilding a MO
|
|
return True
|
|
return super()._is_returned(valued_type)
|