diff --git a/pos_restaurant_split_order_usability/README.rst b/pos_restaurant_split_order_usability/README.rst new file mode 100644 index 0000000000..888cbc7fba --- /dev/null +++ b/pos_restaurant_split_order_usability/README.rst @@ -0,0 +1,107 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +==================================== +POS Restaurant Split Order Usability +==================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:97cd2ce4b273bf59f3709e77b61fbc2d1ba5590eb180006bbfc799f3bbecf450 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/16.0/pos_restaurant_split_order_usability + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_restaurant_split_order_usability + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of Point of Sale Restaurant module, +improving the display of the Split screen. + +The modules adds a link between split orders and display already paid +lines in the Split screen. + +**With the module** + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability.png + +.. figure:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability_offline.png + +**Table of contents** + +.. contents:: + :local: + +Changelog +========= + +16.0.1.0.0 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Initial release +* Already paid lines displayed on Split Screen + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* GRAP + +Contributors +~~~~~~~~~~~~ + +* Quentin DUPONT (quentin.dupont@grap.coop) + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-quentinDupont| image:: https://github.com/quentinDupont.png?size=40px + :target: https://github.com/quentinDupont + :alt: quentinDupont + +Current `maintainer `__: + +|maintainer-quentinDupont| + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_restaurant_split_order_usability/__init__.py b/pos_restaurant_split_order_usability/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_restaurant_split_order_usability/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_restaurant_split_order_usability/__manifest__.py b/pos_restaurant_split_order_usability/__manifest__.py new file mode 100644 index 0000000000..53bb9026b9 --- /dev/null +++ b/pos_restaurant_split_order_usability/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright (C) 2026-Today GRAP (http://www.grap.coop) +# @author Quentin DUPONT +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + "name": "POS Restaurant Split Order Usability", + "summary": "Improve POS Split Screen by displaying already paid lines", + "version": "16.0.1.0.0", + "category": "Point of Sale", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "maintainers": ["quentinDupont"], + "author": "GRAP,Odoo Community Association (OCA)", + "depends": ["point_of_sale", "pos_restaurant"], + "data": [ + "views/view_pos_order.xml", + ], + "assets": { + "point_of_sale.assets": [ + "pos_restaurant_split_order_usability/static/src/css/*.scss", + "pos_restaurant_split_order_usability/static/src/xml/**.xml", + "pos_restaurant_split_order_usability/static/src/js/**.js", + ], + }, + "installable": True, +} diff --git a/pos_restaurant_split_order_usability/i18n/fr.po b/pos_restaurant_split_order_usability/i18n/fr.po new file mode 100644 index 0000000000..1a72d8d026 --- /dev/null +++ b/pos_restaurant_split_order_usability/i18n/fr.po @@ -0,0 +1,69 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_restaurant_split_order_usability +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-04-02 13:28+0000\n" +"PO-Revision-Date: 2026-04-02 13:28+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_restaurant_split_order_usability +#. odoo-javascript +#: code:addons/pos_restaurant_split_order_usability/static/src/xml/AlreadyPaidLines.xml:0 +#, python-format +msgid "Already paid lines" +msgstr "Lignes déja payées" + +#. module: pos_restaurant_split_order_usability +#. odoo-javascript +#: code:addons/pos_restaurant_split_order_usability/static/src/xml/AlreadyPaidLines.xml:0 +#, python-format +msgid "No Internet connection: can't retrieve previous linked orders" +msgstr "Pas de connexion Internet : impossible d'afficher les commandes déjà payées." + +#. module: pos_restaurant_split_order_usability +#: model:ir.model.fields,field_description:pos_restaurant_split_order_usability.field_pos_order__origin_order_uid +msgid "Original Order" +msgstr "Commande parent" + +#. module: pos_restaurant_split_order_usability +#: model:ir.model,name:pos_restaurant_split_order_usability.model_pos_order +msgid "Point of Sale Orders" +msgstr "Commandes du point de vente" + +#. module: pos_restaurant_split_order_usability +#: model:ir.model.fields,help:pos_restaurant_split_order_usability.field_pos_order__origin_order_uid +msgid "" +"This order was originally from this order before being split during payment" +msgstr "" +"Cette commande provient originellement de cette commande avant d'avoir été " +"partagé au moment du paiement." + +#. module: pos_restaurant_split_order_usability +#. odoo-javascript +#: code:addons/pos_restaurant_split_order_usability/static/src/xml/AlreadyPaidLines.xml:0 +#, python-format +msgid "With a" +msgstr "Avec" + +#. module: pos_restaurant_split_order_usability +#. odoo-javascript +#: code:addons/pos_restaurant_split_order_usability/static/src/xml/AlreadyPaidLines.xml:0 +#, python-format +msgid "at" +msgstr "a" + +#. module: pos_restaurant_split_order_usability +#. odoo-javascript +#: code:addons/pos_restaurant_split_order_usability/static/src/xml/AlreadyPaidLines.xml:0 +#, python-format +msgid "discount" +msgstr "remise" \ No newline at end of file diff --git a/pos_restaurant_split_order_usability/models/__init__.py b/pos_restaurant_split_order_usability/models/__init__.py new file mode 100644 index 0000000000..e9ab911ddc --- /dev/null +++ b/pos_restaurant_split_order_usability/models/__init__.py @@ -0,0 +1 @@ +from . import pos_order diff --git a/pos_restaurant_split_order_usability/models/pos_order.py b/pos_restaurant_split_order_usability/models/pos_order.py new file mode 100644 index 0000000000..037df03809 --- /dev/null +++ b/pos_restaurant_split_order_usability/models/pos_order.py @@ -0,0 +1,44 @@ +# Copyright (C) 2026-Today GRAP (https://www.grap.coop) +# @author Quentin DUPONT +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from odoo import api, fields, models + + +class PosOrder(models.Model): + _inherit = "pos.order" + + origin_order_uid = fields.Char( + string="Original Order", + help="This order was originally from this order before being split during payment", + ) + + # Overload Section + @api.model + def _order_fields(self, ui_order): + res = super()._order_fields(ui_order) + res["origin_order_uid"] = ui_order.get("origin_order_uid") or False + return res + + @api.model + def get_split_order_linked_order_lines(self, origin_order_uid, pos_session_id): + orders = self.search([("origin_order_uid", "=", origin_order_uid)]) + lines = orders.mapped("lines") + + res_lines = [] + for line in lines: + res_lines.append( + { + "id": line.id, + "order_name": line.order_id.name, + "date_order": line.order_id.date_order, + "product_name": line.product_id.display_name, + "product_qty": line.qty, + "product_uom_name": line.product_uom_id.name, + "discount": line.discount, + "price_unit": line.price_unit, + "price_subtotal": line.price_subtotal, + } + ) + + return res_lines diff --git a/pos_restaurant_split_order_usability/readme/CONTRIBUTORS.rst b/pos_restaurant_split_order_usability/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..7fd44d8137 --- /dev/null +++ b/pos_restaurant_split_order_usability/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Quentin DUPONT (quentin.dupont@grap.coop) \ No newline at end of file diff --git a/pos_restaurant_split_order_usability/readme/DESCRIPTION.rst b/pos_restaurant_split_order_usability/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..a259f7bca8 --- /dev/null +++ b/pos_restaurant_split_order_usability/readme/DESCRIPTION.rst @@ -0,0 +1,11 @@ +This module extends the functionality of Point of Sale Restaurant module, +improving the display of the Split screen. + +The modules adds a link between split orders and display already paid +lines in the Split screen. + +**With the module** + +.. figure:: ../static/description/pos_restaurant_split_order_usability.png + +.. figure:: ../static/description/pos_restaurant_split_order_usability_offline.png diff --git a/pos_restaurant_split_order_usability/readme/HISTORY.rst b/pos_restaurant_split_order_usability/readme/HISTORY.rst new file mode 100644 index 0000000000..706c2d2bb3 --- /dev/null +++ b/pos_restaurant_split_order_usability/readme/HISTORY.rst @@ -0,0 +1,5 @@ +16.0.1.0.0 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Initial release +* Already paid lines displayed on Split Screen \ No newline at end of file diff --git a/pos_restaurant_split_order_usability/static/description/index.html b/pos_restaurant_split_order_usability/static/description/index.html new file mode 100644 index 0000000000..4d1f699303 --- /dev/null +++ b/pos_restaurant_split_order_usability/static/description/index.html @@ -0,0 +1,455 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

