-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
106 additions
and
40 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
], | ||
'depends': [ | ||
'stock_account', | ||
'stock_landed_costs', | ||
'product_replenishment_cost', | ||
], | ||
'data': [ | ||
|
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
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,28 @@ | ||
from collections import defaultdict | ||
|
||
from odoo import models, api, fields | ||
from odoo.tools.float_utils import float_compare, float_is_zero | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
@api.model_create_multi | ||
def create(self, vals_list): | ||
if self.env.context.get('revaluation_force_currency'): | ||
vals_list = self.alter_vals_for_revaluation_in_currency(vals_list) | ||
res_ids = super(AccountMove, self).create(vals_list) | ||
return res_ids | ||
|
||
def alter_vals_for_revaluation_in_currency(self, vals_list): | ||
valuation_currency_id = self.env.context.get('revaluation_force_currency').id | ||
value_in_currency = self.env.context.get('revaluation_value_in_currency') | ||
vals_list[0]['line_ids'][0][2].update(({ | ||
'currency_id': valuation_currency_id, | ||
'amount_currency': abs(value_in_currency) | ||
})) | ||
vals_list[0]['line_ids'][1][2].update(({ | ||
'currency_id': valuation_currency_id, | ||
'amount_currency': abs(value_in_currency) * -1 | ||
})) | ||
return vals_list |
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
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,26 @@ | ||
from odoo import models | ||
|
||
|
||
class AdjustmentLines(models.Model): | ||
|
||
_inherit = 'stock.valuation.adjustment.lines' | ||
|
||
def _create_accounting_entries(self, move, qty_out): | ||
AccountMoveLine = super()._create_accounting_entries(move, qty_out) | ||
if self.product_id.categ_id.valuation_currency_id: | ||
amount = AccountMoveLine[0][2]['debit'] or AccountMoveLine[0][2]['credit'] * -1 | ||
value_in_currency = self.cost_id.currency_id._convert( | ||
from_amount=amount, | ||
to_currency=self.product_id.categ_id.valuation_currency_id, | ||
company=self.cost_id.company_id, | ||
date=self.create_date, | ||
) | ||
AccountMoveLine[0][2].update(({ | ||
'currency_id': self.product_id.categ_id.valuation_currency_id.id, | ||
'amount_currency': value_in_currency | ||
})) | ||
AccountMoveLine[1][2].update(({ | ||
'currency_id': self.product_id.categ_id.valuation_currency_id.id, | ||
'amount_currency': value_in_currency * -1 | ||
})) | ||
return AccountMoveLine |
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
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
File renamed without changes.
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