LaOcaCoop/laosa#313 Add module stock_inventory_cost_info_sum
This commit is contained in:
parent
79abf4b1db
commit
3ddb55fba8
6 changed files with 94 additions and 0 deletions
1
stock_inventory_cost_info_sum/models/__init__.py
Normal file
1
stock_inventory_cost_info_sum/models/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import stock_inventory
|
||||
26
stock_inventory_cost_info_sum/models/stock_inventory.py
Normal file
26
stock_inventory_cost_info_sum/models/stock_inventory.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue