diff --git a/pos_edit_order_line/i18n/de.po b/pos_edit_order_line/i18n/de.po new file mode 100644 index 0000000000..6871e5d84f --- /dev/null +++ b/pos_edit_order_line/i18n/de.po @@ -0,0 +1,111 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_edit_order_line +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-06-25 21:46+0000\n" +"Last-Translator: intero-chd \n" +"Language-Team: none\n" +"Language: de\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 5.15.2\n" + +#. module: pos_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_pos_config__allow_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_res_config_settings__pos_allow_edit_order_line +msgid "Allow Edit Order Line" +msgstr "Bearbeitung der Auftragsposition zulassen" + +#. module: pos_edit_order_line +#: model_terms:ir.ui.view,arch_db:pos_edit_order_line.res_config_settings_view_form +msgid "Allow edit Order Line in popup" +msgstr "Bearbeitung der Auftragspositionen im Popup-Fenster zulassen" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +msgid "Cancel" +msgstr "Abbrechen" + +#. module: pos_edit_order_line +#: model:ir.model,name:pos_edit_order_line.model_res_config_settings +msgid "Config Settings" +msgstr "Konfigurationseinstellungen" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +msgid "Confirm" +msgstr "Bestätigen" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +msgid "Discount" +msgstr "Rabatt" + +#. module: pos_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_pos_config__display_name +#: model:ir.model.fields,field_description:pos_edit_order_line.field_res_config_settings__display_name +msgid "Display Name" +msgstr "Anzeigename" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderButton.xml:0 +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +msgid "Edit Order Lines" +msgstr "Auftragspositionen bearbeiten" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.esm.js:0 +msgid "Empty Order" +msgstr "Leerer Auftrag" + +#. module: pos_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_pos_config__id +#: model:ir.model.fields,field_description:pos_edit_order_line.field_res_config_settings__id +msgid "ID" +msgstr "ID" + +#. module: pos_edit_order_line +#: model:ir.model,name:pos_edit_order_line.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Kassensystem Konfiguration" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +msgid "Price excl. VAT" +msgstr "Preis exkl. Mehrwertsteuer" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +msgid "Product" +msgstr "Produkt" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +msgid "Quantity" +msgstr "Menge" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +msgid "UoM" +msgstr "Maßeinheit" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.esm.js:0 +msgid "You need add some products first." +msgstr "Sie müssen zunächst einige Produkte hinzufügen." diff --git a/pos_partner_birthdate/i18n/de.po b/pos_partner_birthdate/i18n/de.po new file mode 100644 index 0000000000..1c07d4f314 --- /dev/null +++ b/pos_partner_birthdate/i18n/de.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_partner_birthdate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-06-25 21:46+0000\n" +"Last-Translator: intero-chd \n" +"Language-Team: none\n" +"Language: de\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 5.15.2\n" + +#. module: pos_partner_birthdate +#: model:ir.model,name:pos_partner_birthdate.model_res_partner +msgid "Contact" +msgstr "Kontakt" + +#. module: pos_partner_birthdate +#: model:ir.model.fields,field_description:pos_partner_birthdate.field_res_partner__display_name +msgid "Display Name" +msgstr "Anzeigename" + +#. module: pos_partner_birthdate +#: model:ir.model.fields,field_description:pos_partner_birthdate.field_res_partner__id +msgid "ID" +msgstr "ID" diff --git a/pos_sale_picking_keep/README.rst b/pos_sale_picking_keep/README.rst new file mode 100644 index 0000000000..f714ff3f1a --- /dev/null +++ b/pos_sale_picking_keep/README.rst @@ -0,0 +1,108 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=========================== +Keep sale pickings from PoS +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:14008524ac2e970ae97eda09273f81e2fc25b02a6ccf008e85f4473f3d637815 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/19.0/pos_sale_picking_keep + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-19-0/pos-19-0-pos_sale_picking_keep + :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=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module inhibits the manipulation that the point of sale mades over +the sales orders pickings, and the creation of new pickings under the +PoS picking type. + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +In some scenarios, you may not want that the point of sale (PoS) handles +the pickings of the products you are paying: + +- Using the PoS as a pure payment terminal. +- When complex stock flows are not supplied by the PoS. + +In that cases, it's better to keep the original sales pickings. + +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 +------- + +* Tecnativa + +Contributors +------------ + +- Tecnativa: + + - Pedro M. Baeza + - Víctor Martínez + +- Jarsa: + + - Jesús Alan Ramos Rodríguez + +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-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px + :target: https://github.com/pedrobaeza + :alt: pedrobaeza + +Current `maintainer `__: + +|maintainer-pedrobaeza| + +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_sale_picking_keep/__init__.py b/pos_sale_picking_keep/__init__.py new file mode 100644 index 0000000000..3275ac2adf --- /dev/null +++ b/pos_sale_picking_keep/__init__.py @@ -0,0 +1,2 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import models diff --git a/pos_sale_picking_keep/__manifest__.py b/pos_sale_picking_keep/__manifest__.py new file mode 100644 index 0000000000..1a7216b02d --- /dev/null +++ b/pos_sale_picking_keep/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2025 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Keep sale pickings from PoS", + "version": "19.0.1.0.0", + "category": "Point Of Sale", + "website": "https://github.com/OCA/pos", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["pedrobaeza"], + "license": "AGPL-3", + "installable": True, + "depends": ["pos_sale", "sale_stock"], + "assets": { + "web.assets_tests": [ + "pos_sale_picking_keep/static/tests/tours/**/*", + ], + }, +} diff --git a/pos_sale_picking_keep/i18n/it.po b/pos_sale_picking_keep/i18n/it.po new file mode 100644 index 0000000000..9bed391550 --- /dev/null +++ b/pos_sale_picking_keep/i18n/it.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_sale_picking_keep +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-03-13 16:45+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 5.15.2\n" + +#. module: pos_sale_picking_keep +#: model:ir.model,name:pos_sale_picking_keep.model_pos_order +msgid "Point of Sale Orders" +msgstr "Ordini punto vendita" + +#. module: pos_sale_picking_keep +#: model:ir.model,name:pos_sale_picking_keep.model_pos_session +msgid "Point of Sale Session" +msgstr "Sessione punto vendita" + +#. module: pos_sale_picking_keep +#: model:ir.model,name:pos_sale_picking_keep.model_sale_order_line +msgid "Sales Order Line" +msgstr "Riga ordine di vendita" diff --git a/pos_sale_picking_keep/i18n/pos_sale_picking_keep.pot b/pos_sale_picking_keep/i18n/pos_sale_picking_keep.pot new file mode 100644 index 0000000000..b14f7eb313 --- /dev/null +++ b/pos_sale_picking_keep/i18n/pos_sale_picking_keep.pot @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_sale_picking_keep +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.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_sale_picking_keep +#: model:ir.model,name:pos_sale_picking_keep.model_pos_order +msgid "Point of Sale Orders" +msgstr "" + +#. module: pos_sale_picking_keep +#: model:ir.model,name:pos_sale_picking_keep.model_pos_session +msgid "Point of Sale Session" +msgstr "" + +#. module: pos_sale_picking_keep +#: model:ir.model,name:pos_sale_picking_keep.model_sale_order_line +msgid "Sales Order Line" +msgstr "" diff --git a/pos_sale_picking_keep/models/__init__.py b/pos_sale_picking_keep/models/__init__.py new file mode 100644 index 0000000000..1315735d03 --- /dev/null +++ b/pos_sale_picking_keep/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import pos_order +from . import pos_session +from . import sale_order_line diff --git a/pos_sale_picking_keep/models/pos_order.py b/pos_sale_picking_keep/models/pos_order.py new file mode 100644 index 0000000000..653aab9477 --- /dev/null +++ b/pos_sale_picking_keep/models/pos_order.py @@ -0,0 +1,47 @@ +# Copyright 2025 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, models +from odoo.tools import config + + +class PosOrder(models.Model): + _inherit = "pos.order" + + @api.model + def sync_from_ui(self, orders): + # Avoid the cancellation of the SO pickings + so_line_ids = [] + for order_data in orders: + for command in order_data.get("lines", []): + if len(command) != 3: + continue # No create/update command + so_line_id = command[2].get("sale_order_line_id") + if so_line_id: + so_line_ids.append(so_line_id) + so_lines = self.env["sale.order.line"].browse(so_line_ids) + # confirm the unconfirmed sale orders that are linked to the sale order lines + # this is done also upstream, but we need to do it first for having already + # the pickings to make the trick + sale_orders = so_lines.order_id + for sale_order in sale_orders.filtered(lambda x: x.state in ["draft", "sent"]): + sale_order.action_confirm() + # Fake the pickings state before calling super for avoiding the move quantity + # reduction that is done upstream that effectively cancels the SO pickings + pickings = so_lines.move_ids.picking_id + pickings.state = "draft" + res = super().sync_from_ui(orders) + pickings._compute_state() + return res + + def _create_order_picking(self): + # Nullify the creation of the pickings at this level + # We cannot use self.env.context.get("test_pos_sale_picking_keep") because + # the tours that run in the tests do not allow that context to be maintained. + # Therefore, we use self.config_id.name. + if ( + config["test_enable"] + and self.config_id.name != "test_pos_sale_picking_keep" + ): + # For not breaking tests of other modules + return super()._create_order_picking() + return True diff --git a/pos_sale_picking_keep/models/pos_session.py b/pos_sale_picking_keep/models/pos_session.py new file mode 100644 index 0000000000..3def4406a1 --- /dev/null +++ b/pos_sale_picking_keep/models/pos_session.py @@ -0,0 +1,21 @@ +# Copyright 2025 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import models +from odoo.tools import config + + +class PosSession(models.Model): + _inherit = "pos.session" + + def _create_picking_at_end_of_session(self): + # Nullify the creation of the pickings at this level + # We cannot use self.env.context.get("test_pos_sale_picking_keep") because + # the tours that run in the tests do not allow that context to be maintained. + # Therefore, we use self.config_id.name. + if ( + config["test_enable"] + and self.config_id.name != "test_pos_sale_picking_keep" + ): + # For not breaking tests of other modules + return super()._create_picking_at_end_of_session() + return True diff --git a/pos_sale_picking_keep/models/sale_order_line.py b/pos_sale_picking_keep/models/sale_order_line.py new file mode 100644 index 0000000000..f44e3837a2 --- /dev/null +++ b/pos_sale_picking_keep/models/sale_order_line.py @@ -0,0 +1,19 @@ +# Copyright 2026 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, models + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + # TODO: Delete if merged https://github.com/odoo/odoo/pull/253333 + def _compute_qty_delivered(self): + self = self.with_context(from_qty_delivered=True) + return super()._compute_qty_delivered() + + # TODO: Delete if merged https://github.com/odoo/odoo/pull/253333 + @api.model + def _convert_qty(self, sale_line, qty, direction): + if self.env.context.get("from_qty_delivered"): + return 0 + return super()._convert_qty(sale_line=sale_line, qty=qty, direction=direction) diff --git a/pos_sale_picking_keep/pyproject.toml b/pos_sale_picking_keep/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_sale_picking_keep/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_sale_picking_keep/readme/CONTEXT.md b/pos_sale_picking_keep/readme/CONTEXT.md new file mode 100644 index 0000000000..df96e1c124 --- /dev/null +++ b/pos_sale_picking_keep/readme/CONTEXT.md @@ -0,0 +1,7 @@ +In some scenarios, you may not want that the point of sale (PoS) handles the pickings +of the products you are paying: + +- Using the PoS as a pure payment terminal. +- When complex stock flows are not supplied by the PoS. + +In that cases, it's better to keep the original sales pickings. diff --git a/pos_sale_picking_keep/readme/CONTRIBUTORS.md b/pos_sale_picking_keep/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..8b7bbc8fc0 --- /dev/null +++ b/pos_sale_picking_keep/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- Tecnativa: + - Pedro M. Baeza + - Víctor Martínez + +- Jarsa: + - Jesús Alan Ramos Rodríguez \ diff --git a/pos_sale_picking_keep/readme/DESCRIPTION.md b/pos_sale_picking_keep/readme/DESCRIPTION.md new file mode 100644 index 0000000000..8c167306c6 --- /dev/null +++ b/pos_sale_picking_keep/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module inhibits the manipulation that the point of sale mades over the sales orders +pickings, and the creation of new pickings under the PoS picking type. diff --git a/pos_sale_picking_keep/static/description/icon.png b/pos_sale_picking_keep/static/description/icon.png new file mode 100644 index 0000000000..1dcc49c24f Binary files /dev/null and b/pos_sale_picking_keep/static/description/icon.png differ diff --git a/pos_sale_picking_keep/static/description/index.html b/pos_sale_picking_keep/static/description/index.html new file mode 100644 index 0000000000..f78b612c53 --- /dev/null +++ b/pos_sale_picking_keep/static/description/index.html @@ -0,0 +1,452 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Keep sale pickings from PoS

