Files
stock-logistics-warehouse/stock_quant_cost_info/models/stock_quant.py
Carlos Roca 2c2f4d326a [MIG] stock_quant_cost_info: Migration to 15.0
- Module renamed from stock_inventory_cost_info to stock_quant_cost_info
- Add changes to allow show the cost difference when changing qty from stock.quants

TT36551
2023-05-08 15:49:54 -04:00

25 lines
846 B
Python

# Copyright 2019 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class StockQuant(models.Model):
_inherit = "stock.quant"
currency_id = fields.Many2one(
comodel_name="res.currency", string="Currency", related="company_id.currency_id"
)
adjustment_cost = fields.Monetary(
string="Adjustment cost", compute="_compute_adjustment_cost", store=True
)
@api.depends("inventory_diff_quantity", "product_id.standard_price")
def _compute_adjustment_cost(self):
for record in self:
record.adjustment_cost = False
if record.inventory_diff_quantity:
record.adjustment_cost = (
record.inventory_diff_quantity * record.product_id.standard_price
)