Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
25918f5
[ADD] sale_stock_available_info_popup: new module
Apr 22, 2020
16ebb78
Added translation using Weblate (Slovenian)
sysadminmatmoz Aug 11, 2020
4305c4b
[FIX] sale_stock_available_info: ensure test line order
chienandalu Jan 21, 2021
f788ddd
[IMP] sale_stock_available_info_popup: black, isort, prettier
victoralmau Feb 19, 2021
537cd1c
[MIG] sale_stock_available_info_popup: Migration to 13.0
victoralmau Feb 19, 2021
e47c4a3
[FIX] sale_stock_available_info_popup: cache miss
chienandalu Oct 4, 2021
6762758
[FIX] sale_stock_available_info_popup: right context
chienandalu Mar 24, 2022
e1e2ce0
[FIX] sale_stock_available_info_popup: immediately_usable_qty_today t…
cesar-tecnativa Jul 26, 2022
6d25137
[MIG] sale_stock_available_info_popup: Migration to 15.0
victoralmau Oct 27, 2022
cab3940
[IMP] sale_stock_available_info_popup: pre-commit stuff
bvanjeelharia Dec 20, 2022
0fb8212
[MIG] sale_stock_available_info_popup: Migration to 16.0
bvanjeelharia Dec 20, 2022
175a237
Added translation using Weblate (Croatian)
badbole Mar 1, 2023
b416478
Translated using Weblate (Spanish)
Ivorra78 Aug 27, 2023
c27243e
Added translation using Weblate (Italian)
mymage Nov 24, 2023
1e9e8af
[IMP] sale_stock_available_info_popup: pre-commit auto fixes
bizzappdev Apr 25, 2024
40c0a16
[MIG] sale_stock_available_info_popup: Migration to 17.0
bizzappdev Apr 25, 2024
9c41c7d
[IMP] sale_stock_available_info_popup: pre-commit auto fixes
Aug 17, 2026
5631d3e
[MIG] sale_stock_available_info_popup: Migration to 19.0
Aug 17, 2026
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
103 changes: 103 additions & 0 deletions sale_stock_available_info_popup/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

===============================
Sale Stock Available Info Popup
===============================

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

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

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

This module extends the functionality of 'Sale Stock' module to add the
'Available to promise' quantity of the corresponding product to the
pop-up that show stock information at sales order line level.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

1. Go to *Sales > Orders > Quotations* and create a new one.
2. Add a sale order line with a storable product.
3. Click on the chart icon of the line and you will see in the popover
the 'Available to promise' quantity of the corresponding product.

Note: the quantity is computed at the line level, so if the same product
is added in several lines, every line discounts the quantities of the
previous ones. The commitment date of the order and the warehouse of the
line are taken into account as well.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-availability/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-availability/issues/new?body=module:%20sale_stock_available_info_popup%0Aversion:%2019.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
-------

* Tecnativa

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

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

- Ernesto Tejeda
- Pedro M. Baeza
- Víctor Martínez
- César A. Sánchez
- Carlos Roca

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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions sale_stock_available_info_popup/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
20 changes: 20 additions & 0 deletions sale_stock_available_info_popup/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Sale Stock Available Info Popup",
"summary": "Adds an 'Available to promise' quantity to the popover shown "
"in sale order line that display stock info of the product",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-availability",
"category": "Warehouse Management",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"depends": ["sale_stock", "stock_available"],
"assets": {
"web.assets_backend": [
"sale_stock_available_info_popup/static/src/js/qty_at_date_widget.esm.js",
"sale_stock_available_info_popup/static/src/xml/qty_at_date.xml",
],
},
"installable": True,
}
35 changes: 35 additions & 0 deletions sale_stock_available_info_popup/i18n/es.po
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:
# * sale_stock_available_info_popup
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-24 19:48+0000\n"
"PO-Revision-Date: 2023-09-03 13:35+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: sale_stock_available_info_popup
#. odoo-javascript
#: code:addons/sale_stock_available_info_popup/static/src/xml/qty_at_date.xml:0
#, python-format
msgid "Available to promise"
msgstr "Disponible para Prometer"

#. module: sale_stock_available_info_popup
#: model:ir.model.fields,field_description:sale_stock_available_info_popup.field_sale_order_line__immediately_usable_qty_today
msgid "Immediately Usable Qty Today"
msgstr "Cantidad inmediatamente utilizable hoy"

#. module: sale_stock_available_info_popup
#: model:ir.model,name:sale_stock_available_info_popup.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea de pedido de venta"
35 changes: 35 additions & 0 deletions sale_stock_available_info_popup/i18n/hr.po
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:
# * sale_stock_available_info_popup
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-03-01 17:22+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>\n"
"Language-Team: none\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.14.1\n"

#. module: sale_stock_available_info_popup
#. odoo-javascript
#: code:addons/sale_stock_available_info_popup/static/src/xml/qty_at_date.xml:0
#, python-format
msgid "Available to promise"
msgstr "Dostupno za ponuditi"

#. module: sale_stock_available_info_popup
#: model:ir.model.fields,field_description:sale_stock_available_info_popup.field_sale_order_line__immediately_usable_qty_today
msgid "Immediately Usable Qty Today"
msgstr "Danas raspoloživa količina"

#. module: sale_stock_available_info_popup
#: model:ir.model,name:sale_stock_available_info_popup.model_sale_order_line
msgid "Sales Order Line"
msgstr "Stavka prodaje"
34 changes: 34 additions & 0 deletions sale_stock_available_info_popup/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_available_info_popup
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-24 16:35+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 4.17\n"

