commit 91fec1a5bf75a41d949712947b02679af550cfe2 Author: Suherdy Yacob Date: Fri Jun 12 11:11:20 2026 +0700 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d646835 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pyc +__pycache__/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..da2db5f --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +POS Reprint Receipt from Backend + +This module allows users to reprint the bill/receipt for completed POS Orders directly from the backend Odoo form view. + +Features + +- Adds a Reprint Receipt button on the backend POS Order form view. +- The button is visible for orders that are already paid or posted (states Paid or Posted). +- Displays a QWeb HTML report styled as an 80mm thermal receipt, matching the layout of the checkout receipt. +- Shows company logo, config header/footer, cashier, order name, table/guest details, order line details, totals, payments, change, and taxes. + +Usage + +1. Navigate to Point of Sale -> Orders -> Orders. +2. Open any completed order (state Paid or Posted). +3. Click the Reprint Receipt button in the status header. +4. The print preview dialog of your browser will open with the receipt formatted for 80mm thermal printers. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..a0fdc10 --- /dev/null +++ b/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/__manifest__.py b/__manifest__.py new file mode 100644 index 0000000..29c5d0d --- /dev/null +++ b/__manifest__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +{ + 'name': 'POS Reprint Receipt from Backend', + 'version': '1.0.0', + 'category': 'Point of Sale', + 'summary': 'Add button to reprint POS order receipt/bill from the backend form view.', + 'description': """ +This module adds a "Reprint Receipt" button on the backend POS Order form view. +When clicked, it opens a QWeb HTML report styled as an 80mm thermal receipt, mimicking the layout of the checkout receipt. + """, + 'author': 'Suherdy Yacob', + 'depends': [ + 'point_of_sale', + ], + 'data': [ + 'report/pos_order_report.xml', + 'views/pos_order_views.xml', + ], + 'installable': True, + 'application': False, + 'auto_install': False, + 'license': 'LGPL-3', +} diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..9e9e7ad --- /dev/null +++ b/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import pos_order diff --git a/models/pos_order.py b/models/pos_order.py new file mode 100644 index 0000000..74ae159 --- /dev/null +++ b/models/pos_order.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models + +class PosOrder(models.Model): + _inherit = 'pos.order' + + def get_receipt_tax_details(self): + self.ensure_one() + tax_map = {} + for line in self.lines: + price_unit = line.price_unit * (1 - (line.discount or 0.0) / 100.0) + line_taxes = line.tax_ids_after_fiscal_position.compute_all( + price_unit, + self.currency_id, + line.qty, + product=line.product_id, + partner=self.partner_id + ) + for tax in line_taxes.get('taxes', []): + tax_id = tax['id'] + if tax_id not in tax_map: + tax_map[tax_id] = { + 'name': tax['name'], + 'amount': 0.0, + 'base': 0.0, + } + tax_map[tax_id]['amount'] += tax['amount'] + tax_map[tax_id]['base'] += tax['base'] + return list(tax_map.values()) + + def get_order_name(self): + self.ensure_one() + name = self.floating_order_name or "" + if self.is_refund: + name += " (Refund)" + return name diff --git a/report/pos_order_report.xml b/report/pos_order_report.xml new file mode 100644 index 0000000..0851b23 --- /dev/null +++ b/report/pos_order_report.xml @@ -0,0 +1,211 @@ + + + + + + POS Reprint Receipt (80mm) + + custom + 80 + 297 + Portrait + 3 + 3 + 3 + 3 + + 3 + 96 + + + + + Reprint Receipt + pos.order + qweb-html + pos_reprint_receipt.report_pos_order_reprint + pos_reprint_receipt.report_pos_order_reprint + + + report + + + + + + diff --git a/views/pos_order_views.xml b/views/pos_order_views.xml new file mode 100644 index 0000000..28b472a --- /dev/null +++ b/views/pos_order_views.xml @@ -0,0 +1,19 @@ + + + + + pos.order.form.reprint.receipt + pos.order + + + +