diff --git a/README.md b/README.md index 600ac2f..379be71 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ This custom module is designed for Odoo 19 to override and customize the standar 2. **Custom Ticket Prefix:** Replaces the default "Ticket" text prefix with "NO" on the main receipt reference sequence (e.g., instead of "Ticket 0001", it prints "NO 0001"). -3. **Hide Cashier Name:** - Hides the "Served by: [Cashier Name]" section from the receipt header for a cleaner look. +3. **Custom "Pro Forma" Text:** + When using the Early Receipt or Bill printing feature (before payment is finalized), Odoo natively prints "Pro forma receipt". This module replaces that text with an attention-grabbing **"!!! INI ADALAH TAGIHAN SEMENTARA, BUKAN BUKTI PEMBAYARAN !!!"**. -4. **Custom "Pro Forma" Text:** - When using the Early Receipt or Bill printing feature (before payment is finalized), Odoo natively prints "Pro forma receipt". This module replaces that text with an attention-grabbing **"!!! INI ADALAH TAGIHAN SEMENTARA, BUKAN BUKTI PEMBAYARAN !!!"**. Furthermore, this text is explicitly hidden when printing a Basic Receipt (gift receipt without prices). +4. **Basic Receipt Improvements:** + When printing a Basic Receipt (e.g. gift receipt without prices), this module hides the receipt header, footer, and the "Pro Forma" text. It also ensures that both the **Customer Note** and the **Internal Note** are fully visible. 5. **Address & Email Removal:** Hides the detailed company/branch address and the company email from the receipt footer, keeping the receipt concise. @@ -25,6 +25,9 @@ This custom module is designed for Odoo 19 to override and customize the standar 7. **Remove Odoo Branding:** Hides the "Powered by Odoo" text and logo from the bottom of the receipt footer. +8. **Print Margin Adjustments:** + Removes the top, right, and bottom margins from the print page so the content aligns closely with the paper edges, while preserving the default left margin. + ## Technical Details The module utilizes Odoo's OWL `xpath` inheritance mechanism to modify the front-end QWeb templates dynamically. diff --git a/__manifest__.py b/__manifest__.py index 60a9811..52fdc72 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -12,11 +12,12 @@ This module customizes the printed receipt in the Point of Sale module to match Key Features: - **Tracking Number**: Hides the tracking number in the receipt header. - **Ticket Prefix**: Changes the "Ticket" prefix to "NO" in the header reference. -- **Cashier Name**: Hides the "Served by" (cashier name) in the receipt header. - **Address & Email**: Hides the company/branch address and email in the receipt footer. - **Phone Prefix**: Changes the "Tel:" prefix to "Contact:" for the company phone number in the footer. -- **Pro Forma Receipt**: Changes the default "Pro forma receipt" text to "!!! INI ADALAH TAGIHAN SEMENTARA, BUKAN BUKTI PEMBAYARAN !!!" for early/unpaid bills, and explicitly hides this text when printing a Basic Receipt. +- **Pro Forma Receipt**: Changes the default "Pro forma receipt" text to "!!! INI ADALAH TAGIHAN SEMENTARA, BUKAN BUKTI PEMBAYARAN !!!" for early/unpaid bills. +- **Basic Receipt Improvements**: Hides the "Pro forma receipt" text, receipt header, and receipt footer on Basic Receipts. Ensures both Customer Notes and Internal Notes are fully visible on the printed Basic Receipt. - **Odoo Branding**: Removes the "Powered by Odoo" text in the receipt footer. +- **Print Margin**: Removes the top, right, and bottom margins from the print page, ensuring the content aligns closely with the paper edges while keeping the default left margin. """, 'depends': ['point_of_sale', 'pos_restaurant'], 'data': [], @@ -24,6 +25,7 @@ Key Features: 'point_of_sale._assets_pos': [ 'pos_custom_receipt/static/src/xml/receipt_overrides.xml', 'pos_custom_receipt/static/src/css/receipt.css', + 'pos_custom_receipt/static/src/js/orderline.js', ], }, 'installable': True, diff --git a/static/src/css/receipt.css b/static/src/css/receipt.css index 3aebba3..0a9a8ed 100644 --- a/static/src/css/receipt.css +++ b/static/src/css/receipt.css @@ -1,13 +1,17 @@ @media print { @page { - margin: 0 !important; + margin-top: 0 !important; + margin-right: 0 !important; + margin-bottom: 0 !important; } body, html { margin: 0 !important; padding: 0 !important; } .pos-receipt { - padding: 0 !important; + padding-top: 0 !important; + padding-right: 0 !important; + padding-bottom: 0 !important; margin: 0 !important; width: 100% !important; max-width: 100% !important; @@ -15,6 +19,8 @@ } .pos-receipt { - padding: 0 !important; + padding-top: 0 !important; + padding-right: 0 !important; + padding-bottom: 0 !important; margin: 0 !important; } diff --git a/static/src/js/orderline.js b/static/src/js/orderline.js new file mode 100644 index 0000000..1c9934d --- /dev/null +++ b/static/src/js/orderline.js @@ -0,0 +1,20 @@ +/** @odoo-module */ + +import { patch } from "@web/core/utils/patch"; +import { Orderline } from "@point_of_sale/app/components/orderline/orderline"; + +patch(Orderline.prototype, { + get lineScreenValues() { + const res = super.lineScreenValues; + // In POS, the internal note (line.note) is typically shown only in display mode. + // We override this to also include the parsed internalNote when printing receipts. + if (this.props.mode === "receipt" && this.line.note) { + try { + res.internalNote = JSON.parse(this.line.note); + } catch (e) { + res.internalNote = [{ text: this.line.note }]; // Fallback if not valid JSON + } + } + return res; + } +}); diff --git a/static/src/xml/receipt_overrides.xml b/static/src/xml/receipt_overrides.xml index 6729d95..a3ee4d9 100644 --- a/static/src/xml/receipt_overrides.xml +++ b/static/src/xml/receipt_overrides.xml @@ -15,18 +15,27 @@ - - -
-
- + - pos-receipt p-0 m-0 + pos-receipt pt-0 pe-0 pb-0 ps-2 m-0 + + + + + !props.basic_receipt + + + + +
  • + + +
  • @@ -56,6 +65,20 @@ + + + !props.basic_receipt and order.config.receipt_footer + + + !props.basic_receipt + + + !props.basic_receipt and order.shipping_date + + + !props.basic_receipt + +