Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] crm_multicompany_reporting_currency: Migration to 16.0 #535

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[FIX] crm_multicompany_reporting_currency: fix amount
  • Loading branch information
yankinmax authored and peluko00 committed Nov 27, 2023
commit 828c1a650a0559b32148e9c2e473a55c7959308f
1 change: 1 addition & 0 deletions crm_multicompany_reporting_currency/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
"website": "https://github.com/OCA/crm",
"data": ["views/crm_lead_views.xml"],
"installable": True,
"maintainers": ["yankinmax"],
}
2 changes: 1 addition & 1 deletion crm_multicompany_reporting_currency/models/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ def _compute_amount_multicompany_reporting_currency(self):
if record.company_currency == record.multicompany_reporting_currency_id:
to_amount = record.expected_revenue
else:
to_amount = record.expected_revenue / record.currency_rate
to_amount = record.expected_revenue * record.currency_rate
record.amount_multicompany_reporting_currency = to_amount
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def setUpClass(cls):
cls.env["res.currency.rate"].create(
{
"name": fields.Date.today(),
"rate": 0.98,
"rate": 1.0038,
"currency_id": cls.currency_swiss_id,
"company_id": cls.company.id,
}
Expand Down Expand Up @@ -60,7 +60,9 @@ def test_amount_multicompany_reporting_currency(self):
}
)
)
self.assertEqual(self.lead_1.amount_multicompany_reporting_currency, 1020.41)
self.assertAlmostEqual(
self.lead_1.amount_multicompany_reporting_currency, 1003.8
)
# Company currency is in EUR, Amount Multicompany Reporting Currency is EUR
self.env["res.config.settings"].create(
{"multicompany_reporting_currency": self.currency_euro_id}
Expand All @@ -77,7 +79,7 @@ def test_amount_multicompany_reporting_currency(self):
}
)
)
self.assertEqual(self.lead_2.amount_multicompany_reporting_currency, 1230)
self.assertAlmostEqual(self.lead_2.amount_multicompany_reporting_currency, 1230)
# Company isn't set on the Lead, Amount Multicompany Reporting Currency is EUR
self.lead_2 = self.env["crm.lead"].create(
{
Expand All @@ -87,4 +89,4 @@ def test_amount_multicompany_reporting_currency(self):
"expected_revenue": 842,
}
)
self.assertEqual(self.lead_2.amount_multicompany_reporting_currency, 842)
self.assertAlmostEqual(self.lead_2.amount_multicompany_reporting_currency, 842)