feat: barcode printing
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user