Skip to content

Commit

Permalink
Merge pull request #103 from akretion/feat/geodis_company_name
Browse files Browse the repository at this point in the history
[FIX] Force company name in contact name for geodis
  • Loading branch information
hparfr authored Jan 7, 2019
2 parents 9210f3b + c9d28ba commit e1b2b96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions roulier/carriers/geodis/geodis_encoder_edi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def encode(self, api_input):
def encode_shipment(self, shipment, service, idx):
packs = shipment['parcels']
to_address = shipment['to_address']
# There is company notion in to_address, so if company exists
# we put it in dest name and person name in contact name.
# if it does not exist, we just put person name in both dest name
# and contact name. Same is done in webservice side.
dest_name = to_address.get('company', to_address['name'])
contact_name = to_address['name']
lines = [
['CNI', '%s' % idx, shipment['shippingId']],
['TSR', '2', # 4065
Expand All @@ -51,14 +57,14 @@ def encode_shipment(self, shipment, service, idx):
["NAD", "CN",
"",
"", # C058
to_address['name'],
dest_name,
[to_address['street1'], to_address['street2']],
to_address['city'],
"", # 3164
to_address['zip'],
to_address['country']
],
['CTA', 'IC', ['', to_address['name']]],
['CTA', 'IC', ['', contact_name]],
]
if to_address['email']:
lines.append(['COM', [to_address['email'], 'EM']])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<imp:telexp>{{ address.phone }}</imp:telexp>
{% endwith %}
{% with address = receiver_address %}
<imp:nomdst>{{ address.name }}</imp:nomdst>
<imp:nomdst>{{ address.company or address.name }}</imp:nomdst>
<imp:ad1dst>{{ address.street1 }}</imp:ad1dst>
<imp:ad2dst>{{ address.street2 }}</imp:ad2dst>
<imp:paydst>{{ address.country }}</imp:paydst>
Expand All @@ -39,4 +39,4 @@
{% endfor %}
<imp:refclt>{{ service.reference1 }}</imp:refclt>
<imp:codopt>{{ service.option }}</imp:codopt>
</imp:demandeImpressionEtiquette>
</imp:demandeImpressionEtiquette>

0 comments on commit e1b2b96

Please sign in to comment.