From df6e2e7fb1f15ccb2c88b48d7613182a12e13213 Mon Sep 17 00:00:00 2001 From: fakz9 Date: Fri, 29 Mar 2024 21:39:44 +0300 Subject: [PATCH] othr --- models/product.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/models/product.py b/models/product.py index e4439da..6e69ca7 100644 --- a/models/product.py +++ b/models/product.py @@ -12,4 +12,12 @@ class Product(BaseModel): client_id = Column(Integer, ForeignKey('clients.id'), nullable=False, comment='ID сделки') client = relationship('Client', back_populates='products') + barcodes = relationship('ProductBarcode', back_populates='product') + +class ProductBarcode(BaseModel): + __tablename__ = 'product_barcodes' + product_id = Column(Integer, ForeignKey('products.id'), nullable=False, comment='ID товара', primary_key=True) + product = relationship('Product', back_populates='barcodes') + + barcode = Column(String, nullable=False, index=True, comment='ШК товара')