diff --git a/pos_reciept_customize/__init__.py b/pos_reciept_customize/__init__.py new file mode 100644 index 00000000000..33bbab569d0 --- /dev/null +++ b/pos_reciept_customize/__init__.py @@ -0,0 +1,4 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models +from . import wizard diff --git a/pos_reciept_customize/__manifest__.py b/pos_reciept_customize/__manifest__.py new file mode 100644 index 00000000000..85f3f37a320 --- /dev/null +++ b/pos_reciept_customize/__manifest__.py @@ -0,0 +1,22 @@ +{ + "name": "POS Receipt Customization", + "summary": "Customizable POS receipt with layouts and HTML header/footer", + "depends": ["point_of_sale"], + "category": "Point of Sale", + "author": "Rohit", + "installable": True, + "license": "LGPL-3", + "data": [ + "security/ir.model.access.csv", + "views/res_config_settings_views.xml", + "wizard/receipts_layout_view.xml", + "views/pos_retail_receipt_template.xml", + "views/pos_restaurant_receipt_template.xml", + ], + "assets": { + "point_of_sale._assets_pos": [ + "pos_reciept_customize/static/src/**/*", + ] + }, + "auto_install": True, +} diff --git a/pos_reciept_customize/models/__init__.py b/pos_reciept_customize/models/__init__.py new file mode 100644 index 00000000000..14259d781e4 --- /dev/null +++ b/pos_reciept_customize/models/__init__.py @@ -0,0 +1,4 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import pos_config +from . import res_config_settings diff --git a/pos_reciept_customize/models/pos_config.py b/pos_reciept_customize/models/pos_config.py new file mode 100644 index 00000000000..ba115d7399f --- /dev/null +++ b/pos_reciept_customize/models/pos_config.py @@ -0,0 +1,18 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models, fields + + +class PosConfig(models.Model): + _inherit = "pos.config" + + receipt_layout = fields.Selection([ + ("light", "Light"), + ("boxes", "Boxes"), + ("lined", "Lined")], + string="Receipt Layout", + default="light", + ) + receipt_logo = fields.Binary(related="company_id.logo", string="Receipt Logo") + receipt_header_html = fields.Html(string="Header", default="", help="Custom HTML header for receipts") + receipt_footer_html = fields.Html(string="Footer", default="", help="Custom HTML footer for receipts") diff --git a/pos_reciept_customize/models/res_config_settings.py b/pos_reciept_customize/models/res_config_settings.py new file mode 100644 index 00000000000..dde1946868d --- /dev/null +++ b/pos_reciept_customize/models/res_config_settings.py @@ -0,0 +1,19 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + pos_receipt_layout = fields.Selection(related="pos_config_id.receipt_layout", readonly=False) + + def action_view_receipt_layout(self): + return { + "type": "ir.actions.act_window", + "name": ("Configure your pos receipt"), + "res_model": "receipts.layout", + "view_mode": "form", + "target": "main", + "context": {"active_pos_config_id": self.pos_config_id.id, "dialog_size": "extra-large"}, + } diff --git a/pos_reciept_customize/security/ir.model.access.csv b/pos_reciept_customize/security/ir.model.access.csv new file mode 100644 index 00000000000..8ac3deb7ca7 --- /dev/null +++ b/pos_reciept_customize/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +pos_reciept_customize.access_receipts_layout,access_receipts_layout,model_receipts_layout,base.group_user,1,1,1,1 diff --git a/pos_reciept_customize/static/src/receipt/order_receipt.js b/pos_reciept_customize/static/src/receipt/order_receipt.js new file mode 100644 index 00000000000..60d66ab6a85 --- /dev/null +++ b/pos_reciept_customize/static/src/receipt/order_receipt.js @@ -0,0 +1,23 @@ +import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/order_receipt"; +import { patch } from "@web/core/utils/patch"; +import { usePos } from "@point_of_sale/app/store/pos_hook"; +import { markup } from "@odoo/owl"; + +patch(OrderReceipt, { + template: "pos_receipt_customize.order_view_inherited" +}); + +patch(OrderReceipt.prototype, { + setup() { + this.pos = usePos(); + this.footer = markup(this.props.data.receipt_footer_html || ""); + }, + + get orderQuantity() { + return this.props.data.orderlines.reduce((accumulator, line) => accumulator + parseFloat(line.qty), 0); + }, + + get order() { + return this.pos.get_order() + } +}); diff --git a/pos_reciept_customize/static/src/receipt/order_receipt.xml b/pos_reciept_customize/static/src/receipt/order_receipt.xml new file mode 100644 index 00000000000..1ded0f8e9bb --- /dev/null +++ b/pos_reciept_customize/static/src/receipt/order_receipt.xml @@ -0,0 +1,321 @@ + + + +
+ + +
+ + + + + + + + + + + + + + + + + +
NoItemAmount
+ + + + + +
+ + + X + + +
+
+ +
+
+
+ Total Qty + + + Sub Total $ + + +
+
+
+ + +
+ + + + + + + + + + + + + + +
TaxAmountBaseTotal
+ + + +
+
+ +
+ +
+ Expected delivery: +
+ +
+
+
+
+
+

Odoo Point of Sale

+
+
+
+
+ +
+
+ + + + + + + +
  • + + +
  • +
    +
    + +
    +
    --------------------------------
    +
    + + Untaxed Amount + +
    +
    + + + + + + + + + +
    +
    +
    --------------------------------
    +
    + TOTAL + +
    + +
    + Rounding + +
    +
    + To Pay + +
    +
    +
    + + +
    +
    + CHANGE + +
    + +
    + Discounts + +
    +
    +