diff --git a/pos_receipt/__init__.py b/pos_receipt/__init__.py new file mode 100644 index 00000000000..9b4296142f4 --- /dev/null +++ b/pos_receipt/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizard diff --git a/pos_receipt/__manifest__.py b/pos_receipt/__manifest__.py new file mode 100644 index 00000000000..6eea0028e6a --- /dev/null +++ b/pos_receipt/__manifest__.py @@ -0,0 +1,15 @@ +{ + "name": "POS Receipt", + "version": "1.0", + "depends": ["point_of_sale"], + "data": [ + "security/ir.model.access.csv", + "views/custom_lined_layout.xml", + "views/custom_boxes_layout.xml", + "views/custom_light_layout.xml", + "views/pos_reciept_views.xml", + "wizard/pos_receipt_layout.xml", + ], + "assets": {"point_of_sale._assets_pos": ["pos_receipt/static/src/**/*"]}, + "license": "LGPL-3", +} diff --git a/pos_receipt/models/__init__.py b/pos_receipt/models/__init__.py new file mode 100644 index 00000000000..2b92809a3b4 --- /dev/null +++ b/pos_receipt/models/__init__.py @@ -0,0 +1,2 @@ +from . import pos_config +from . import res_config_settings diff --git a/pos_receipt/models/pos_config.py b/pos_receipt/models/pos_config.py new file mode 100644 index 00000000000..a175330935f --- /dev/null +++ b/pos_receipt/models/pos_config.py @@ -0,0 +1,17 @@ +from odoo import models, fields + + +class PosConfig(models.Model): + _inherit = "pos.config" + + receipt_layout = fields.Selection( + [("light", "Light"), ("boxes", "Boxes"), ("lined", "Lined")], + string="Select Layout", + default="light", + ) + receipt_logo = fields.Binary( + string="Company Logo", + related="company_id.logo", + readonly=False, + help="A logo that will be printed in the receipt.", + ) diff --git a/pos_receipt/models/res_config_settings.py b/pos_receipt/models/res_config_settings.py new file mode 100644 index 00000000000..ff6abcdc7c7 --- /dev/null +++ b/pos_receipt/models/res_config_settings.py @@ -0,0 +1,21 @@ +from odoo import models, fields + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + receipt_layout = fields.Selection( + related="pos_config_id.receipt_layout", readonly=False + ) + + def open_pos_receipt_config_wizard(self): + return { + "type": "ir.actions.act_window", + "name": "Configure Receipt", + "res_model": "pos.receipt.layout", + "view_mode": "form", + "target": "new", + "context": { + "active_pos_config_id": self.pos_config_id.id, + }, + } diff --git a/pos_receipt/security/ir.model.access.csv b/pos_receipt/security/ir.model.access.csv new file mode 100644 index 00000000000..a5bb18f1c09 --- /dev/null +++ b/pos_receipt/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 +access_pos_receipt_layout,access_receipt_layout,model_pos_receipt_layout,base.group_user,1,1,1,1 diff --git a/pos_receipt/static/src/pos_order_receipt.js b/pos_receipt/static/src/pos_order_receipt.js new file mode 100644 index 00000000000..6319ee3e2c8 --- /dev/null +++ b/pos_receipt/static/src/pos_order_receipt.js @@ -0,0 +1,24 @@ +import { patch } from "@web/core/utils/patch"; +import { OrderReceipt } from "@point_of_sale/app/screens/receipt_screen/receipt/order_receipt"; +import { usePos } from "@point_of_sale/app/store/pos_hook"; + +patch(OrderReceipt, { + template: "pos_receipt.order_receipt_inherited", +}); +patch(OrderReceipt.prototype, { + setup() { + super.setup(); + this.pos = usePos(); + }, + + get order() { + return this.pos.get_order(); + }, + + get orderQuntity() { + return this.props.order.orderlines.reduce( + (sum, line) => sum + line.quantity, + 0 + ); + }, +}); diff --git a/pos_receipt/static/src/pos_order_receipt.xml b/pos_receipt/static/src/pos_order_receipt.xml new file mode 100644 index 00000000000..94ac40eccb7 --- /dev/null +++ b/pos_receipt/static/src/pos_order_receipt.xml @@ -0,0 +1,335 @@ + + + +
+ + + + + + +
  • + + +
  • +
    +
    + +
    +
    --------------------------------
    +
    + + Untaxed Amount + +
    +
    + + + + + + + on + + + +
    +
    + +
    --------------------------------
    +
    + TOTAL + +
    + +
    + Rounding + +
    +
    + To Pay + +
    +
    + +
    + + +
    +
    + CHANGE + +
    + + +
    + Discounts + +
    +
    +