fix: removed all prices from deal document

This commit is contained in:
2024-10-29 02:45:23 +04:00
parent 750913d3a6
commit cbe3697f1b
4 changed files with 11 additions and 29 deletions

View File

@@ -16,17 +16,6 @@ class DealPdfGenerator:
def __init__(self, session: AsyncSession):
self._session = session
@staticmethod
async def _get_product_services_totals(deal: Deal) -> List[Dict[str, int]]:
totals: List[Dict[str, int]] = []
for product in deal.products:
total_one_product = sum((service.price for service in product.services))
total = total_one_product * product.quantity
totals.append({"total_one_product": total_one_product, "total": total})
return totals
@staticmethod
async def _group_deal_products_by_products(deal_products: List[DealProduct]) -> Dict[str, DocumentDealProductData]:
products: Dict[str, DocumentDealProductData] = {}
@@ -39,10 +28,8 @@ class DealPdfGenerator:
)
if key not in products:
total_one_product = sum(service.price for service in deal_product.services)
products[key] = {
"deal_products": [deal_product],
"total_one_product": total_one_product,
"quantity": deal_product.quantity,
"additional_info": deal_product.product.additional_info,
}
@@ -83,7 +70,6 @@ class DealPdfGenerator:
document_deal_data = {
"deal": deal,
"general_services_total": sum((service.price * service.quantity for service in deal.services)),
"products": products,
"current_status_str": DEAL_STATUS_STR[deal.current_status],
"last_status": max(deal.status_history, key=lambda status: status.changed_at),