From c9b71876469dc20f7e67e8df9d12ef82b7df7957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 26 Sep 2021 23:07:57 +0200 Subject: [PATCH] Use contact_mechanism_get to get phone and email issue10752 review336931002 --- stock.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/stock.py b/stock.py index 97f753950f..5993c82578 100644 --- a/stock.py +++ b/stock.py @@ -216,18 +216,12 @@ class CreateDPDShipping(Wizard): if party.full_name != address.party_full_name: shipping_party['name2'] = party.full_name[:35] - phone = email = '' - for mechanism in party.contact_mechanisms: - if mechanism.type in {'phone', 'mobile'} and not phone: - phone = mechanism.value - if mechanism.type == 'email' and not email: - email = mechanism.value - if phone and email: - break + phone = party.contact_mechanism_get({'phone', 'mobile'}) if phone: - shipping_party['phone'] = phone[:30] + shipping_party['phone'] = phone.value[:30] + email = party.contact_mechanism_get('email') if email: - shipping_party['email'] = email[:50] + shipping_party['email'] = email.value[:50] return shipping_party