[Zope3-Users] Newbie relationship question

Carlo Cardelli ccardelli at iv-srl.it
Wed Jul 26 12:33:50 EDT 2006


Hi all,
sorry for the 'basic' question but I don't know where to look...

I am setting up two related objects, "Invoice" and "Customer".
IMO there is a non-containing relationship here, i.e. I do not want the 
Customer to 'contain' Invoices; a Customer can receive more than one 
Invoice.
Here are my basic Interfaces:

class ICustomer(Interface):
     custCode = Int(
         title=u"Cust Ref Code",
         description=u"Cust Ref Code"
         min=1,
         required=True
         )
     custName = TextLine(
         title=u"Cust Name",
         description=u"Cust Name",
         max_length=30,
         required=True
         )
     ... other ininfluent fields...


class IInvoice(Interface):
     invRef = Int(
         title=u"Ref.no",
         description=u"Invoice reference number",
         min=1,
         required=True
         )
     invDate = Date(
         title=u"Date",
         description=u"Invoice Date",
         required=True
         )
     invCust = Object(
         schema=ICustomer,
         title=u"Customer",
         description=u"Customer",
         required=True
         )
     ... other ininfluent fields...


Now, I have to render the 'invCust' object as a selection-list showing 
the custNames of all possible Customers, where the user can select the 
appropriate Customer for the Invoice. Editing the Invoice, the 
selection-list should position itself showing the Customer set previously.
In other words, I need a widget that somewhat behave like 
"Plone.Archetypes.ReferenceWidget".
I know that this is a very basic problem. Anyone already implemented it?

Thank you in advance.



More information about the Zope3-users mailing list