后台成本价、销售价、利润点按费用逐行展示,费用合计用报价官方总价。选完线路只关页面。报价单文件名带上模板名,空运起运地和转人工跟对应工单走。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""系统报价单对外文件名:工单号接后台模板名,并带文件后缀。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||
if ROOT not in sys.path:
|
||||
sys.path.insert(0, ROOT)
|
||||
|
||||
from agent.quote_templates.filename import filename_from_render, quote_sheet_filename
|
||||
|
||||
|
||||
class QuoteSheetFilenameTests(unittest.TestCase):
|
||||
def test_joins_work_order_and_backend_template_name(self) -> None:
|
||||
self.assertEqual(
|
||||
quote_sheet_filename("WO202609100001", "陆运国内运输拼车报价单"),
|
||||
"WO202609100001陆运国内运输拼车报价单.xlsx",
|
||||
)
|
||||
|
||||
def test_drops_suffix_on_template_name(self) -> None:
|
||||
self.assertEqual(
|
||||
quote_sheet_filename("WO202609100001", "海运报价单模板.xlsx"),
|
||||
"WO202609100001海运报价单模板.xlsx",
|
||||
)
|
||||
|
||||
def test_pdf_uses_pdf_suffix(self) -> None:
|
||||
self.assertEqual(
|
||||
quote_sheet_filename("WO202609100001", "默认空运", suffix=".pdf"),
|
||||
"WO202609100001默认空运.pdf",
|
||||
)
|
||||
|
||||
def test_render_prefers_template_name_over_old_file_name(self) -> None:
|
||||
shown = filename_from_render(
|
||||
"WO202609100001",
|
||||
{
|
||||
"templateName": "国内运输拼车报价单",
|
||||
"fileName": "WO202609100001_quote.xlsx",
|
||||
},
|
||||
)
|
||||
self.assertEqual(shown, "WO202609100001国内运输拼车报价单.xlsx")
|
||||
|
||||
def test_blank_template_keeps_xlsx_suffix(self) -> None:
|
||||
shown = filename_from_render(
|
||||
"WO202609100001",
|
||||
{"fileName": "WO202609100001_quote.xlsx"},
|
||||
)
|
||||
self.assertEqual(shown, "WO202609100001_quote.xlsx")
|
||||
Reference in New Issue
Block a user