Skip to content

Commit

Permalink
[16.0][MIG] stock_landed_costs_currency: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BT-jdziurzynski committed Jul 6, 2023
1 parent f64a80c commit b7a43c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stock_landed_costs_currency/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Stock Landed Costs Currency",
"version": "13.0.1.0.0",
"version": "16.0.1.0.0",
"author": "Komit Consulting, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Stock Accounting",
Expand Down
2 changes: 1 addition & 1 deletion stock_landed_costs_currency/models/stock_landed_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LandedCost(models.Model):
currency_id = fields.Many2one(
comodel_name="res.currency",
required=True,
related="",
related=None,
default=lambda self: self.env.user.company_id.currency_id,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ def test_change_journal_landed_cost(self):

self.assertEqual(cost_line.price_unit, expected_value)

def test_change_journal_no_currency_landed_cost(self):
self.landed_cost.currency_id = self.usd_currency.id
self.journal.currency_id = False
self.landed_cost._onchange_account_journal_id()
self.assertEqual(self.usd_currency, self.landed_cost.currency_id)

def test_change_currency_landed_cost(self):
self.landed_cost.write({"currency_id": self.usd_currency.id})
self.landed_cost._onchange_currency_id()
Expand All @@ -120,6 +126,12 @@ def test_change_currency_landed_cost(self):
)

self.assertEqual(cost_line.price_unit, expected_value)
# Landed cost currency is the same as company currency
self.landed_cost.currency_id = self.company.currency_id
self.landed_cost._onchange_currency_id()
self.assertEqual(
self.landed_cost.cost_lines[0].price_unit, cost_line.price_unit
)

def test_change_product_landed_cost(self):
cost_line = self.landed_cost.cost_lines[0]
Expand Down

0 comments on commit b7a43c7

Please sign in to comment.