app/soc/models/role.py
changeset 2768 97a1569b2743
parent 2698 5783338b2c8d
equal deleted inserted replaced
2767:4011d44ba0b6 2768:97a1569b2743
   372     if self.name_on_documents:
   372     if self.name_on_documents:
   373       return self.name_on_documents
   373       return self.name_on_documents
   374     else:
   374     else:
   375       return self.name()
   375       return self.name()
   376 
   376 
       
   377   def shipping_street(self):
       
   378     """Property shipping_street that returns shipping street if
       
   379     shipping address is set else the residential street.
       
   380     """
       
   381     return self.ship_street if self.hasShippingAddress() else self.res_street
       
   382 
       
   383   def shipping_city(self):
       
   384     """Property shipping_city that returns shipping city if
       
   385     shipping address is set else the residential city.
       
   386     """
       
   387     return self.ship_city if self.hasShippingAddress() else self.res_city
       
   388 
       
   389   def shipping_state(self):
       
   390     """Property shipping_state that returns shipping state if
       
   391     shipping address is set else the residential state.
       
   392     """
       
   393     return self.ship_state if self.hasShippingAddress() else self.res_state
       
   394 
       
   395   def shipping_country(self):
       
   396     """Property shipping_country that returns shipping country if
       
   397     shipping address is set else the residential country.
       
   398     """
       
   399     return self.ship_country if self.hasShippingAddress() else self.res_country
       
   400 
       
   401   def shipping_postalcode(self):
       
   402     """Property shipping_postalcode that returns the shipping postal code if
       
   403     shipping address set else the residential postal code.
       
   404     """
       
   405     return self.ship_postalcode if self.hasShippingAddress() else \
       
   406         self.res_postalcode
       
   407 
       
   408   def hasShippingAddress(self):
       
   409     """Checks if the required fields for the shipping address are set.
       
   410     """
       
   411     return self.ship_city and self.ship_country and self.ship_postalcode and \
       
   412         self.ship_street
       
   413 
   377   def ccTld(self):
   414   def ccTld(self):
   378     """Property as 'ccTld' for use in Maps.
   415     """Property as 'ccTld' for use in Maps.
   379     """
   416     """
   380     return countries.COUNTRIES_TO_CCTLD[self.res_country]
   417     return countries.COUNTRIES_TO_CCTLD[self.res_country]