mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-20 18:52:08 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
from . import test_geoengine_partner
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# Copyright 2015-2017 ACSONE SA/NV (<http://acsone.eu>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestGeoenginePartner(TransactionCase):
|
||||
def test_get_geo_point(self):
|
||||
partner_id = self.env.ref("base.user_root").partner_id
|
||||
partner_id.partner_longitude = False
|
||||
partner_id.partner_latitude = False
|
||||
self.assertFalse(
|
||||
partner_id.geo_point, "Should not have geo_point with no latlon"
|
||||
)
|
||||
partner_id.partner_latitude = 20
|
||||
self.assertFalse(
|
||||
partner_id.geo_point, "Should not have geo_point with no latlon"
|
||||
)
|
||||
partner_id.partner_longitude = 20
|
||||
self.assertTrue(partner_id.geo_point, "Should have geo_point")
|
||||
|
||||
def test_geo_localize(self):
|
||||
vals = {
|
||||
"name": "Partner Project",
|
||||
"street": "Rue au bois la dame",
|
||||
"country_id": self.env.ref("base.be").id,
|
||||
"zip": "6800",
|
||||
}
|
||||
partner_id = self.env["res.partner"].create(vals)
|
||||
partner_id.name = "Other Partner"
|
||||
partner_id.with_context(force_geo_localize=True).geo_localize()
|
||||
self.assertAlmostEqual(
|
||||
partner_id.partner_latitude, 49.9535323, 2, "Latitude Should be equals"
|
||||
)
|
||||
self.assertAlmostEqual(
|
||||
partner_id.partner_longitude, 5.4119073, 2, "Longitude Should be equals"
|
||||
)
|
||||
domain = [("id", "=", partner_id.id)]
|
||||
partner_id.unlink()
|
||||
self.assertFalse(
|
||||
self.env["res.partner"].search(domain),
|
||||
"Should not have this partner anymore",
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue