Automatic Update form OCA2FC Migrator

This commit is contained in:
Flectra Community Bot 2021-10-24 02:12:17 +00:00 committed by OCA2FC Migrator Bot
parent cfdb50a921
commit ba30203d3f
4 changed files with 29 additions and 2 deletions

View File

@ -21,7 +21,7 @@ addon | version | summary
[partner_disable_gravatar](partner_disable_gravatar/) | 2.0.1.0.0| Disable automatic connection to gravatar.com
[partner_external_map](partner_external_map/) | 2.0.1.0.0| Add Map and Map Routing buttons on partner form to open GMaps, OSM, Bing and others
[partner_email_check](partner_email_check/) | 2.0.1.1.1| Validate email address field
[base_location](base_location/) | 2.0.1.2.1| Enhanced zip/npa management system
[base_location](base_location/) | 2.0.1.2.2| Enhanced zip/npa management system
[partner_phone_secondary](partner_phone_secondary/) | 2.0.1.0.0| Adds a secondary phone number on partners
[partner_contact_lang](partner_contact_lang/) | 2.0.1.0.0| Manage language in contacts
[partner_manual_rank](partner_manual_rank/) | 2.0.1.0.0| Be able to manually flag partners as customer or supplier.

View File

@ -4,7 +4,7 @@
{
"name": "Location management (aka Better ZIP)",
"version": "2.0.1.2.1",
"version": "2.0.1.2.2",
"depends": ["base_address_city", "contacts"],
"author": (
"Camptocamp,"

View File

@ -146,3 +146,7 @@ class ResPartner(models.Model):
for node in doc.xpath("//field[@name='zip_id']"):
node.attrib["domain"] = self._zip_id_domain()
return etree.tostring(doc, encoding="unicode")
@api.model
def _address_fields(self):
return super()._address_fields() + ["zip_id"]

View File

@ -204,6 +204,29 @@ class TestBaseLocation(common.SavepointCase):
self.company._onchange_state_id()
self.assertEqual(self.company.country_id, self.company.state_id.country_id)
def test_partner_address_field_sync(self):
"""Test that zip_id is correctly synced with parent of contact addresses"""
parent = self.env["res.partner"].create(
{
"name": "ACME Inc.",
"is_company": True,
"street": "123 Fake St.",
"city": "Springfield",
"state_id": self.barcelona.state_id.id,
"country_id": self.barcelona.country_id.id,
"zip_id": self.barcelona.id,
}
)
contact = self.env["res.partner"].create(
{
"name": "John Doe",
"type": "contact",
"parent_id": parent.id,
}
)
parent.zip_id = self.lausanne
self.assertEqual(contact.zip_id, self.lausanne, "Contact should be synced")
def test_display_name(self):
"""Test if the display_name is stored and computed properly"""
self.assertEqual(