-
-
Notifications
You must be signed in to change notification settings - Fork 654
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by LoisRForgeFlow
- Loading branch information
Showing
3 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import product | ||
from . import stock_valuation_layer |
20 changes: 20 additions & 0 deletions
20
stock_account_product_run_fifo_hook/model/stock_valuation_layer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 ForgeFlow, S.L. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). | ||
from odoo import api, models | ||
|
||
|
||
class StockValuationLayer(models.Model): | ||
_inherit = "stock.valuation.layer" | ||
|
||
@api.model_create_multi | ||
def create(self, values): | ||
if any("taken_data" in val.keys() for val in values): | ||
taken_data = [ | ||
"taken_data" in val.keys() and val.pop("taken_data") or {} | ||
for val in values | ||
] | ||
return super( | ||
StockValuationLayer, self.with_context(taken_data=taken_data) | ||
).create(values) | ||
else: | ||
return super().create(values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters