diff --git a/pos_product_mergeable_line/README.rst b/pos_product_mergeable_line/README.rst new file mode 100644 index 0000000000..31db85923e --- /dev/null +++ b/pos_product_mergeable_line/README.rst @@ -0,0 +1,109 @@ +=============================== +Point of Sale - Mergeable Lines +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ffd7770a0f09eb08b51189d0f3208ba49c370a5b8724582a2818e0df314887ed + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/licence-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/17.0/pos_product_mergeable_line + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-17-0/pos-17-0-pos_product_mergeable_line + :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=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the Odoo Point of Sale to prevent to merge lines if +product is configured. + +By default, new line can be merged with a previous one if the +informations are the same. (same product, same restaurant note, etc...) +and if the UoM Category allow it. + +The new module add a boolean field 'Mergeable Line' (default True). + +If unchecked, the product will never be merged into another line. + +That's important in some context, as in the management of returnable +products, where we want to have a record of all movements. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +- Go to "Point of Sale > Product" and edit a product +- Uncheck the checkbox "Mergeable line" + +|image1| + +.. |image1| image:: https://raw.githubusercontent.com/OCA/pos/17.0/pos_product_mergeable_line/static/description/product_form.png + +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 +------------ + +- Sylvain LE GAL +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia + +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-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px + :target: https://github.com/legalsylvain + :alt: legalsylvain + +Current `maintainer `__: + +|maintainer-legalsylvain| + +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_product_mergeable_line/__init__.py b/pos_product_mergeable_line/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_product_mergeable_line/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_product_mergeable_line/__manifest__.py b/pos_product_mergeable_line/__manifest__.py new file mode 100644 index 0000000000..8d67934c03 --- /dev/null +++ b/pos_product_mergeable_line/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright (C) 2023-Today: GRAP () +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Point of Sale - Mergeable Lines", + "summary": "Allows to configure at the product level," + " if an order line can be merged or not.", + "version": "17.0.1.0.0", + "category": "Point of Sale", + "author": "GRAP, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "maintainers": ["legalsylvain"], + "depends": ["point_of_sale"], + "data": ["views/view_product_template.xml"], + "assets": { + "point_of_sale._assets_pos": [ + "pos_product_mergeable_line/static/src/js/models.esm.js", + ], + }, + "installable": True, +} diff --git a/pos_product_mergeable_line/i18n/es.po b/pos_product_mergeable_line/i18n/es.po new file mode 100644 index 0000000000..c2a50fda26 --- /dev/null +++ b/pos_product_mergeable_line/i18n/es.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_product_mergeable_line +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-06-04 11:34+0000\n" +"Last-Translator: Daniel Duque \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: pos_product_mergeable_line +#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_product__pos_mergeable_line +#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_template__pos_mergeable_line +msgid "" +"If unchecked, the product will never be merged with a previous line, in the " +"Point of sale." +msgstr "" +"Si está desmarcado, al añadir el producto al carrito del Punto de venta no " +"se fusionará con líneas previas." + +#. module: pos_product_mergeable_line +#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_product__pos_mergeable_line +#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_template__pos_mergeable_line +msgid "Mergeable Line" +msgstr "Unificar líneas de pedido" + +#. module: pos_product_mergeable_line +#: model:ir.model,name:pos_product_mergeable_line.model_pos_session +msgid "Point of Sale Session" +msgstr "Sesión TPV" + +#. module: pos_product_mergeable_line +#: model:ir.model,name:pos_product_mergeable_line.model_product_template +msgid "Product" +msgstr "Producto" diff --git a/pos_product_mergeable_line/i18n/fr.po b/pos_product_mergeable_line/i18n/fr.po new file mode 100644 index 0000000000..af3696d36e --- /dev/null +++ b/pos_product_mergeable_line/i18n/fr.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_product_mergeable_line +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-03-30 15:11+0000\n" +"PO-Revision-Date: 2023-03-30 15:11+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_product_mergeable_line +#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_product__pos_mergeable_line +#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_template__pos_mergeable_line +msgid "" +"If unchecked, the product will never be merged with a previous line, in the " +"Point of sale." +msgstr "" +"Si la case est décochée, l'article ne sera jamais regroupé avec la ligne " +"précédente, dans le point de vente." + +#. module: pos_product_mergeable_line +#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_product__pos_mergeable_line +#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_template__pos_mergeable_line +msgid "Mergeable Line" +msgstr "Ligne regroupable" + +#. module: pos_product_mergeable_line +#: model:ir.model,name:pos_product_mergeable_line.model_pos_session +msgid "Point of Sale Session" +msgstr "" + +#. module: pos_product_mergeable_line +#: model:ir.model,name:pos_product_mergeable_line.model_product_template +msgid "Product" +msgstr "" + +#~ msgid "Product Template" +#~ msgstr "Modèle d'article" diff --git a/pos_product_mergeable_line/i18n/it.po b/pos_product_mergeable_line/i18n/it.po new file mode 100644 index 0000000000..780f7f4a98 --- /dev/null +++ b/pos_product_mergeable_line/i18n/it.po @@ -0,0 +1,46 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_product_mergeable_line +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-06-04 15:09+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: pos_product_mergeable_line +#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_product__pos_mergeable_line +#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_template__pos_mergeable_line +msgid "" +"If unchecked, the product will never be merged with a previous line, in the " +"Point of sale." +msgstr "" +"Se non settata, il prodotto non verrà mail unito con una riga precedente nel " +"punto vendita." + +#. module: pos_product_mergeable_line +#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_product__pos_mergeable_line +#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_template__pos_mergeable_line +msgid "Mergeable Line" +msgstr "Riga accoppiabile" + +#. module: pos_product_mergeable_line +#: model:ir.model,name:pos_product_mergeable_line.model_pos_session +msgid "Point of Sale Session" +msgstr "Sessione punto vendita" + +#. module: pos_product_mergeable_line +#: model:ir.model,name:pos_product_mergeable_line.model_product_template +msgid "Product" +msgstr "Prodotto" + +#~ msgid "Product Template" +#~ msgstr "Modello prodotto" diff --git a/pos_product_mergeable_line/i18n/pos_product_mergeable_line.pot b/pos_product_mergeable_line/i18n/pos_product_mergeable_line.pot new file mode 100644 index 0000000000..260eea9307 --- /dev/null +++ b/pos_product_mergeable_line/i18n/pos_product_mergeable_line.pot @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_product_mergeable_line +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \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_product_mergeable_line +#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_product__pos_mergeable_line +#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_template__pos_mergeable_line +msgid "" +"If unchecked, the product will never be merged with a previous line, in the " +"Point of sale." +msgstr "" + +#. module: pos_product_mergeable_line +#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_product__pos_mergeable_line +#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_template__pos_mergeable_line +msgid "Mergeable Line" +msgstr "" + +#. module: pos_product_mergeable_line +#: model:ir.model,name:pos_product_mergeable_line.model_pos_session +msgid "Point of Sale Session" +msgstr "" + +#. module: pos_product_mergeable_line +#: model:ir.model,name:pos_product_mergeable_line.model_product_template +msgid "Product" +msgstr "" diff --git a/pos_product_mergeable_line/models/__init__.py b/pos_product_mergeable_line/models/__init__.py new file mode 100644 index 0000000000..a34c01c8a5 --- /dev/null +++ b/pos_product_mergeable_line/models/__init__.py @@ -0,0 +1,2 @@ +from . import pos_session +from . import product_template diff --git a/pos_product_mergeable_line/models/pos_session.py b/pos_product_mergeable_line/models/pos_session.py new file mode 100644 index 0000000000..b29b9dfc9e --- /dev/null +++ b/pos_product_mergeable_line/models/pos_session.py @@ -0,0 +1,14 @@ +# Copyright (C) 2024-Today: GRAP () +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class PosSession(models.Model): + _inherit = "pos.session" + + def _loader_params_product_product(self): + result = super()._loader_params_product_product() + result["search_params"]["fields"] += ["pos_mergeable_line"] + return result diff --git a/pos_product_mergeable_line/models/product_template.py b/pos_product_mergeable_line/models/product_template.py new file mode 100644 index 0000000000..59e5ca8f54 --- /dev/null +++ b/pos_product_mergeable_line/models/product_template.py @@ -0,0 +1,16 @@ +# Copyright (C) 2023-Today: GRAP () +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + pos_mergeable_line = fields.Boolean( + string="Mergeable Line", + default=True, + help="If unchecked, the product will never" + " be merged with a previous line, in the Point of sale.", + ) diff --git a/pos_product_mergeable_line/pyproject.toml b/pos_product_mergeable_line/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_product_mergeable_line/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_product_mergeable_line/readme/CONFIGURE.md b/pos_product_mergeable_line/readme/CONFIGURE.md new file mode 100644 index 0000000000..7644eddd54 --- /dev/null +++ b/pos_product_mergeable_line/readme/CONFIGURE.md @@ -0,0 +1,4 @@ +- Go to "Point of Sale \> Product" and edit a product +- Uncheck the checkbox "Mergeable line" + +![](../static/description/product_form.png) diff --git a/pos_product_mergeable_line/readme/CONTRIBUTORS.md b/pos_product_mergeable_line/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..478684e84d --- /dev/null +++ b/pos_product_mergeable_line/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- Sylvain LE GAL \<\> +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/pos_product_mergeable_line/readme/DESCRIPTION.md b/pos_product_mergeable_line/readme/DESCRIPTION.md new file mode 100644 index 0000000000..64a8b15616 --- /dev/null +++ b/pos_product_mergeable_line/readme/DESCRIPTION.md @@ -0,0 +1,13 @@ +This module extends the Odoo Point of Sale to prevent to merge lines if +product is configured. + +By default, new line can be merged with a previous one if the +informations are the same. (same product, same restaurant note, etc...) +and if the UoM Category allow it. + +The new module add a boolean field 'Mergeable Line' (default True). + +If unchecked, the product will never be merged into another line. + +That's important in some context, as in the management of returnable +products, where we want to have a record of all movements. diff --git a/pos_product_mergeable_line/static/description/icon.png b/pos_product_mergeable_line/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_product_mergeable_line/static/description/icon.png differ diff --git a/pos_product_mergeable_line/static/description/index.html b/pos_product_mergeable_line/static/description/index.html new file mode 100644 index 0000000000..bfff338eb4 --- /dev/null +++ b/pos_product_mergeable_line/static/description/index.html @@ -0,0 +1,446 @@ + + + + + +Point of Sale - Mergeable Lines + + + +
+

