Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions pos_sale_picking_keep/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. 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
===========================
Expand All @@ -17,7 +13,7 @@ Keep sale pickings from PoS
.. |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
.. |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
Expand Down Expand Up @@ -70,6 +66,18 @@ Authors

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__

- Pedro M. Baeza
- Víctor Martínez

- `ACSONE SA/NV <https://acsone.eu>`__:

- Denis Roussel <denis.roussel@acsone.eu>

Maintainers
-----------

Expand Down
1 change: 1 addition & 0 deletions pos_sale_picking_keep/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "AGPL-3",
"installable": True,
"depends": ["pos_sale"],
"data": [],
"assets": {
"web.assets_tests": [
"pos_sale_picking_keep/static/tests/tours/**/*",
Expand Down
2 changes: 2 additions & 0 deletions pos_sale_picking_keep/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
from . import pos_order
from . import pos_session
from . import sale_order_line
from . import pos_order_line
from . import stock_picking
14 changes: 0 additions & 14 deletions pos_sale_picking_keep/models/pos_order.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# 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):
Expand Down Expand Up @@ -32,16 +31,3 @@ def sync_from_ui(self, orders):
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
18 changes: 18 additions & 0 deletions pos_sale_picking_keep/models/pos_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2026 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models


class PosOrderLine(models.Model):
_inherit = "pos.order.line"

def _launch_stock_rule_from_pos_order_lines(self):
"""
Launch stock rules for pos order lines that are not linked to a sale order line
"""
lines_to_launch = self.filtered(lambda line: not line.sale_order_line_id)
if lines_to_launch:
super(
PosOrderLine, lines_to_launch
)._launch_stock_rule_from_pos_order_lines()
return True
24 changes: 24 additions & 0 deletions pos_sale_picking_keep/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2026 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models


class StockPicking(models.Model):
_inherit = "stock.picking"

@api.model
def _create_picking_from_pos_order_lines(
self, location_dest_id, lines, picking_type, partner=False
):
"""
Avoid cancelling existing pickings and re-launching stock rules from
POS line if linked to a sale order line and with a strategy
to keep sale pickings.
"""
lines_without_create = lines.filtered(lambda line: line.sale_order_line_id)
return super()._create_picking_from_pos_order_lines(
location_dest_id=location_dest_id,
lines=(lines - lines_without_create),
picking_type=picking_type,
partner=partner,
)
6 changes: 6 additions & 0 deletions pos_sale_picking_keep/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- [Tecnativa](https://www.tecnativa.com)
- Pedro M. Baeza
- Víctor Martínez

- [ACSONE SA/NV](https://acsone.eu):
- Denis Roussel \<<denis.roussel@acsone.eu>\>
41 changes: 25 additions & 16 deletions pos_sale_picking_keep/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Keep sale pickings from PoS</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="keep-sale-pickings-from-pos">
<h1 class="title">Keep sale pickings from PoS</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="keep-sale-pickings-from-pos">
<h1>Keep sale pickings from PoS</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:14008524ac2e970ae97eda09273f81e2fc25b02a6ccf008e85f4473f3d637815
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/18.0/pos_sale_picking_keep"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-18-0/pos-18-0-pos_sale_picking_keep"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/18.0/pos_sale_picking_keep"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-18-0/pos-18-0-pos_sale_picking_keep"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
Expand All @@ -385,13 +380,14 @@ <h1>Keep sale pickings from PoS</h1>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="use-cases-context">
<h2><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h1>
<p>In some scenarios, you may not want that the point of sale (PoS) handles
the pickings of the products you are paying:</p>
<ul class="simple">
Expand All @@ -401,23 +397,37 @@ <h2><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h2>
<p>In that cases, it’s better to keep the original sales pickings.</p>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/pos/issues/new?body=module:%20pos_sale_picking_keep%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a><ul>
<li>Pedro M. Baeza</li>
<li>Víctor Martínez</li>
</ul>
</li>
<li><a class="reference external" href="https://acsone.eu">ACSONE SA/NV</a>:<ul>
<li>Denis Roussel &lt;<a class="reference external" href="mailto:denis.roussel&#64;acsone.eu">denis.roussel&#64;acsone.eu</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -432,6 +442,5 @@ <h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@ registry.category("web_tour.tours").add("PosSalePickingKeep2", {
PaymentScreen.clickValidate(),
].flat(),
});

registry.category("web_tour.tours").add("PosSalePickingKeepMixed", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Test Product", "1.00"),
ProductScreen.addOrderline("Test Product 2"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank", true, {remaining: "0.0"}),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
1 change: 1 addition & 0 deletions pos_sale_picking_keep/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import test_pos_sale_picking_keep
from . import test_pos_sale_picking_keep_realtime
33 changes: 33 additions & 0 deletions pos_sale_picking_keep/tests/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2026 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import odoo.tests

from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon


@odoo.tests.tagged("post_install", "-at_install")
class PosSalePickingKeepCommon(TestPointOfSaleHttpCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
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.product_2 = cls.env["product.product"].create(
{
"name": "Test Product 2",
"available_in_pos": True,
"is_storable": True,
"lst_price": 10.0,
}
)
cls.main_pos_config.name = "test_pos_sale_picking_keep"
25 changes: 4 additions & 21 deletions pos_sale_picking_keep/tests/test_pos_sale_picking_keep.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
# 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
from .common import PosSalePickingKeepCommon


@odoo.tests.tagged("post_install", "-at_install")
class TestPosSalePickingKeep(TestPointOfSaleHttpCommon):
class TestPosSalePickingKeep(PosSalePickingKeepCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
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(
Expand All @@ -39,8 +24,7 @@ def test_sale_order_pos_order_done(self):
sol = sale_order.order_line
self.assertEqual(sol.qty_delivered, 0)
self.main_pos_config.open_ui()
self.start_tour(
"/pos/ui?config_id=%d" % self.main_pos_config.id,
self.start_pos_tour(
"PosSalePickingKeep1",
login="accountman",
)
Expand All @@ -58,8 +42,7 @@ def test_sale_order_pos_order_done(self):

def test_pos_order_flow(self):
self.main_pos_config.open_ui()
self.start_tour(
"/pos/ui?config_id=%d" % self.main_pos_config.id,
self.start_pos_tour(
"PosSalePickingKeep2",
login="accountman",
)
Expand Down
Loading
Loading