feat: DRAFT watermark on certificates of unsubmitted invoices

Both copies are stamped while the Purchase Invoice is a draft; the
rgba colour keeps the form legible since wkhtmltopdf drops opacity on
transformed elements.
This commit is contained in:
kurogeek committed 2026-09-23 03:22:02 +00:00
1 parent baff8de0d3
commit e82d82dbcc
2 files changed
+5 -2

No files matched your search

@@ -104,7 +104,7 @@
{ {
"absolute_value": 0, "absolute_value": 0,
"align_labels_right": 0, "align_labels_right": 0,
"css": "/* Thai text needs a font with Thai glyphs; ship Sarabun as in Default Standard Sales Invoice. */\n@font-face {\n\tfont-family: \"Sarabun\";\n\tfont-weight: 400;\n\tsrc: url(\"/assets/default_thai_company/fonts/Sarabun-Regular.ttf\");\n}\n@font-face {\n\tfont-family: \"Sarabun\";\n\tfont-weight: 700;\n\tsrc: url(\"/assets/default_thai_company/fonts/Sarabun-Bold.ttf\");\n}\n\n/* The Revenue Department form fills the whole A4 sheet: no page margins. frappe.utils.pdf reads\n these .print-format properties as the wkhtmltopdf page options. */\n.print-format {\n\tmargin-top: 0mm;\n\tmargin-bottom: 0mm;\n\tmargin-left: 0mm;\n\tmargin-right: 0mm;\n\tpage-size: A4;\n}\n/* On screen the standard sheet padding would clip the 595pt form. */\n@media screen {\n\t.print-format {\n\t\tpadding: 0;\n\t\tmax-width: 595pt;\n\t\tmin-height: 0;\n\t}\n}\n\n/* One sheet per copy; values are positioned in pt against the form's PDF coordinates. */\n.wht-page {\n\tposition: relative;\n\twidth: 595pt;\n\theight: 841pt;\n\toverflow: hidden;\n\tpage-break-after: always;\n\tfont-family: Sarabun, sans-serif;\n\tfont-size: 10pt;\n\tcolor: #000;\n}\n.wht-page:last-child {\n\tpage-break-after: auto;\n}\n.wht-form {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n.wht-page .f {\n\tposition: absolute;\n\twhite-space: nowrap;\n\toverflow: hidden;\n}\n/* Check mark drawn in CSS: the shipped font has no U+2713 and the PDF renderer sees no system fonts. */\n.wht-page .tick {\n\tposition: absolute;\n}\n.wht-page .tick:after {\n\tcontent: \"\";\n\tposition: absolute;\n\tleft: 4pt;\n\ttop: 0;\n\twidth: 4pt;\n\theight: 8pt;\n\tborder: solid #000;\n\tborder-width: 0 1.5pt 1.5pt 0;\n\t-webkit-transform: rotate(45deg);\n\ttransform: rotate(45deg);\n}", "css": "/* Thai text needs a font with Thai glyphs; ship Sarabun as in Default Standard Sales Invoice. */\n@font-face {\n\tfont-family: \"Sarabun\";\n\tfont-weight: 400;\n\tsrc: url(\"/assets/default_thai_company/fonts/Sarabun-Regular.ttf\");\n}\n@font-face {\n\tfont-family: \"Sarabun\";\n\tfont-weight: 700;\n\tsrc: url(\"/assets/default_thai_company/fonts/Sarabun-Bold.ttf\");\n}\n\n/* The Revenue Department form fills the whole A4 sheet: no page margins. frappe.utils.pdf reads\n these .print-format properties as the wkhtmltopdf page options. */\n.print-format {\n\tmargin-top: 0mm;\n\tmargin-bottom: 0mm;\n\tmargin-left: 0mm;\n\tmargin-right: 0mm;\n\tpage-size: A4;\n}\n/* On screen the standard sheet padding would clip the 595pt form. */\n@media screen {\n\t.print-format {\n\t\tpadding: 0;\n\t\tmax-width: 595pt;\n\t\tmin-height: 0;\n\t}\n}\n\n/* One sheet per copy; values are positioned in pt against the form's PDF coordinates. */\n.wht-page {\n\tposition: relative;\n\twidth: 595pt;\n\theight: 841pt;\n\toverflow: hidden;\n\tpage-break-after: always;\n\tfont-family: Sarabun, sans-serif;\n\tfont-size: 10pt;\n\tcolor: #000;\n}\n.wht-page:last-child {\n\tpage-break-after: auto;\n}\n.wht-form {\n\tposition: absolute;\n\tleft: 0;\n\ttop: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n.wht-page .f {\n\tposition: absolute;\n\twhite-space: nowrap;\n\toverflow: hidden;\n}\n/* Check mark drawn in CSS: the shipped font has no U+2713 and the PDF renderer sees no system fonts. */\n.wht-page .tick {\n\tposition: absolute;\n}\n.wht-page .tick:after {\n\tcontent: \"\";\n\tposition: absolute;\n\tleft: 4pt;\n\ttop: 0;\n\twidth: 4pt;\n\theight: 8pt;\n\tborder: solid #000;\n\tborder-width: 0 1.5pt 1.5pt 0;\n\t-webkit-transform: rotate(45deg);\n\ttransform: rotate(45deg);\n}\n\n/* Unsubmitted invoice: stamp every copy so a preview cannot pass for a certificate. */\n.wht-page .wht-draft {\n\tposition: absolute;\n\tleft: 0;\n\t/* a square centred on the sheet: the rotated text stays inside its own box */\n\ttop: 123pt;\n\twidth: 595pt;\n\theight: 595pt;\n\tline-height: 595pt;\n\ttext-align: center;\n\tfont-size: 120pt;\n\tfont-weight: 700;\n\tletter-spacing: 6pt;\n\t/* wkhtmltopdf drops opacity on transformed elements; an rgba colour keeps the form legible */\n\tcolor: rgba(204, 0, 0, 0.3);\n\t-webkit-transform: rotate(-35deg);\n\ttransform: rotate(-35deg);\n}",
"custom_format": 1, "custom_format": 1,
"default_print_language": null, "default_print_language": null,
"disabled": 0, "disabled": 0,
@@ -120,7 +120,7 @@
"margin_left": 0.0, "margin_left": 0.0,
"margin_right": 0.0, "margin_right": 0.0,
"margin_top": 0.0, "margin_top": 0.0,
"modified": "2026-09-22 09:00:00.000000", "modified": "2026-09-23 11:00:00.000000",
"module": "Default Thai Company", "module": "Default Thai Company",
"name": "Withholding Tax Certificate", "name": "Withholding Tax Certificate",
"page_number": "Hide", "page_number": "Hide",
@@ -53,6 +53,9 @@
{%- for _ in range(2) -%} {%- for _ in range(2) -%}
<div class="wht-page"> <div class="wht-page">
<img class="wht-form" src="/assets/default_thai_company/images/withholding_tax_certificate.png" alt=""> <img class="wht-form" src="/assets/default_thai_company/images/withholding_tax_certificate.png" alt="">
{%- if doc.docstatus == 0 %}
<div class="wht-draft">DRAFT</div>
{%- endif %}
{#- Invoice reference in the top-right margin; เล่มที่ / เลขที่ are the certificate book's numbers. -#} {#- Invoice reference in the top-right margin; เล่มที่ / เลขที่ are the certificate book's numbers. -#}
{{ box((400, 821, 560, 835), doc.name, "right", 8) }} {{ box((400, 821, 560, 835), doc.name, "right", 8) }}