forked from priyankarani/trytond-shipping-dpd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparty.py
More file actions
38 lines (30 loc) · 1007 Bytes
/
party.py
File metadata and controls
38 lines (30 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- encoding: utf-8 -*-
"""
Customizes party address to have address in correct format for DPD API
"""
from trytond.pool import PoolMeta
__all__ = ['Address']
__metaclass__ = PoolMeta
class Address:
'''
Address
'''
__name__ = 'party.address'
def to_dpd_address(self, shipment_service_client):
"""
Converts the address to a complex type: address defined in the WSDL.
"""
address = shipment_service_client.factory.create('ns0:address')
address.name1 = (self.name or self.party.name)
address.street = self.street
address.zipCode = self.zip
address.city = self.city
if self.subdivision:
address.state = self.subdivision.code[3:]
if self.country:
address.country = self.country.code
address.customerNumber = self.party.code
address.phone = self.party.phone
address.fax = self.party.fax
address.email = self.party.email
return address