-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4710][IMP] stock_picking_accounting_date: Get currency rate based on…
… accounting date (#148) * [IMP] stock_picking_accounting_date: Get currency rate based on accounting date
- Loading branch information
1 parent
4085c38
commit 8456ace
Showing
3 changed files
with
22 additions
and
0 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,2 +1,3 @@ | ||
from . import res_currency | ||
from . import stock_picking | ||
from . import stock_move |
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,13 @@ | ||
# Copyright 2024 Quartile (https://www.quartile.co) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class ResCurrency(models.Model): | ||
_inherit = "res.currency" | ||
|
||
def _convert(self, from_amount, to_currency, company, date, round=True): | ||
if self.env.context.get("accounting_date"): | ||
date = self.env.context.get("accounting_date") | ||
return super()._convert(from_amount, to_currency, company, date, round) |
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