Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: WMS Accounting
Entity: stock.quant
Compute Method: _compute_value
| Inputs | Method | Outputs |
|---|---|---|
|
- """ (Product.value_svl / Product.quantity_svl) * quant.quantity, i.e. average unit cost * on hand qty - """ - self.fetch(['company_id', 'location_id', 'owner_id', 'product_id', 'quantity']) + self.fetch(['company_id', 'location_id', 'owner_id', 'product_id', 'quantity', 'lot_id']) + self.value = 0 for quant in self: - quant.currency_id = quant.company_id.currency_id if not quant.location_id or not quant.product_id or\ not quant.location_id._should_be_valued() or\ quant._should_exclude_for_valuation() or\ - float_is_zero(quant.quantity, precision_rounding=quant.product_id.uom_id.rounding): - quant.value = 0 + quant.product_id.uom_id.is_zero(quant.quantity): continue - quantity = quant.product_id.with_company(quant.company_id).quantity_svl - if float_is_zero(quantity, precision_rounding=quant.product_id.uom_id.rounding): - quant.value = 0.0 + if quant.product_id.lot_valuated: + quantity = quant.lot_id.with_company(quant.company_id).product_qty + value = quant.lot_id.with_company(quant.company_id).total_value + else: + quantity = quant.product_id.with_company(quant.company_id)._with_valuation_context().qty_available + value = quant.product_id.with_company(quant.company_id).total_value + if quant.product_id.uom_id.is_zero(quantity): continue - quant.value = quant.quantity * quant.product_id.with_company(quant.company_id).value_svl / quantity + quant.value = quant.quantity * value / quantity |
|