POS Restaurant Split Order Usability

+ +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runboat

+

This module extends the functionality of Point of Sale Restaurant module, +improving the display of the Split screen.

+

The modules adds a link between split orders and display already paid +lines in the Split screen.

+

With the module

+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability.png +
+
+https://raw.githubusercontent.com/OCA/pos/16.0/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability_offline.png +
+

Table of contents

+ +
+

Changelog

+
+

16.0.1.0.0

+
    +
  • Initial release
  • +
  • Already paid lines displayed on Split Screen
  • +
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • GRAP
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

quentinDupont

+

This module is part of the OCA/pos project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+
+ + diff --git a/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability.png b/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability.png new file mode 100644 index 0000000000..2933708566 Binary files /dev/null and b/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability.png differ diff --git a/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability_offline.png b/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability_offline.png new file mode 100644 index 0000000000..e53014bac2 Binary files /dev/null and b/pos_restaurant_split_order_usability/static/description/pos_restaurant_split_order_usability_offline.png differ diff --git a/pos_restaurant_split_order_usability/static/src/css/AlreadyPaidLines.scss b/pos_restaurant_split_order_usability/static/src/css/AlreadyPaidLines.scss new file mode 100644 index 0000000000..9134be6d30 --- /dev/null +++ b/pos_restaurant_split_order_usability/static/src/css/AlreadyPaidLines.scss @@ -0,0 +1,42 @@ +.already-paid-lines { + margin: 5px 5px; + font-size: 80%; + transition: all 0.3s ease; + + .orderline { + cursor: not-allowed !important; + opacity: 0.8; + } +} + +.badge-rounded-pill { + border-radius: 3px; + padding: 5px; + float: right; + margin-left: 2px; +} + +.badge-order-name { + background: #432c3d; + color: white; +} + +.badge-date-order { + background: #714b78; + color: white; +} + +.already-paid-lines-title { + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + background: #e0e2e6; + line-height: 25px; + border: solid 1px #cacaca; + width: 100%; + text-align: center; +} + +.already-paid-lines-title.already-paid-lines-online:hover { + background: #e0e2f7; + cursor: pointer; +} diff --git a/pos_restaurant_split_order_usability/static/src/js/AlreadyPaidLines.esm.js b/pos_restaurant_split_order_usability/static/src/js/AlreadyPaidLines.esm.js new file mode 100644 index 0000000000..0f83fe03d2 --- /dev/null +++ b/pos_restaurant_split_order_usability/static/src/js/AlreadyPaidLines.esm.js @@ -0,0 +1,60 @@ +/** @odoo-module **/ + +import {onMounted, useState} from "@odoo/owl"; +import PosComponent from "point_of_sale.PosComponent"; +import Registries from "point_of_sale.Registries"; +import {isConnectionError} from "point_of_sale.utils"; + +class AlreadyPaidLines extends PosComponent { + setup() { + super.setup(); + this.paidOrderLines = []; + this.state = useState({ + showAlreadyPaid: true, + showAlreadyPaidButton: false, + showAlreadyPaidOffline: false, + }); + onMounted(this.onMounted); + } + + onMounted() { + this.loadAlreadyPaidOrderLines(); + } + + /* Hide or display already paid lines */ + toggleAlreadyPaid() { + this.state.showAlreadyPaid = !this.state.showAlreadyPaid; + } + + async loadAlreadyPaidOrderLines() { + try { + this.paidOrderLines = await this.rpc({ + model: "pos.order", + method: "get_split_order_linked_order_lines", + args: [this.props.order.uid, this.env.pos.pos_session.id], + }); + + if (this.paidOrderLines.length === 0) { + this.state.showAlreadyPaidButton = false; + } else { + this.state.showAlreadyPaidButton = true; + } + + this.render(); + } catch (error) { + if (isConnectionError(error)) { + this.state.showAlreadyPaidOffline = true; + return; + } + throw error; + } + } + + get alreadyPaidOrderLines() { + return this.paidOrderLines || []; + } +} + +AlreadyPaidLines.template = "AlreadyPaidLines"; +Registries.Component.add(AlreadyPaidLines); +export default AlreadyPaidLines; diff --git a/pos_restaurant_split_order_usability/static/src/js/SplitBillScreen.esm.js b/pos_restaurant_split_order_usability/static/src/js/SplitBillScreen.esm.js new file mode 100644 index 0000000000..0e49b2d365 --- /dev/null +++ b/pos_restaurant_split_order_usability/static/src/js/SplitBillScreen.esm.js @@ -0,0 +1,37 @@ +/* +Copyright (C) 2026-Today: GRAP (https://www.grap.coop) +@author: Quentin DUPONT +License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +*/ +odoo.define( + "pos_restaurant_split_order_usability.SplitBillScreenPatch", + function (require) { + const SplitBillScreen = require("pos_restaurant.SplitBillScreen"); + const {patch} = require("web.utils"); + const Registries = require("point_of_sale.Registries"); + + patch( + SplitBillScreen.prototype, + "pos_restaurant_split_order_usability.SplitBillScreenPatch", + { + /** + * At new order creation (from split), set write in database + * origin_order_uid field thanks to _order_fields + * to be retrieve with JS rpc + */ + proceed() { + if (this.newOrder) { + this.newOrder.origin_order_uid = + this.currentOrder.origin_order_uid || this.currentOrder.uid; + } + if (this._super) { + this._super(...arguments); + } + }, + } + ); + + Registries.Component.add(SplitBillScreen); + return SplitBillScreen; + } +); diff --git a/pos_restaurant_split_order_usability/static/src/js/model.esm.js b/pos_restaurant_split_order_usability/static/src/js/model.esm.js new file mode 100644 index 0000000000..18de94d73a --- /dev/null +++ b/pos_restaurant_split_order_usability/static/src/js/model.esm.js @@ -0,0 +1,21 @@ +/** @odoo-module **/ + +import {Model} from "point_of_sale.Registries"; +import {Order} from "point_of_sale.models"; + +const SplitOrder = (Order_) => + class extends Order_ { + // @override + export_as_JSON() { + const json = super.export_as_JSON(); + json.origin_order_uid = this.getCurrentOrderUid(); + return json; + } + + // Custom Section + getCurrentOrderUid() { + return this.origin_order_uid; + } + }; + +Model.extend(Order, SplitOrder); diff --git a/pos_restaurant_split_order_usability/static/src/xml/AlreadyPaidLines.xml b/pos_restaurant_split_order_usability/static/src/xml/AlreadyPaidLines.xml new file mode 100644 index 0000000000..b42c398e74 --- /dev/null +++ b/pos_restaurant_split_order_usability/static/src/xml/AlreadyPaidLines.xml @@ -0,0 +1,79 @@ + + + + + + + +
+ No Internet connection: can't retrieve previous linked orders +
+
+ + +
+ + + + + + + Already paid lines +
+
+ + +
    + +
  • + + + + + + + + + + + + +
      + +
    • + + + at + + / + +
    • +
      + +
    • + With a + + + % + + discount +
    • +
      +
    +
  • +
    +
+
+
+ +
diff --git a/pos_restaurant_split_order_usability/static/src/xml/SplitOrderUsability.xml b/pos_restaurant_split_order_usability/static/src/xml/SplitOrderUsability.xml new file mode 100644 index 0000000000..437cbb8ca1 --- /dev/null +++ b/pos_restaurant_split_order_usability/static/src/xml/SplitOrderUsability.xml @@ -0,0 +1,22 @@ + + + + + + +
+ +
+
+
+ +
diff --git a/pos_restaurant_split_order_usability/views/view_pos_order.xml b/pos_restaurant_split_order_usability/views/view_pos_order.xml new file mode 100644 index 0000000000..79066384c2 --- /dev/null +++ b/pos_restaurant_split_order_usability/views/view_pos_order.xml @@ -0,0 +1,20 @@ + + + + + + pos.order.form.view.inherit + pos.order + + + + + + + + + diff --git a/setup/pos_restaurant_split_order_usability/odoo/addons/pos_restaurant_split_order_usability b/setup/pos_restaurant_split_order_usability/odoo/addons/pos_restaurant_split_order_usability new file mode 120000 index 0000000000..cb0217ecba --- /dev/null +++ b/setup/pos_restaurant_split_order_usability/odoo/addons/pos_restaurant_split_order_usability @@ -0,0 +1 @@ +../../../../pos_restaurant_split_order_usability \ No newline at end of file diff --git a/setup/pos_restaurant_split_order_usability/setup.py b/setup/pos_restaurant_split_order_usability/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_restaurant_split_order_usability/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)