Skip to content

Commit

Permalink
[IMP] tests and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinDupont committed Feb 24, 2025
1 parent 9d20353 commit d2c3e76
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 90 deletions.
74 changes: 0 additions & 74 deletions sale_picking_quick_confirm/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/grap/grap-odoo-incubator/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/grap/grap-odoo-incubator/issues/new?body=module:%20stock_picking_quick_quantity_done%0Aversion:%2012.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
~~~~~~~

* GRAP

Contributors
~~~~~~~~~~~~

* Quentin DUPONT <[email protected]>

Maintainers
~~~~~~~~~~~

This module is part of the `grap/grap-odoo-incubator <https://github.com/grap/grap-odoo-incubator/tree/12.0/stock_picking_quick_quantity_done>`_ project on GitHub.

You are welcome to contribute.
12 changes: 5 additions & 7 deletions sale_picking_quick_confirm/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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."
"On ne peut pas valider rapidement le bon de livraison car il y a une quantité nulle."
4 changes: 2 additions & 2 deletions sale_picking_quick_confirm/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)
)
9 changes: 3 additions & 6 deletions sale_picking_quick_confirm/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# @author Quentin DUPONT ([email protected])
# 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):
Expand All @@ -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()
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# @author Quentin DUPONT <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.exceptions import UserError
from odoo.tests.common import TransactionCase


Expand Down Expand Up @@ -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()

0 comments on commit d2c3e76

Please sign in to comment.