Force remove page padding with css & Hide more elements

This commit is contained in:
Abdul Aziz Amrullah 2026-05-22 14:48:32 +07:00
parent b20c84e2b1
commit 973d4d1e70
4 changed files with 49 additions and 3 deletions

View File

@ -10,13 +10,19 @@ This custom module is designed for Odoo 19 to override and customize the standar
2. **Custom Ticket Prefix:** 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"). 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. **Custom "Pro Forma" Text:** 3. **Hide Cashier Name:**
Hides the "Served by: [Cashier Name]" section from the receipt header for a cleaner look.
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). 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. **Address & Email Removal:** 5. **Address & Email Removal:**
Hides the detailed company/branch address and the company email from the receipt footer, keeping the receipt concise. Hides the detailed company/branch address and the company email from the receipt footer, keeping the receipt concise.
5. **Remove Odoo Branding:** 6. **Custom Phone Prefix:**
Retains the company phone number in the footer but changes its prefix from the default "Tel:" to "Contact:".
7. **Remove Odoo Branding:**
Hides the "Powered by Odoo" text and logo from the bottom of the receipt footer. Hides the "Powered by Odoo" text and logo from the bottom of the receipt footer.
## Technical Details ## Technical Details

View File

@ -12,7 +12,9 @@ This module customizes the printed receipt in the Point of Sale module to match
Key Features: Key Features:
- **Tracking Number**: Hides the tracking number in the receipt header. - **Tracking Number**: Hides the tracking number in the receipt header.
- **Ticket Prefix**: Changes the "Ticket" prefix to "NO" in the header reference. - **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. - **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, and explicitly hides this text when printing a Basic Receipt.
- **Odoo Branding**: Removes the "Powered by Odoo" text in the receipt footer. - **Odoo Branding**: Removes the "Powered by Odoo" text in the receipt footer.
""", """,
@ -21,6 +23,7 @@ Key Features:
'assets': { 'assets': {
'point_of_sale._assets_pos': [ 'point_of_sale._assets_pos': [
'pos_custom_receipt/static/src/xml/receipt_overrides.xml', 'pos_custom_receipt/static/src/xml/receipt_overrides.xml',
'pos_custom_receipt/static/src/css/receipt.css',
], ],
}, },
'installable': True, 'installable': True,

View File

@ -0,0 +1,20 @@
@media print {
@page {
margin: 0 !important;
}
body, html {
margin: 0 !important;
padding: 0 !important;
}
.pos-receipt {
padding: 0 !important;
margin: 0 !important;
width: 100% !important;
max-width: 100% !important;
}
}
.pos-receipt {
padding: 0 !important;
margin: 0 !important;
}

View File

@ -14,11 +14,21 @@
NO NO
</span> </span>
</xpath> </xpath>
<!-- Hide Cashier (Served by) -->
<xpath expr="//div[hasclass('cashier')]" position="replace">
<div class="cashier d-none"></div>
</xpath>
</t> </t>
<!-- Hide Address, Phone, Email, and Powered By from Receipt Footer --> <!-- Hide Address, Phone, Email, and Powered By from Receipt Footer -->
<t t-name="pos_custom_receipt.OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension"> <t t-name="pos_custom_receipt.OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension">
<!-- Remove padding and margin from main receipt container -->
<xpath expr="//div[hasclass('pos-receipt')]" position="attributes">
<attribute name="class">pos-receipt p-0 m-0</attribute>
</xpath>
<!-- Hide Address (Branch Address) --> <!-- Hide Address (Branch Address) -->
<xpath expr="//div[hasclass('w-50', 'text-start')]/div[2]" position="replace"> <xpath expr="//div[hasclass('w-50', 'text-start')]/div[2]" position="replace">
<!-- Branch address is hidden --> <!-- Branch address is hidden -->
@ -29,6 +39,13 @@
<div t-if="!order.finalized and !props.basic_receipt" class="fs-2 mb-1">BELUM DIBAYAR !!!</div> <div t-if="!order.finalized and !props.basic_receipt" class="fs-2 mb-1">BELUM DIBAYAR !!!</div>
</xpath> </xpath>
<!-- Change 'Tel:' to 'Contact:' -->
<xpath expr="//div[@t-if='company.phone']" position="replace">
<div t-if="company.phone">
Contact: <t t-out="company.phone"/>
</div>
</xpath>
<!-- Hide Email --> <!-- Hide Email -->
<xpath expr="//div[@t-if='company.email']" position="replace"> <xpath expr="//div[@t-if='company.email']" position="replace">
<!-- Email is hidden --> <!-- Email is hidden -->