| 1 |
|
| 2 |
|
| 3 |
from odoo import models |
| 4 |
|
| 5 |
|
| 6 |
class StockMove(models.Model): |
| 7 |
_inherit = 'stock.move' |
| 8 |
|
| 9 |
def _get_price_unit(self): |
| 10 |
order_line = self.sale_line_id |
| 11 |
if order_line and all(move.sale_line_id == order_line for move in self) and any(move.product_id != order_line.product_id for move in self): |
| 12 |
product = order_line.product_id.with_company(order_line.company_id) |
| 13 |
bom = product.env['mrp.bom']._bom_find(product, company_id=self.company_id.id, bom_type='phantom')[product] |
| 14 |
if bom: |
| 15 |
return self._get_kit_price_unit(product, bom, order_line.qty_delivered) |
| 16 |
return super()._get_price_unit() |