feat: spacers between barcodes of diff products, avoid product cut in deal document, deal document refactoring
This commit is contained in:
		@@ -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(
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user