feat: spacers between barcodes of diff products, avoid product cut in deal document, deal document refactoring

This commit is contained in:
2024-09-30 01:36:31 +04:00
parent 413d8755cc
commit 61d379e7dc
9 changed files with 271 additions and 240 deletions

View File

@@ -1,4 +1,5 @@
from typing import Dict
from io import BytesIO
from typing import Dict, Tuple
from sqlalchemy import select, update, insert
from sqlalchemy.orm import selectinload, joinedload
@@ -76,8 +77,7 @@ class BarcodeService(BaseService):
)
return GetProductBarcodeResponse(barcode=barcode)
async def get_barcode_pdf(self, request: GetProductBarcodePdfRequest) -> GetProductBarcodeResponse:
# get product by id
async def get_barcode_pdf(self, request: GetProductBarcodePdfRequest) -> Tuple[str, BytesIO]:
stmt = (
select(Product)
.options(
@@ -102,7 +102,7 @@ class BarcodeService(BaseService):
)
return filename, pdf_buffer
async def get_deal_barcodes_pdf(self, request: GetDealProductsBarcodesPdfRequest) -> GetProductBarcodeResponse:
async def get_deal_barcodes_pdf(self, request: GetDealProductsBarcodesPdfRequest) -> Tuple[str, BytesIO]:
stmt = (
select(Deal)
.options(

View File

@@ -1036,7 +1036,7 @@ class DealService(BaseService):
last_status: DealStatusHistory = max(deal.status_history, key=lambda status: status.changed_at)
general_services_total = sum((service.price * service.quantity for service in deal.services))
product_services_totals: List[Dict[str, int]] = await self._get_product_services_totals(deal)
template = ENV.get_template("deal.html")
template = ENV.get_template("deal/deal.html")
product_urls: List[Optional[str]] = []
for product in deal.products: