Skip to content
Closed
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
99 changes: 99 additions & 0 deletions stock_move_line_qty_picked/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==========================
Stock Move Line Qty Picked
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ccaacef9cba674378babb125540a0d6d4a8ccc26dac813b228084aa52cb22a97
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_move_line_qty_picked
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_move_line_qty_picked
: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/stock-logistics-workflow&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds a ``qty_picked`` field on ``stock.move.line`` to allow
scanning different quantities without having to update the ``quantity``
field, what would modify existing reservations.

It is meant to restore the behaviour we had in previous versions with
``qty_done`` field, but using another name to avoid clashing with the
field defined in Odoo Enterprise's Stock barcode module.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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 <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_move_line_qty_picked%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Camptocamp
* BCIM

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

- Akim Juillerat <akim.juillerat@camptocamp.com>
- Jacques-Etienne Baudoux (BCIM) <je@bcim.be>

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-grindtildeath| image:: https://github.com/grindtildeath.png?size=40px
:target: https://github.com/grindtildeath
:alt: grindtildeath
.. |maintainer-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px
:target: https://github.com/jbaudoux
:alt: jbaudoux

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-grindtildeath| |maintainer-jbaudoux|

This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_move_line_qty_picked>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions stock_move_line_qty_picked/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions stock_move_line_qty_picked/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Stock Move Line Qty Picked",
"summary": "Separate quantity picked from the reserved quantity",
"version": "18.0.1.3.1",
"development_status": "Beta",
"category": "Inventory",
"website": "https://github.com/OCA/stock-logistics-workflow",
"author": "Camptocamp, BCIM, Odoo Community Association (OCA)",
"maintainers": ["grindtildeath", "jbaudoux"],
"license": "AGPL-3",
"depends": [
"stock",
],
"data": [
"views/stock_move_line.xml",
"views/stock_picking.xml",
],
}
38 changes: 38 additions & 0 deletions stock_move_line_qty_picked/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_line_qty_picked
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-08-02 16:25+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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.10.4\n"

#. module: stock_move_line_qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move_line__picked
msgid "Picked"
msgstr "Prelevato"

#. module: stock_move_line_qty_picked
#: model:ir.model,name:stock_move_line_qty_picked.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Movimenti prodotto (riga movimento di magazzino)"

#. module: stock_move_line_qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move__qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move_line__qty_picked
msgid "Qty Picked"
msgstr "Q.tà prelevata"

#. module: stock_move_line_qty_picked
#: model:ir.model,name:stock_move_line_qty_picked.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"
37 changes: 37 additions & 0 deletions stock_move_line_qty_picked/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_line_qty_picked
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-05-18 09:15+0000\n"
"PO-Revision-Date: 2026-05-18 09:15+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: stock_move_line_qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move_line__picked
msgid "Picked"
msgstr "ピッキング済"

#. module: stock_move_line_qty_picked
#: model:ir.model,name:stock_move_line_qty_picked.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "プロダクト移動(在庫移動明細)"

#. module: stock_move_line_qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move__qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move_line__qty_picked
msgid "Qty Picked"
msgstr "完了数量"

#. module: stock_move_line_qty_picked
#: model:ir.model,name:stock_move_line_qty_picked.model_stock_move
msgid "Stock Move"
msgstr "在庫移動"
35 changes: 35 additions & 0 deletions stock_move_line_qty_picked/i18n/stock_move_line_qty_picked.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_line_qty_picked
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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: stock_move_line_qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move_line__picked
msgid "Picked"
msgstr ""

#. module: stock_move_line_qty_picked
#: model:ir.model,name:stock_move_line_qty_picked.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: stock_move_line_qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move__qty_picked
#: model:ir.model.fields,field_description:stock_move_line_qty_picked.field_stock_move_line__qty_picked
msgid "Qty Picked"
msgstr ""

#. module: stock_move_line_qty_picked
#: model:ir.model,name:stock_move_line_qty_picked.model_stock_move
msgid "Stock Move"
msgstr ""
2 changes: 2 additions & 0 deletions stock_move_line_qty_picked/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_move_line
from . import stock_move
52 changes: 52 additions & 0 deletions stock_move_line_qty_picked/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo import api, fields, models
from odoo.tools import float_compare


class StockMove(models.Model):
_inherit = "stock.move"

qty_picked = fields.Float(
compute="_compute_qty_picked", digits="Product Unit of Measure"
)

@api.depends(
"move_line_ids.picked",
"move_line_ids.product_uom_id",
"move_line_ids.qty_picked",
"move_line_ids.quantity",
"product_uom",
)
def _compute_qty_picked(self):
for move in self:
move.qty_picked = move._sum_ml_qty_picked()

def _get_picked_quantity(self):
if self._ml_has_qty_picked():
return self.qty_picked
return super()._get_picked_quantity()

def _ml_has_qty_picked(self):
return self.picked and any(ml.qty_picked for ml in self.move_line_ids)

def _sum_ml_qty_picked(self):
self.ensure_one()
quantity = 0
for move_line in self.move_line_ids.filtered("picked"):
quantity += move_line.product_uom_id._compute_quantity(
move_line.qty_picked, self.product_uom, round=False
)
return quantity

def _action_done(self, cancel_backorder=False):
for move in self:
for line in move.move_line_ids:
if line.picked and float_compare(
line.qty_picked,
line.quantity,
precision_rounding=line.product_uom_id.rounding,
):
line.quantity = line.qty_picked
return super()._action_done(cancel_backorder=cancel_backorder)
61 changes: 61 additions & 0 deletions stock_move_line_qty_picked/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright 2025 Camptocamp SA
# Copyright 2025 Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import fields, models
from odoo.tools import float_compare


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

picked = fields.Boolean(
# Override std field
inverse="_inverse_picked",
copy=False,
)
qty_picked = fields.Float(
inverse="_inverse_qty_picked", copy=False, digits="Product Unit of Measure"
)

def _inverse_picked(self):
if self.env.context.get("move_line_pick_qty"):
return
for rec in self:
# Reset picked qty to 0
if not rec.picked:
rec._pick_qty(0)
continue
# Pick full quantity when 'picked = True' and no qty were picked
if not rec.qty_picked:
if not rec.quantity:
# When making an inventory with a difference of 0, a move
# and move line are created with a quantity of 0. The move
# is flagged as picked which will flag the move line as
# picked. As the quantity is 0, do not reset picked to
# False otherwise it get's deleted on action_done.
continue
rec._pick_qty(rec.quantity)

def _inverse_qty_picked(self):
if self.env.context.get("move_line_pick_qty"):
return
for rec in self:
rec._pick_qty(rec.qty_picked)

def _pick_qty(self, qty):
self.ensure_one()
values = {
"qty_picked": qty,
"picked": bool(qty),
}
total_demand = self.move_id.product_uom_qty
total_reserved = sum(self.move_id.move_line_ids.mapped("quantity"))
prec = self.env["decimal.precision"].precision_get("Product Unit of Measure")
if (
float_compare(qty, self.quantity, precision_digits=prec) > 0
and float_compare(total_reserved + qty, total_demand, precision_digits=prec)
<= 0
):
values["quantity"] = qty
self.with_context(move_line_pick_qty=True).update(values)
return True
3 changes: 3 additions & 0 deletions stock_move_line_qty_picked/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions stock_move_line_qty_picked/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Akim Juillerat \<<akim.juillerat@camptocamp.com>\>
- Jacques-Etienne Baudoux (BCIM) \<<je@bcim.be>\>
7 changes: 7 additions & 0 deletions stock_move_line_qty_picked/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module adds a `qty_picked` field on `stock.move.line` to allow scanning
different quantities without having to update the `quantity` field, what would
modify existing reservations.

It is meant to restore the behaviour we had in previous versions with `qty_done`
field, but using another name to avoid clashing with the field defined in Odoo
Enterprise's Stock barcode module.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading