New: - Removed the connection between tables 'receipt_item' and 'item'. Instead the position on the receipt will be stored as a primary key with the receipt.id. - Uploading a receipt and checking items for invoice is now working. - Uploading a receipt now redirects directly to the form where the items on the receipt can be marked for invoice. - Added pagination for candidates-page. Refactoring: - Added _rencer_field_errors.html for centralized error display. - Added edeka_parser.py for better management of different parsers. Known Bugs: - Uploading a receipt without any fields results in an error. Todo: - Generate a general form if no fields are recognized on the uploaded receipt. - Create form where Admin can confirm receipt invoices. - Display Notification for admin when users upload receipt. - Display Notification for admin on new candidate.
25 lines
919 B
Python
25 lines
919 B
Python
from src import db, ma
|
|
from .item_category import item_category
|
|
|
|
|
|
class Item(db.Model):
|
|
id = db.Column(db.BigInteger, primary_key=True, autoincrement=False)
|
|
name = db.Column(db.String(64), nullable=False)
|
|
brand = db.Column(db.ForeignKey('brand.id'), nullable=False,
|
|
server_onupdate=db.FetchedValue())
|
|
description = db.Column(db.Text, nullable=False)
|
|
|
|
AmountChange = db.relationship(
|
|
"AmountChange", backref='Item', lazy='dynamic')
|
|
Bought = db.relationship("Bought", backref='Item', lazy='dynamic')
|
|
Category = db.relationship(
|
|
"Category", secondary=item_category, lazy="dynamic", back_populates="Item")
|
|
PriceChange = db.relationship(
|
|
"PriceChange", backref='Item', lazy='dynamic')
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<Item {self.id} ({self.name})>"
|
|
|
|
def __str__(self) -> str:
|
|
return f"({self.id}) {self.description}"
|