From a37c582dea3a8e9fc243eef765e33928c4928f2d Mon Sep 17 00:00:00 2001 From: helmutm Date: Tue, 28 Oct 2008 15:43:08 +0000 Subject: [PATCH] add IAddress (from cybertools.organize) with additional fields git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2949 fd906abe-77d9-0310-91a1-e0d9ade77398 --- commerce/customer.py | 8 +++++++- commerce/interfaces.py | 21 ++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/commerce/customer.py b/commerce/customer.py index 59917c9..d658f60 100644 --- a/commerce/customer.py +++ b/commerce/customer.py @@ -25,7 +25,7 @@ $Id$ from zope.interface import implements, Interface from cybertools.commerce.common import RelationSet -from cybertools.commerce.interfaces import ICustomer +from cybertools.commerce.interfaces import ICustomer, IAddress class Customer(object): @@ -39,3 +39,9 @@ class Customer(object): self.title = title or u'unknown' self.client = client self.shops = self.collection(self, 'customers') + + +class Address(object): + + implements(IAddress) + diff --git a/commerce/interfaces.py b/commerce/interfaces.py index ebd2e6d..a57bbed 100644 --- a/commerce/interfaces.py +++ b/commerce/interfaces.py @@ -26,8 +26,9 @@ from zope import schema from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from zope.interface import Interface, Attribute from zope.i18nmessageid import MessageFactory -from loops import util + from cybertools.util.jeep import Jeep, Term +from cybertools.organize.interfaces import IAddress from loops import util _ = MessageFactory('cybertools.commerce') @@ -237,6 +238,24 @@ class ICustomer(Interface): client = Attribute(u'An optional (real) client object of the customer role.') +addressTypesVoc = util.KeywordVocabulary(( + ('standard', _(u'Standard Address')), + ('invoice', _(u'Invoice Address')), + ('shipping', _(u'Shipping Address')), + ('defaultShipping', _(u'Default Shipping Address')), +)) + + +class IAddress(IAddress): + + addressType = schema.Choice( + title=_(u'Address Type'), + description=_(u'Address type.'), + source=addressTypesVoc, + default='standard', + required=False) + + # orders class IOrder(Interface):