LaOcaCoop/laosa#313 Add module stock_inventory_cost_info_sum

This commit is contained in:
Luis 2022-07-11 17:52:20 +02:00
parent 79abf4b1db
commit 3ddb55fba8
6 changed files with 94 additions and 0 deletions

View file

@ -0,0 +1 @@
from . import stock_inventory

View file

@ -0,0 +1,26 @@
# Copyright 2022 Criptomart
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
class StockInventory(models.Model):
_inherit = 'stock.inventory'
currency_id = fields.Many2one(
string="Currency",
related="company_id.currency_id",
readonly=True,
)
adjustment_cost_sum = fields.Monetary(
string="Adjustment cost",
compute="_compute_adjustment_cost_sum",
store=True,
)
@api.depends("line_ids")
def _compute_adjustment_cost_sum(self):
for record in self:
record.adjustment_cost_sum = 0
for line in record.line_ids:
record.adjustment_cost_sum += line.adjustment_cost