fix: removed all prices from deal document
This commit is contained in:
		@@ -16,17 +16,6 @@ class DealPdfGenerator:
 | 
				
			|||||||
    def __init__(self, session: AsyncSession):
 | 
					    def __init__(self, session: AsyncSession):
 | 
				
			||||||
        self._session = session
 | 
					        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
 | 
					    @staticmethod
 | 
				
			||||||
    async def _group_deal_products_by_products(deal_products: List[DealProduct]) -> Dict[str, DocumentDealProductData]:
 | 
					    async def _group_deal_products_by_products(deal_products: List[DealProduct]) -> Dict[str, DocumentDealProductData]:
 | 
				
			||||||
        products: Dict[str, DocumentDealProductData] = {}
 | 
					        products: Dict[str, DocumentDealProductData] = {}
 | 
				
			||||||
@@ -39,10 +28,8 @@ class DealPdfGenerator:
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if key not in products:
 | 
					            if key not in products:
 | 
				
			||||||
                total_one_product = sum(service.price for service in deal_product.services)
 | 
					 | 
				
			||||||
                products[key] = {
 | 
					                products[key] = {
 | 
				
			||||||
                    "deal_products": [deal_product],
 | 
					                    "deal_products": [deal_product],
 | 
				
			||||||
                    "total_one_product": total_one_product,
 | 
					 | 
				
			||||||
                    "quantity": deal_product.quantity,
 | 
					                    "quantity": deal_product.quantity,
 | 
				
			||||||
                    "additional_info": deal_product.product.additional_info,
 | 
					                    "additional_info": deal_product.product.additional_info,
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -83,7 +70,6 @@ class DealPdfGenerator:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        document_deal_data = {
 | 
					        document_deal_data = {
 | 
				
			||||||
            "deal": deal,
 | 
					            "deal": deal,
 | 
				
			||||||
            "general_services_total": sum((service.price * service.quantity for service in deal.services)),
 | 
					 | 
				
			||||||
            "products": products,
 | 
					            "products": products,
 | 
				
			||||||
            "current_status_str": DEAL_STATUS_STR[deal.current_status],
 | 
					            "current_status_str": DEAL_STATUS_STR[deal.current_status],
 | 
				
			||||||
            "last_status": max(deal.status_history, key=lambda status: status.changed_at),
 | 
					            "last_status": max(deal.status_history, key=lambda status: status.changed_at),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,6 +63,11 @@ hr {
 | 
				
			|||||||
    font-weight: bold;
 | 
					    font-weight: bold;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.product-header-container {
 | 
				
			||||||
 | 
					    page-break-inside: avoid;
 | 
				
			||||||
 | 
					    page-break-after: avoid;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.product-data {
 | 
					.product-data {
 | 
				
			||||||
    height: 130px;
 | 
					    height: 130px;
 | 
				
			||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
@@ -81,6 +86,7 @@ table {
 | 
				
			|||||||
    border-spacing: 0;
 | 
					    border-spacing: 0;
 | 
				
			||||||
    border: solid gray 2px;
 | 
					    border: solid gray 2px;
 | 
				
			||||||
    border-radius: 15px;
 | 
					    border-radius: 15px;
 | 
				
			||||||
 | 
					    margin-bottom: 15px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
thead {
 | 
					thead {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
{% with common_deal_product=product_data.deal_products[0], common_product=product_data.deal_products[0].product %}
 | 
					{% with common_deal_product=product_data.deal_products[0], common_product=product_data.deal_products[0].product %}
 | 
				
			||||||
    <div style="page-break-inside: avoid">
 | 
					    <div style="page-break-inside: avoid">
 | 
				
			||||||
        <!--#region Product header -->
 | 
					        <!--#region Product header -->
 | 
				
			||||||
        <div style="page-break-inside: avoid; page-break-after: avoid">
 | 
					        <div class="product-header-container">
 | 
				
			||||||
            <hr/>
 | 
					            <hr/>
 | 
				
			||||||
            <div style="display: flex">
 | 
					            <div style="display: flex">
 | 
				
			||||||
                <div class="img-container">
 | 
					                <div class="img-container">
 | 
				
			||||||
@@ -85,7 +85,6 @@
 | 
				
			|||||||
                <thead>
 | 
					                <thead>
 | 
				
			||||||
                <tr>
 | 
					                <tr>
 | 
				
			||||||
                    <th>Наименование услуги</th>
 | 
					                    <th>Наименование услуги</th>
 | 
				
			||||||
                    <th>Сумма</th>
 | 
					 | 
				
			||||||
                </tr>
 | 
					                </tr>
 | 
				
			||||||
                <tfoot>
 | 
					                <tfoot>
 | 
				
			||||||
                </tfoot>
 | 
					                </tfoot>
 | 
				
			||||||
@@ -94,15 +93,10 @@
 | 
				
			|||||||
                {% for service in common_deal_product.services %}
 | 
					                {% for service in common_deal_product.services %}
 | 
				
			||||||
                    <tr>
 | 
					                    <tr>
 | 
				
			||||||
                        <td>{{ service.service.name }}</td>
 | 
					                        <td>{{ service.service.name }}</td>
 | 
				
			||||||
                        <td>{{ format_number(service.price * product_data.quantity) }} Р</td>
 | 
					 | 
				
			||||||
                    </tr>
 | 
					                    </tr>
 | 
				
			||||||
                {% endfor %}
 | 
					                {% endfor %}
 | 
				
			||||||
                </tbody>
 | 
					                </tbody>
 | 
				
			||||||
            </table>
 | 
					            </table>
 | 
				
			||||||
            <div class="medium-text total align-right bold">
 | 
					 | 
				
			||||||
                Итого: {{ product_data.total_one_product * product_data.quantity }} Р, за
 | 
					 | 
				
			||||||
                единицу: {{ product_data.total_one_product }} Р
 | 
					 | 
				
			||||||
            </div>
 | 
					 | 
				
			||||||
        {% else %}
 | 
					        {% else %}
 | 
				
			||||||
            <div class="medium-text total align-right bold"></div>
 | 
					            <div class="medium-text total align-right bold"></div>
 | 
				
			||||||
        {% endif %}
 | 
					        {% endif %}
 | 
				
			||||||
@@ -154,6 +148,8 @@
 | 
				
			|||||||
                </tbody>
 | 
					                </tbody>
 | 
				
			||||||
            </table>
 | 
					            </table>
 | 
				
			||||||
            <div style="height: 30px"></div>
 | 
					            <div style="height: 30px"></div>
 | 
				
			||||||
 | 
					        {% else %}
 | 
				
			||||||
 | 
					            <div style="margin-bottom: 40px"></div>
 | 
				
			||||||
        {% endif %}
 | 
					        {% endif %}
 | 
				
			||||||
        <!--#endregion -->
 | 
					        <!--#endregion -->
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,12 +32,11 @@
 | 
				
			|||||||
    <div class="medium-text bold">Склад отгрузки: {{ data.deal.shipping_warehouse.name }}</div>
 | 
					    <div class="medium-text bold">Склад отгрузки: {{ data.deal.shipping_warehouse.name }}</div>
 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
{% if data.deal.services|length > 0 %}
 | 
					{% if data.deal.services|length > 0 %}
 | 
				
			||||||
    <table>
 | 
					    <table style="margin-bottom: 40px">
 | 
				
			||||||
        <thead>
 | 
					        <thead>
 | 
				
			||||||
        <tr>
 | 
					        <tr>
 | 
				
			||||||
            <th>Общие услуги</th>
 | 
					            <th>Общие услуги</th>
 | 
				
			||||||
            <th>Количество</th>
 | 
					            <th>Количество</th>
 | 
				
			||||||
            <th>Сумма</th>
 | 
					 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
        <tfoot>
 | 
					        <tfoot>
 | 
				
			||||||
        </tfoot>
 | 
					        </tfoot>
 | 
				
			||||||
@@ -47,16 +46,11 @@
 | 
				
			|||||||
            <tr>
 | 
					            <tr>
 | 
				
			||||||
                <td>{{ service.service.name }}</td>
 | 
					                <td>{{ service.service.name }}</td>
 | 
				
			||||||
                <td>{{ '{:,}'.format(service.quantity) }} шт.</td>
 | 
					                <td>{{ '{:,}'.format(service.quantity) }} шт.</td>
 | 
				
			||||||
                <td>{{ '{:,}'.format(service.price * service.quantity).replace(',', ' ') }} Р</td>
 | 
					 | 
				
			||||||
            </tr>
 | 
					            </tr>
 | 
				
			||||||
        {% endfor %}
 | 
					        {% endfor %}
 | 
				
			||||||
        </tbody>
 | 
					        </tbody>
 | 
				
			||||||
    </table>
 | 
					    </table>
 | 
				
			||||||
    <div class="medium-text total align-right bold">
 | 
					 | 
				
			||||||
        Итого: {{ data.general_services_total }} Р
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
{% else %}
 | 
					{% else %}
 | 
				
			||||||
    <div class="medium-text total align-right bold">
 | 
					    <div style="margin-bottom: 40px"></div>
 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
<!--#endregion -->
 | 
					<!--#endregion -->
 | 
				
			||||||
		Reference in New Issue
	
	Block a user