Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Delivery - Stock
Entity: stock.move.line
Compute Method: _compute_sale_price
| Inputs | Method | Outputs |
|---|---|---|
|
for move_line in self:
sale_line_id = move_line.move_id.sale_line_id
if sale_line_id and sale_line_id.product_id == move_line.product_id:
# Compute the total price (tax included) for the actually delivered quantity
# using the same tax logic as the sale order line and purchase order line.
- base_line = sale_line_id._convert_to_tax_base_line_dict()
- qty = move_line.product_uom_id._compute_quantity(move_line.quantity, sale_line_id.product_uom)
+ base_line = sale_line_id._prepare_base_line_for_taxes_computation()
+ qty = move_line.product_uom_id._compute_quantity(move_line.quantity, sale_line_id.product_uom_id)
base_line.update({'quantity': qty})
- tax_results = self.env['account.tax'].with_company(sale_line_id.company_id)._compute_taxes([base_line])
- totals = next(iter(tax_results['totals'].values()))
- move_line.sale_price = totals['amount_untaxed'] + totals['amount_tax']
+ self.env['account.tax']._add_tax_details_in_base_line(base_line, sale_line_id.company_id)
+ tax_results = base_line['tax_details']
+ move_line.sale_price = sale_line_id.currency_id.round(tax_results['raw_total_included_currency'])
else:
# For kits, use the regular unit price
unit_price = move_line.product_id.list_price
qty = move_line.product_uom_id._compute_quantity(move_line.quantity, move_line.product_id.uom_id)
move_line.sale_price = unit_price * qty
super(StockMoveLine, self)._compute_sale_price()
|
|
