Skip to content

Commit

Permalink
[MIG] res_company_search_view: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Feb 7, 2025
1 parent f6306ed commit d465766
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 1 deletion.
3 changes: 3 additions & 0 deletions res_company_search_view/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Contributors
------------

- Sylvain LE GAL <https://twitter.com/legalsylvain>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion res_company_search_view/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Company - Search View",
"summary": "Add a search view for company model",
"version": "16.0.1.0.0",
"version": "18.0.1.0.0",
"category": "Tools",
"author": "GRAP, Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
Expand Down
3 changes: 3 additions & 0 deletions res_company_search_view/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
- Sylvain LE GAL \<<https://twitter.com/legalsylvain>\>
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io)
- Bhavesh Heliconia

4 changes: 4 additions & 0 deletions res_company_search_view/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Sylvain LE GAL &lt;<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>&gt;</li>
<li><a class="reference external" href="https://www.heliconia.io">Heliconia Solutions Pvt. Ltd.</a><ul>
<li>Bhavesh Heliconia</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
1 change: 1 addition & 0 deletions res_company_search_view/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_res_company
104 changes: 104 additions & 0 deletions res_company_search_view/tests/test_res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
from odoo.addons.base.tests.common import BaseCommon


class TestResCompany(BaseCommon):
def setUp(self):
super().setUp()
# Create a test company for use in test cases
self.company = self.env["res.company"].create(
{
"name": "Test Company",
"country_id": self.env.ref("base.us").id,
"street": "123 Test Street",
"street2": "Suite 456",
"zip": "12345",
"city": "Test City",
"state_id": self.env.ref("base.state_us_1").id,
}
)

def test_create_company_with_address(self):
"""Test creation of a company with address details."""
self.assertEqual(
self.company.street, "123 Test Street", "Street value is incorrect"
)
self.assertEqual(
self.company.street2, "Suite 456", "Street2 value is incorrect"
)
self.assertEqual(self.company.zip, "12345", "ZIP code value is incorrect")
self.assertEqual(self.company.city, "Test City", "City value is incorrect")
self.assertEqual(
self.company.state_id,
self.env.ref("base.state_us_1"),
"State value is incorrect",
)
self.assertEqual(
self.company.country_id,
self.env.ref("base.us"),
"Country value is incorrect",
)

def test_update_company_address(self):
"""Test updating the address details of a company."""
self.company.write(
{
"street": "789 New Street",
"street2": "Apt 101",
"zip": "67890",
"city": "New City",
"state_id": self.env.ref("base.state_us_2").id,
"country_id": self.env.ref("base.ca").id,
}
)
self.assertEqual(
self.company.street,
"789 New Street",
"Street value did not update correctly",
)
self.assertEqual(
self.company.street2, "Apt 101", "Street2 value did not update correctly"
)
self.assertEqual(
self.company.zip, "67890", "ZIP code value did not update correctly"
)
self.assertEqual(
self.company.city, "New City", "City value did not update correctly"
)
self.assertEqual(
self.company.state_id,
self.env.ref("base.state_us_2"),
"State value did not update correctly",
)
self.assertEqual(
self.company.country_id,
self.env.ref("base.ca"),
"Country value did not update correctly",
)

def test_create_company_with_partial_address(self):
"""Test creation of a company with partial address details."""
partial_company = self.env["res.company"].create(
{
"name": "Partial Address Company",
"street": "456 Partial Street",
"zip": "54321",
"city": "Partial City",
}
)
self.assertEqual(
partial_company.street,
"456 Partial Street",
"Partial street value is incorrect",
)
self.assertEqual(
partial_company.zip, "54321", "Partial ZIP code value is incorrect"
)
self.assertEqual(
partial_company.city, "Partial City", "Partial city value is incorrect"
)
self.assertFalse(
partial_company.country_id, "Country should not be set for partial address"
)
self.assertFalse(
partial_company.state_id, "State should not be set for partial address"
)

0 comments on commit d465766

Please sign in to comment.