diff --git a/sale_picking_quick_confirm/README.rst b/sale_picking_quick_confirm/README.rst index ff423388..e69de29b 100644 --- a/sale_picking_quick_confirm/README.rst +++ b/sale_picking_quick_confirm/README.rst @@ -1,74 +0,0 @@ -================================= -Stock Picking Quick Quantity Done -================================= - -.. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1b9bb641b86c2b0770a72f33cff550bc94afa3ebc5f5052cfd493f6f57c80dc1 - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |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-grap%2Fgrap--odoo--incubator-lightgray.png?logo=github - :target: https://github.com/grap/grap-odoo-incubator/tree/12.0/stock_picking_quick_quantity_done - :alt: grap/grap-odoo-incubator - -|badge1| |badge2| |badge3| - -This module allows you to quickly indicate the done quantities in pickings. -This is useful for activities (such as grocery stores) where product stock -quantities are not well updated, due to lack of time for example. -This is the same objective as the legacy function "Force availability". - -.. figure:: https://raw.githubusercontent.com/grap/grap-odoo-incubator/12.0/stock_picking_quick_quantity_done/static/description/picking.png - -**Table of contents** - -.. contents:: - :local: - -Usage -===== - -This module checks if some "quantities done" in the picking are not equals to -initials demands. If so, "Force availability" button is possible. -User can also set "quantity done" for each line of the picking. - -.. figure:: https://raw.githubusercontent.com/grap/grap-odoo-incubator/12.0/stock_picking_quick_quantity_done/static/description/picking_functionnalities.gif - -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 -~~~~~~~~~~~~ - -* Quentin DUPONT - -Maintainers -~~~~~~~~~~~ - -This module is part of the `grap/grap-odoo-incubator `_ project on GitHub. - -You are welcome to contribute. diff --git a/sale_picking_quick_confirm/i18n/fr.po b/sale_picking_quick_confirm/i18n/fr.po index d88d8548..14eaba9c 100644 --- a/sale_picking_quick_confirm/i18n/fr.po +++ b/sale_picking_quick_confirm/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-21 14:58+0000\n" -"PO-Revision-Date: 2025-02-21 14:58+0000\n" +"POT-Creation-Date: 2025-02-24 09:02+0000\n" +"PO-Revision-Date: 2025-02-24 09:02+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -30,7 +30,7 @@ msgstr "Aucune ligne où l'on peut vérifier la disponibilité." #. module: sale_picking_quick_confirm #: model:ir.model,name:sale_picking_quick_confirm.model_sale_order msgid "Sales Order" -msgstr "Bon de commande" +msgstr "Commandes clients" #. module: sale_picking_quick_confirm #: model:ir.model,name:sale_picking_quick_confirm.model_stock_move @@ -47,8 +47,6 @@ msgstr "Transfert" #: code:addons/sale_picking_quick_confirm/models/stock_move.py:0 #, python-format msgid "" -"We can't quickly set quantity done because there's no initial demand or it's" -" null." +"We can't quickly validate picking because there's a move with a null demand." msgstr "" -"On ne peut pas rapidement définir la valeur de la quantité livrée car il n'y" -"a pas de quantité initiale ou elle est nulle." \ No newline at end of file +"On ne peut pas valider rapidement le bon de livraison car il y a une quantité nulle." \ No newline at end of file diff --git a/sale_picking_quick_confirm/models/stock_move.py b/sale_picking_quick_confirm/models/stock_move.py index b47d1d9e..0e354c31 100644 --- a/sale_picking_quick_confirm/models/stock_move.py +++ b/sale_picking_quick_confirm/models/stock_move.py @@ -18,7 +18,7 @@ def quick_quantity_done(self): else: raise UserError( _( - "We can't quickly set quantity done because there's no " - "initial demand or it's null." + "We can't quickly validate picking because there's a " + "move with a null demand." ) ) diff --git a/sale_picking_quick_confirm/models/stock_picking.py b/sale_picking_quick_confirm/models/stock_picking.py index c3841c13..f35d23b0 100644 --- a/sale_picking_quick_confirm/models/stock_picking.py +++ b/sale_picking_quick_confirm/models/stock_picking.py @@ -2,8 +2,7 @@ # @author Quentin DUPONT (quentin.dupont@grap.coop) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import _, models -from odoo.exceptions import UserError +from odoo import models class StockPicking(models.Model): @@ -14,10 +13,8 @@ def quick_confirm(self): moves = picking.mapped("move_ids").filtered( lambda move: move.state not in ("draft", "cancel", "done") ) - if not moves: - raise UserError(_("Nothing to check the availability for.")) - # Fill picking + # Fill picking moves for move in moves: move.quick_quantity_done() - # Validate SO + # Validate picking picking.button_validate() diff --git a/sale_picking_quick_confirm/tests/test_sale_picking_quick_confirm.py b/sale_picking_quick_confirm/tests/test_sale_picking_quick_confirm.py index 5fe2da48..ff9e19cd 100644 --- a/sale_picking_quick_confirm/tests/test_sale_picking_quick_confirm.py +++ b/sale_picking_quick_confirm/tests/test_sale_picking_quick_confirm.py @@ -1,6 +1,7 @@ # @author Quentin DUPONT # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo.exceptions import UserError from odoo.tests.common import TransactionCase @@ -42,9 +43,15 @@ def setUp(self): } ) - def test_confirm_sale_and_picking(self): + def test_001_confirm_sale_and_picking(self): self.assertEqual(len(self.sale_order_1.picking_ids), 0) self.assertEqual(self.sale_order_1.action_quick_confirm(), True) self.assertEqual(len(self.sale_order_1.picking_ids), 1) for picking in self.sale_order_1.picking_ids: self.assertEqual(picking.state, "done") + + def test_002_null_value_on_picking(self): + self.sale_order_1.action_confirm() + self.sale_order_1.picking_ids.move_ids_without_package[0].product_uom_qty = 0 + with self.assertRaises(UserError): + self.sale_order_1.action_quick_confirm()