1
This commit is contained in:
@@ -79,29 +79,29 @@ def _invoice_to_out(invoice: Invoice, orders: list[InvoiceOrder]) -> dict:
|
|||||||
"""将 Invoice ORM 对象转换为响应 dict。"""
|
"""将 Invoice ORM 对象转换为响应 dict。"""
|
||||||
return {
|
return {
|
||||||
"id": invoice.id,
|
"id": invoice.id,
|
||||||
"userId": invoice.user_id,
|
"user_id": invoice.user_id,
|
||||||
"invoiceNo": invoice.invoice_no,
|
"invoice_no": invoice.invoice_no,
|
||||||
"headerType": invoice.header_type,
|
"header_type": invoice.header_type,
|
||||||
"headerName": invoice.header_name,
|
"header_name": invoice.header_name,
|
||||||
"headerTaxNo": invoice.header_tax_no,
|
"header_tax_no": invoice.header_tax_no,
|
||||||
"headerRegisterAddress": invoice.header_register_address,
|
"header_register_address": invoice.header_register_address,
|
||||||
"headerRegisterPhone": invoice.header_register_phone,
|
"header_register_phone": invoice.header_register_phone,
|
||||||
"headerBankName": invoice.header_bank_name,
|
"header_bank_name": invoice.header_bank_name,
|
||||||
"headerBankAccount": invoice.header_bank_account,
|
"header_bank_account": invoice.header_bank_account,
|
||||||
"email": invoice.email,
|
"email": invoice.email,
|
||||||
"totalAmount": round(float(invoice.total_amount), 2),
|
"total_amount": round(float(invoice.total_amount), 2),
|
||||||
"totalCredits": round(float(invoice.total_credits), 2),
|
"total_credits": round(float(invoice.total_credits), 2),
|
||||||
"status": invoice.status,
|
"status": invoice.status,
|
||||||
"failureReason": invoice.failure_reason,
|
"failure_reason": invoice.failure_reason,
|
||||||
"issuedAt": invoice.issued_at.isoformat() if invoice.issued_at else None,
|
"issued_at": invoice.issued_at.isoformat() if invoice.issued_at else None,
|
||||||
"createdAt": invoice.created_at.isoformat() if invoice.created_at else None,
|
"created_at": invoice.created_at.isoformat() if invoice.created_at else None,
|
||||||
"updatedAt": invoice.updated_at.isoformat() if invoice.updated_at else None,
|
"updated_at": invoice.updated_at.isoformat() if invoice.updated_at else None,
|
||||||
"orders": [
|
"orders": [
|
||||||
{
|
{
|
||||||
"id": o.id,
|
"id": o.id,
|
||||||
"invoiceId": o.invoice_id,
|
"invoice_id": o.invoice_id,
|
||||||
"orderId": o.order_id,
|
"order_id": o.order_id,
|
||||||
"orderNo": o.order_no,
|
"order_no": o.order_no,
|
||||||
"amount": round(float(o.amount), 2),
|
"amount": round(float(o.amount), 2),
|
||||||
"credits": round(float(o.credits), 2),
|
"credits": round(float(o.credits), 2),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user