fix: bill of payment generation refactoring

This commit is contained in:
2024-09-20 20:14:02 +04:00
parent 5316f7f9ce
commit e6cb771db0
3 changed files with 131 additions and 135 deletions

View File

@@ -1,16 +1,15 @@
from io import BytesIO
from pathlib import Path
from typing import List
from fastapi import HTTPException
from jinja2 import Environment, FileSystemLoader
from number_to_string import get_string_by_number
from sqlalchemy import select
from sqlalchemy.orm import selectinload
from starlette import status
from weasyprint import HTML
from weasyprint import HTML, CSS
import backend.config
import constants
from constants import MONTHS, ENV
from external.billing import BillingClient, CreateBillingRequestValue, CreateBillRequestSchema, CreateBillRequestItems, \
BillStatusUpdateRequest, NotificationChannel, NotifyReceivedBillRequestSchema, DeleteBillRequestSchema
@@ -195,6 +194,6 @@ class BillingService(BaseService):
async def create_billing_document_pdf(self, deal_id) -> BytesIO:
doc = await self._create_billing_document_html(deal_id)
pdf_file = BytesIO()
HTML(string=doc).write_pdf(pdf_file)
HTML(string=doc).write_pdf(pdf_file, stylesheets=[CSS(constants.APP_PATH + '/static/css/bill-of-payment.css')])
return pdf_file