mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch 'imp/12.0/H4825_l10n_us_partner_zipcode__add_unit_tests' into '12.0'
imp/12.0/H4825_l10n_us_partner_zipcode__add_unit_tests into 12.0 See merge request hibou-io/hibou-odoo/suite!807
This commit is contained in:
1
l10n_us_partner_zipcode/tests/__init__.py
Normal file
1
l10n_us_partner_zipcode/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_res_partner_zipcode
|
||||
31
l10n_us_partner_zipcode/tests/test_res_partner_zipcode.py
Normal file
31
l10n_us_partner_zipcode/tests/test_res_partner_zipcode.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from odoo import fields
|
||||
from odoo.tests.common import Form, TransactionCase
|
||||
|
||||
|
||||
class TestPartnerZip(TransactionCase):
|
||||
def test_00_onchange_zip(self):
|
||||
country_us = self.env['res.country'].search([('code', '=', 'US')], limit=1)
|
||||
state_wa = self.env['res.country.state'].search([('code', '=', 'WA'),
|
||||
('country_id', '=', country_us.id),
|
||||
], limit=1)
|
||||
|
||||
f = Form(self.env['res.partner'])
|
||||
self.assertFalse(f.city)
|
||||
self.assertFalse(f.state_id)
|
||||
self.assertFalse(f.country_id)
|
||||
self.assertFalse(f.zip)
|
||||
if hasattr(f, 'partner_latitude'):
|
||||
self.assertFalse(f.partner_latitude)
|
||||
self.assertFalse(f.partner_longitude)
|
||||
self.assertFalse(f.date_localization)
|
||||
|
||||
f.zip = '98270'
|
||||
f.name = 'Required Field'
|
||||
p = f.save()
|
||||
self.assertEqual(p.city, 'Marysville')
|
||||
self.assertEqual(p.state_id, state_wa)
|
||||
self.assertEqual(p.country_id, country_us)
|
||||
if hasattr(p, 'partner_latitude'):
|
||||
self.assertEqual(p.partner_latitude, 48.06)
|
||||
self.assertEqual(p.partner_longitude, -122.16)
|
||||
self.assertEqual(p.date_localization, fields.Date.context_today(p))
|
||||
Reference in New Issue
Block a user