Within my organisation we have orders. Orders move products between three entities: Suppliers, Stocks and Customers.

The type of an order gets defined by the origin and the destination it is moving products. This way we can have the following types of orders:

From: To: Type:
Supplier -> Stock BUYORDER
Stock -> Supplier RETOURBUYORDER
Stock -> Stock INTERNORDER
Stock -> Customer SELLORDER
Customer -> Stock RETOURSELLORDER

How can I design objects/mappers to do this:

>>> order = session.query(Order).get(1)
>>> print order.type
<Type id=123 name='INTERNORDER' from=<Stock id=2> to=<Stock id=4>>

>>> order = session.query(Order).get(2)
>>> print order.type
<Type id=456 name='SELLORDER' from=<Stock id=4> to=<Customer id=1928>>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to