[FIX] delivery,sale_mrp,stock: correct delivery slip kit cost valuation

- Create a product with a kit BOM and weight
- kit components should have list price and weight as well
- Create SO with kit product
- Add shipping (fedex int. or bpost will do)
- Delivery product

A custom's form is generated but the value of the product it is not
correct as it take the valuation of the kit in the sale order
for every component of the kit, resulting in higher customs taxes for
the final customer

opw-2628309

closes odoo/odoo#75658

X-original-commit: e13f048a78b41d81602e868a3b0c7ded24ce992b
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2021-09-02 12:57:47 +00:00
parent f5a08bb1dc
commit 334fb8533f
4 changed files with 23 additions and 0 deletions
+1
View File
@@ -42,6 +42,7 @@ class StockMoveLine(models.Model):
unit_price = move_line.product_id.list_price
qty = move_line.product_uom_id._compute_quantity(move_line.qty_done, move_line.product_id.uom_id)
move_line.sale_price = unit_price * qty
super(StockMoveLine, self)._compute_sale_price()
def _get_aggregated_product_quantities(self, **kwargs):
"""Returns dictionary of products and corresponding values of interest + hs_code
+1
View File
@@ -4,3 +4,4 @@
from . import sale
from . import account_move
from . import mrp_production
from . import stock_move
+17
View File
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
def _compute_sale_price(self):
kit_lines = self.filtered(lambda move_line: move_line.move_id.bom_line_id.bom_id.type == 'phantom')
for move_line in kit_lines:
unit_price = move_line.product_id.list_price
qty = move_line.product_uom_id._compute_quantity(move_line.qty_done, move_line.product_id.uom_id)
move_line.sale_price = unit_price * qty
super(StockMoveLine, self - kit_lines)._compute_sale_price()
+4
View File
@@ -778,3 +778,7 @@ class StockMoveLine(models.Model):
aggregated_move_lines[line_key]['qty_ordered'] += empty_move.product_uom_qty
return aggregated_move_lines
def _compute_sale_price(self):
# To Override
pass