Browse Source

[FIX] address_default: return ids on address_get

14.0
Pierrick Brun 3 years ago
parent
commit
da77c95717
  1. 2
      partner_contact_address_default/models/res_partner.py
  2. 8
      partner_contact_address_default/tests/test_partner_contact_address_default.py

2
partner_contact_address_default/models/res_partner.py

@ -26,5 +26,5 @@ class ResPartner(models.Model):
for addr_type in default_address_type_list: for addr_type in default_address_type_list:
default_address_id = partner["partner_{}_id".format(addr_type)] default_address_id = partner["partner_{}_id".format(addr_type)]
if default_address_id: if default_address_id:
res[addr_type] = default_address_id
res[addr_type] = default_address_id.id
return res return res

8
partner_contact_address_default/tests/test_partner_contact_address_default.py

@ -31,11 +31,11 @@ class TestPartnerContactAddressDefault(common.TransactionCase):
self.partner.partner_delivery_id = self.partner self.partner.partner_delivery_id = self.partner
self.partner.partner_invoice_id = self.partner self.partner.partner_invoice_id = self.partner
res = self.partner.address_get() res = self.partner.address_get()
self.assertEqual(res["delivery"], self.partner)
self.assertEqual(res["invoice"], self.partner)
self.assertEqual(res["delivery"], self.partner.id)
self.assertEqual(res["invoice"], self.partner.id)
self.partner_child_delivery2.partner_delivery_id = self.partner_child_delivery2 self.partner_child_delivery2.partner_delivery_id = self.partner_child_delivery2
self.partner_child_delivery2.partner_invoice_id = self.partner_child_delivery2 self.partner_child_delivery2.partner_invoice_id = self.partner_child_delivery2
res = self.partner_child_delivery2.address_get() res = self.partner_child_delivery2.address_get()
self.assertEqual(res["delivery"], self.partner_child_delivery2)
self.assertEqual(res["invoice"], self.partner_child_delivery2)
self.assertEqual(res["delivery"], self.partner_child_delivery2.id)
self.assertEqual(res["invoice"], self.partner_child_delivery2.id)
Loading…
Cancel
Save