feat: barcode printing

This commit is contained in:
2025-10-10 23:00:39 +04:00
parent 6b0f8a1aa5
commit 4c871e1e1b
16 changed files with 413 additions and 5 deletions

View File

@ -32,6 +32,12 @@ class BarcodeTemplateRepository(
.order_by(BarcodeTemplate.id)
)
def _process_get_by_id_stmt(self, stmt: Select) -> Select:
return stmt.options(
selectinload(BarcodeTemplate.attributes),
joinedload(BarcodeTemplate.size),
)
async def _get_size_by_id(self, size_id: int) -> Optional[BarcodeTemplateSize]:
stmt = select(BarcodeTemplateSize).where(BarcodeTemplateSize.id == size_id)
result = await self.session.scalars(stmt)

View File

@ -1,7 +1,7 @@
from sqlalchemy import or_, delete
from sqlalchemy.orm import selectinload
from sqlalchemy.orm import selectinload, joinedload
from modules.fulfillment_base.models import Product, ProductBarcode
from modules.fulfillment_base.models import Product, ProductBarcode, BarcodeTemplate
from modules.fulfillment_base.schemas.product import (
CreateProductSchema,
UpdateProductSchema,
@ -55,7 +55,13 @@ class ProductRepository(
return list(result.scalars().all()), total_items
def _process_get_by_id_stmt(self, stmt: Select) -> Select:
return stmt.options(selectinload(Product.barcodes))
return stmt.options(
selectinload(Product.barcodes),
joinedload(Product.client),
joinedload(Product.barcode_template).selectinload(
BarcodeTemplate.attributes
),
)
async def _after_create(self, product: Product, data: CreateProductSchema) -> None:
new_barcodes = [