Point of Sale - Mergeable Lines

+ + +

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

+

This module extends the Odoo Point of Sale to prevent to merge lines if +product is configured.

+

By default, new line can be merged with a previous one if the +informations are the same. (same product, same restaurant note, etc…) +and if the UoM Category allow it.

+

The new module add a boolean field ‘Mergeable Line’ (default True).

+

If unchecked, the product will never be merged into another line.

+

That’s important in some context, as in the management of returnable +products, where we want to have a record of all movements.

+

Table of contents

+ +
+

Configuration

+
    +
  • Go to “Point of Sale > Product” and edit a product
  • +
  • Uncheck the checkbox “Mergeable line”
  • +
+

image1

+
+
+

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:

+

legalsylvain

+

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_product_mergeable_line/static/description/product_form.png b/pos_product_mergeable_line/static/description/product_form.png new file mode 100644 index 0000000000..5e9aa60341 Binary files /dev/null and b/pos_product_mergeable_line/static/description/product_form.png differ diff --git a/pos_product_mergeable_line/static/src/js/models.esm.js b/pos_product_mergeable_line/static/src/js/models.esm.js new file mode 100644 index 0000000000..3619eac724 --- /dev/null +++ b/pos_product_mergeable_line/static/src/js/models.esm.js @@ -0,0 +1,17 @@ +/** @odoo-module */ +/* +Copyright (C) 2023-Today: GRAP (http://www.grap.coop) +@author: Sylvain LE GAL (https://twitter.com/legalsylvain) +License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +*/ +import {Orderline} from "@point_of_sale/app/store/models"; +import {patch} from "@web/core/utils/patch"; + +patch(Orderline.prototype, { + can_be_merged_with(orderline) { + if (!orderline.product.pos_mergeable_line) { + return false; + } + return super.can_be_merged_with(orderline); + }, +}); diff --git a/pos_product_mergeable_line/views/view_product_template.xml b/pos_product_mergeable_line/views/view_product_template.xml new file mode 100644 index 0000000000..8ce04fa8fb --- /dev/null +++ b/pos_product_mergeable_line/views/view_product_template.xml @@ -0,0 +1,17 @@ + + + + + + product.template + + + + + + + +