+ +

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

+

This module inhibits the manipulation that the point of sale mades over +the sales orders pickings, and the creation of new pickings under the +PoS picking type.

+

Table of contents

+ +
+

Use Cases / Context

+

In some scenarios, you may not want that the point of sale (PoS) handles +the pickings of the products you are paying:

+
    +
  • Using the PoS as a pure payment terminal.
  • +
  • When complex stock flows are not supplied by the PoS.
  • +
+

In that cases, it’s better to keep the original sales pickings.

+
+
+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Pedro M. Baeza
    • +
    • Víctor Martínez
    • +
    +
  • +
  • Jarsa: +
  • +
+
+
+

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:

+

pedrobaeza

+

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_sale_picking_keep/static/tests/tours/pos_sale_picking_keep.esm.js b/pos_sale_picking_keep/static/tests/tours/pos_sale_picking_keep.esm.js new file mode 100644 index 0000000000..b26b0b5407 --- /dev/null +++ b/pos_sale_picking_keep/static/tests/tours/pos_sale_picking_keep.esm.js @@ -0,0 +1,32 @@ +import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; +import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; +import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util"; +import * as PosSale from "@pos_sale/../tests/tours/utils/pos_sale_utils"; +import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; +import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util"; +import {registry} from "@web/core/registry"; + +registry.category("web_tour.tours").add("PosSalePickingKeep1", { + steps: () => + [ + Chrome.startPoS(), + Dialog.confirm("Open Register"), + PosSale.settleNthOrder(1), + ProductScreen.selectedOrderlineHas("Test Product", "1.00"), + ProductScreen.clickPayButton(), + PaymentScreen.clickPaymentMethod("Bank", true, {remaining: "0.0"}), + PaymentScreen.clickValidate(), + ReceiptScreen.isShown(), + ].flat(), +}); +registry.category("web_tour.tours").add("PosSalePickingKeep2", { + steps: () => + [ + Chrome.startPoS(), + Dialog.confirm("Open Register"), + ProductScreen.clickDisplayedProduct("Test Product"), + ProductScreen.clickPayButton(), + PaymentScreen.clickPaymentMethod("Bank"), + PaymentScreen.clickValidate(), + ].flat(), +}); diff --git a/pos_sale_picking_keep/tests/__init__.py b/pos_sale_picking_keep/tests/__init__.py new file mode 100644 index 0000000000..bdfa733c4b --- /dev/null +++ b/pos_sale_picking_keep/tests/__init__.py @@ -0,0 +1 @@ +from . import test_pos_sale_picking_keep diff --git a/pos_sale_picking_keep/tests/test_pos_sale_picking_keep.py b/pos_sale_picking_keep/tests/test_pos_sale_picking_keep.py new file mode 100644 index 0000000000..e9269ca313 --- /dev/null +++ b/pos_sale_picking_keep/tests/test_pos_sale_picking_keep.py @@ -0,0 +1,71 @@ +# Copyright 2026 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import odoo.tests +from odoo.tests import Form + +from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon + + +@odoo.tests.tagged("post_install", "-at_install") +class TestPosSalePickingKeep(TestPointOfSaleHttpCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env.user.group_ids |= cls.env.ref("sales_team.group_sale_salesman") + cls.env.company.point_of_sale_update_stock_quantities = "closing" + cls.customer = cls.env["res.partner"].create({"name": "Test partner"}) + cls.warehouse = cls.env["stock.warehouse"].search( + [("company_id", "=", cls.env.company.id)], limit=1 + ) + cls.product = cls.env["product.product"].create( + { + "name": "Test Product", + "available_in_pos": True, + "is_storable": True, + "lst_price": 10.0, + } + ) + cls.main_pos_config.name = "test_pos_sale_picking_keep" + + def test_sale_order_pos_order_done(self): + self.env["stock.quant"]._update_available_quantity( + self.product, self.warehouse.lot_stock_id, 1 + ) + order_form = Form(self.env["sale.order"]) + order_form.partner_id = self.customer + order_form.client_order_ref = "test_pos_sale_picking_keep" + with order_form.order_line.new() as line_form: + line_form.product_id = self.product + sale_order = order_form.save() + sol = sale_order.order_line + self.assertEqual(sol.qty_delivered, 0) + self.main_pos_config.open_ui() + self.start_tour( + f"/pos/ui?config_id={self.main_pos_config.id}", + "PosSalePickingKeep1", + login="accountman", + ) + self.assertEqual(sale_order.state, "sale") + self.assertEqual(len(sale_order.picking_ids), 1) + pos_order = sol.pos_order_line_ids.order_id + self.assertEqual(pos_order.state, "paid") + self.assertFalse(pos_order.picking_ids) + so_picking = sale_order.picking_ids + self.assertEqual(so_picking.state, "assigned") + self.assertEqual(sol.qty_delivered, 0) + sale_order.picking_ids.button_validate() + self.assertEqual(so_picking.state, "done") + self.assertEqual(sol.qty_delivered, 1) + + def test_pos_order_flow(self): + self.main_pos_config.open_ui() + self.start_tour( + f"/pos/ui?config_id={self.main_pos_config.id}", + "PosSalePickingKeep2", + login="accountman", + ) + self.main_pos_config.current_session_id.close_session_from_ui() + pos_order = self.env["pos.order"].search([], order="id desc", limit=1) + self.assertTrue(pos_order) + self.assertEqual(pos_order.state, "done") + self.assertFalse(pos_order.session_id.picking_ids)