|
|
|
@ -24,6 +24,14 @@ class Category(enum.Enum):
@@ -24,6 +24,14 @@ class Category(enum.Enum):
|
|
|
|
|
BIOLAB = 'biolab' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OrderStatus(enum.Enum): |
|
|
|
|
''' status of the order ''' |
|
|
|
|
OPEN = 'open' |
|
|
|
|
APPROVAL = 'approval' |
|
|
|
|
ORDERED = 'ordered' |
|
|
|
|
COMPLETED = 'completed' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Consumable(Base): |
|
|
|
|
''' A consumable ''' |
|
|
|
|
|
|
|
|
@ -31,7 +39,7 @@ class Consumable(Base):
@@ -31,7 +39,7 @@ class Consumable(Base):
|
|
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True) |
|
|
|
|
|
|
|
|
|
cas_description = Column(Text, nullable=False, unique=True) |
|
|
|
|
cas_description = Column(Text, nullable=False) |
|
|
|
|
category = Column(Enum(Category), nullable=False) |
|
|
|
|
catalog_nr = Column(Text, nullable=False) |
|
|
|
|
vendor = Column(Text, nullable=False) |
|
|
|
@ -51,3 +59,40 @@ class Consumable(Base):
@@ -51,3 +59,40 @@ class Consumable(Base):
|
|
|
|
|
''' string representation ''' |
|
|
|
|
return '{!s} ({!s})'.format(self.cas_description, self.vendor) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Order(Base): |
|
|
|
|
''' An order ''' |
|
|
|
|
|
|
|
|
|
__tablename__ = 'orders' |
|
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True) |
|
|
|
|
|
|
|
|
|
status = Column(Enum(OrderStatus), nullable=False) |
|
|
|
|
|
|
|
|
|
cas_description = Column(Text, nullable=False) |
|
|
|
|
category = Column(Enum(Category), nullable=False) |
|
|
|
|
catalog_nr = Column(Text, nullable=False) |
|
|
|
|
vendor = Column(Text, nullable=False) |
|
|
|
|
package_size = Column(Text, nullable=False) |
|
|
|
|
|
|
|
|
|
unit_price = Column(Float, nullable=False) |
|
|
|
|
currency = Column(Text, nullable=False, default='EUR') |
|
|
|
|
amount = Column(Integer, nullable=False) |
|
|
|
|
total_price = Column(Float, nullable=False) |
|
|
|
|
|
|
|
|
|
account = Column(Text, nullable=False, default='') |
|
|
|
|
comment = Column(Text, nullable=False, default='') |
|
|
|
|
|
|
|
|
|
created_date = Column(Date, nullable=False, default=datetime.utcnow) |
|
|
|
|
created_by = Column(Text, nullable=False) |
|
|
|
|
approval_date = Column(Date, nullable=True) |
|
|
|
|
approval_by = Column(Text, nullable=False, default='') |
|
|
|
|
ordered_date = Column(Date, nullable=True) |
|
|
|
|
ordered_by = Column(Text, nullable=False, default='') |
|
|
|
|
completed_date = Column(Date, nullable=True) |
|
|
|
|
completed_by = Column(Text, nullable=False, default='') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
|
''' string representation ''' |
|
|
|
|
return '{!s} ({!s})'.format(self.cas_description, self.vendor) |
|
|
|
|