| 1 | # Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 | |
| 3 | from odoo import models |
| 4 | |
| 5 | |
| 6 | class StockMove(models.Model): |
| 7 | _inherit = 'stock.move' |
| 8 | |
| 9 | def _get_aml_value(self): |
| 10 | value = super()._get_aml_value() |
| 11 | if ( |
| 12 | self.production_id |
| 13 | and self.move_dest_ids.filtered(lambda m: m.state == "done")[-1:].is_subcontract |
| 14 | and self.product_id.cost_method != "standard" |
| 15 | ): |
| 16 | value -= self.production_id.extra_cost * self.product_uom._compute_quantity(self.quantity, self.product_id.uom_id) |
| 17 | return value |