#. module: sale_stock_available_info_popup
#. odoo-javascript
#: code:addons/sale_stock_available_info_popup/static/src/xml/qty_at_date.xml:0
#, python-format
msgid "Available to promise"
msgstr "Disponibile da promettere"

#. module: sale_stock_available_info_popup
#: model:ir.model.fields,field_description:sale_stock_available_info_popup.field_sale_order_line__immediately_usable_qty_today
msgid "Immediately Usable Qty Today"
msgstr "Quantità immediatamente utilizzabile oggi"

#. module: sale_stock_available_info_popup
#: model:ir.model,name:sale_stock_available_info_popup.model_sale_order_line
msgid "Sales Order Line"
msgstr "Riga ordine di vendita"
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_available_info_popup
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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: sale_stock_available_info_popup
#. odoo-javascript
#: code:addons/sale_stock_available_info_popup/static/src/xml/qty_at_date.xml:0
#, python-format
msgid "Available to promise"
msgstr ""

#. module: sale_stock_available_info_popup
#: model:ir.model.fields,field_description:sale_stock_available_info_popup.field_sale_order_line__immediately_usable_qty_today
msgid "Immediately Usable Qty Today"
msgstr ""

#. module: sale_stock_available_info_popup
#: model:ir.model,name:sale_stock_available_info_popup.model_sale_order_line
msgid "Sales Order Line"
msgstr ""
43 changes: 43 additions & 0 deletions sale_stock_available_info_popup/i18n/sl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_available_info_popup
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-08-11 10:59+0000\n"
"Last-Translator: Matjaz Mozetic <matjaz@matmoz.si>\n"
"Language-Team: none\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3;\n"
"X-Generator: Weblate 3.10\n"

#. module: sale_stock_available_info_popup
#. odoo-javascript
#: code:addons/sale_stock_available_info_popup/static/src/xml/qty_at_date.xml:0
#, python-format
msgid "Available to promise"
msgstr "Lahko obljubimo"

#. module: sale_stock_available_info_popup
#: model:ir.model.fields,field_description:sale_stock_available_info_popup.field_sale_order_line__immediately_usable_qty_today
msgid "Immediately Usable Qty Today"
msgstr "Takoj razpoložljiva današnja kol"

#. module: sale_stock_available_info_popup
#: model:ir.model,name:sale_stock_available_info_popup.model_sale_order_line
msgid "Sales Order Line"
msgstr "Prodajna postavka"

#, python-format
#~ msgid ""
#~ "widget.data.immediately_usable_qty_today < widget.data.qty_to_deliver "
#~ "and !widget.data.is_mto"
#~ msgstr ""
#~ "widget.data.immediately_usable_qty_today < widget.data.qty_to_deliver "
#~ "and !widget.data.is_mto"
3 changes: 3 additions & 0 deletions sale_stock_available_info_popup/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import sale_order
48 changes: 48 additions & 0 deletions sale_stock_available_info_popup/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from collections import defaultdict

from odoo import api, fields, models


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

immediately_usable_qty_today = fields.Float(
compute="_compute_immediately_usable_qty_today"
)

@api.depends(
"product_id",
"product_uom_qty",
"product_uom_id",
"scheduled_date",
"order_id.date_order",
"warehouse_id",
)
def _compute_immediately_usable_qty_today(self):
qty_processed_per_product = defaultdict(float)
self.immediately_usable_qty_today = False
for line in self.sorted(key=lambda r: r.sequence):
if not line.display_qty_widget:
continue
# `warehouse` isn't a valid context key anymore since 19.0, the stock
# quantities are only filtered by `warehouse_id`
product = line.product_id.with_context(
to_date=line.scheduled_date, warehouse_id=line.warehouse_id.id
)
qty_processed = qty_processed_per_product[product.id]
qty = product.immediately_usable_qty - qty_processed
# Quantities are expressed in the product UoM, but the popover shows the
# line one, so we convert them as Odoo does with the other quantities
product_uom = line.product_id.uom_id
line_uom = line.product_uom_id
product_uom_qty = line.product_uom_qty
if line_uom and product_uom and line_uom != product_uom:
qty = product_uom._compute_quantity(qty, line_uom)
product_uom_qty = line_uom._compute_quantity(
line.product_uom_qty, product_uom
)
line.immediately_usable_qty_today = qty
qty_processed_per_product[product.id] += product_uom_qty
3 changes: 3 additions & 0 deletions sale_stock_available_info_popup/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
6 changes: 6 additions & 0 deletions sale_stock_available_info_popup/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- [Tecnativa](https://www.tecnativa.com):
- Ernesto Tejeda
- Pedro M. Baeza
- Víctor Martínez
- César A. Sánchez
- Carlos Roca
3 changes: 3 additions & 0 deletions sale_stock_available_info_popup/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module extends the functionality of 'Sale Stock' module to add the
'Available to promise' quantity of the corresponding product to the
pop-up that show stock information at sales order line level.
11 changes: 11 additions & 0 deletions sale_stock_available_info_popup/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
To use this module, you need to:

1. Go to *Sales \> Orders \> Quotations* and create a new one.
2. Add a sale order line with a storable product.
3. Click on the chart icon of the line and you will see in the popover
the 'Available to promise' quantity of the corresponding product.

Note: the quantity is computed at the line level, so if the same product
is added in several lines, every line discounts the quantities of the
previous ones. The commitment date of the order and the warehouse of the
line are taken into account as well.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading