-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TA#70700 [14.0][ADD] stock_picking_remove_reservation (#193)
- Loading branch information
1 parent
65a080d
commit 2ed79fb
Showing
14 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Stock Picking Remove Reservation | ||
================================ | ||
Odoo provides a server action called 'Correct inconsistencies for reservation' to fix any | ||
desynchronization between quants and their move lines. | ||
|
||
This action is only accessible via the server actions menu in the technical panel. | ||
|
||
This module allows the same feature to be integrated directly into the stock picking | ||
form and unreserve move lines for the active picking. | ||
|
||
Usage | ||
----- | ||
As a user with access to transfers (stock picking), when I receive the error message: | ||
|
||
.. image:: static/description/stock_picking_error_message.png | ||
|
||
I need to click on "Desynchronize the reservation." | ||
|
||
.. image:: static/description/stock_picking_select_items.png | ||
|
||
.. image:: static/description/stock_picking_remove_reservation.png | ||
|
||
|
||
|
||
|
||
|
||
Contributors | ||
------------ | ||
* Numigi (tm) and all its contributors (https://bit.ly/numigiens) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Picking Remove Reservation", | ||
"version": "14.0.1.0.0", | ||
"author": "Numigi", | ||
"maintainer": "Numigi", | ||
"website": "https://bit.ly/numigi-com", | ||
"license": "AGPL-3", | ||
"category": "Stock", | ||
"depends": ["stock"], | ||
"summary": "Allow to force stock picking unreservation.", | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"wizard/stock_picking_unreserve_view.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_picking_remove_reservation | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-04 21:14+0000\n" | ||
"PO-Revision-Date: 2024-11-04 21:14+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_picking_remove_reservation | ||
#: model_terms:ir.ui.view,arch_db:stock_picking_remove_reservation.stock_picking_unreserve_view | ||
msgid "Cancel" | ||
msgstr "Annuler" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.model.fields,field_description:stock_picking_remove_reservation.field_stock_picking_unreserve__create_uid | ||
msgid "Created by" | ||
msgstr "Créé par" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.model.fields,field_description:stock_picking_remove_reservation.field_stock_picking_unreserve__create_date | ||
msgid "Created on" | ||
msgstr "Créé le" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.model.fields,field_description:stock_picking_remove_reservation.field_stock_picking_unreserve__display_name | ||
msgid "Display Name" | ||
msgstr "Nom d'affichage" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.model.fields,field_description:stock_picking_remove_reservation.field_stock_picking_unreserve__id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.model.fields,field_description:stock_picking_remove_reservation.field_stock_picking_unreserve____last_update | ||
msgid "Last Modified on" | ||
msgstr "Dernière mise-à-jour le" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.model.fields,field_description:stock_picking_remove_reservation.field_stock_picking_unreserve__write_uid | ||
msgid "Last Updated by" | ||
msgstr "Dernière mise à jour par" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.model.fields,field_description:stock_picking_remove_reservation.field_stock_picking_unreserve__write_date | ||
msgid "Last Updated on" | ||
msgstr "Dernière mise à jour le" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.actions.act_window,name:stock_picking_remove_reservation.action_stock_picking_unreserve | ||
msgid "Remove reservation" | ||
msgstr "Supprimer la réservation" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model_terms:ir.ui.view,arch_db:stock_picking_remove_reservation.stock_picking_unreserve_view | ||
msgid "Unreserve" | ||
msgstr "Annuler la réservation" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model_terms:ir.ui.view,arch_db:stock_picking_remove_reservation.stock_picking_unreserve_view | ||
msgid "Unreserve Stock Move Lines" | ||
msgstr "Annuler la réservation des lignes de mouvement de stock" | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model_terms:ir.ui.view,arch_db:stock_picking_remove_reservation.stock_picking_unreserve_view | ||
msgid "" | ||
"You should run this action only when you encounter a picking validation " | ||
"issue related to the reservation" | ||
msgstr "" | ||
"Vous ne devez exécuter cette action que lorsque vous rencontrez un problème de " | ||
"validation de picking lié à la réservation." | ||
|
||
#. module: stock_picking_remove_reservation | ||
#: model:ir.model,name:stock_picking_remove_reservation.model_stock_picking_unreserve | ||
msgid "stock.picking.unreserve" | ||
msgstr "" |
2 changes: 2 additions & 0 deletions
2
stock_picking_remove_reservation/security/ir.model.access.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_stock_picking_unreserve,access_stock_picking_unreserve,model_stock_picking_unreserve,stock.group_stock_manager,1,1,1,1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.2 KB
...k_picking_remove_reservation/static/description/stock_picking_error_message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28 KB
...king_remove_reservation/static/description/stock_picking_remove_reservation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+244 KB
stock_picking_remove_reservation/static/description/stock_picking_select_items.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import stock_picking_unreserve |
37 changes: 37 additions & 0 deletions
37
stock_picking_remove_reservation/wizard/stock_picking_unreserve.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# © 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockPickingUnreserve(models.TransientModel): | ||
_name = "stock.picking.unreserve" | ||
|
||
def action_remove_reservation(self): | ||
"""" | ||
This function was inspired by the server action Correct inconsistencies for | ||
reservation and allows for the desynchronization of the active pickings | ||
""" | ||
context = dict(self._context or {}) | ||
if context.get('active_ids', False): | ||
picking_ids = self.env['stock.picking'].browse(context.get('active_ids')) | ||
for picking in picking_ids: | ||
move_line_to_recompute_ids = [] | ||
picking.move_line_ids.with_context(bypass_reservation_update=True).sudo().write( | ||
{'product_uom_qty': 0}) | ||
move_line_to_recompute_ids += picking.move_line_ids.ids | ||
for line in picking.move_line_ids: | ||
quants = self.env['stock.quant'].search([ | ||
('product_id', '=', line.product_id.id), | ||
('location_id', '=', line.location_id.id), | ||
('lot_id', '=', line.lot_id.id), | ||
('package_id', '=', line.package_id.id), | ||
('owner_id', '=', line.owner_id.id), | ||
('quantity', '!=', 0)]) | ||
for quant in quants: | ||
quant.sudo().write({'reserved_quantity': 0}) | ||
if move_line_to_recompute_ids: | ||
self.env['stock.move.line'].browse( | ||
move_line_to_recompute_ids).move_id._recompute_state() | ||
|
||
return {'type': 'ir.actions.act_window_close'} |
32 changes: 32 additions & 0 deletions
32
stock_picking_remove_reservation/wizard/stock_picking_unreserve_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data> | ||
|
||
<record id="stock_picking_unreserve_view" model="ir.ui.view"> | ||
<field name="name">Unreserve Stock Move Lines</field> | ||
<field name="model">stock.picking.unreserve</field> | ||
<field name="arch" type="xml"> | ||
<form string="Unreserve"> | ||
<separator string="Unreserve Stock Move Lines"/> | ||
<form class="o_form_label">You should run this action only when you encounter a picking validation issue related to the reservation</form> | ||
<footer> | ||
<button string="Unreserve" name="action_remove_reservation" type="object" default_focus="1" class="btn-primary"/> | ||
<button string="Cancel" class="btn-secondary" special="cancel"/> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="action_stock_picking_unreserve" model="ir.actions.act_window"> | ||
<field name="name">Remove reservation</field> | ||
<field name="groups_id" eval="[(4,ref('stock.group_stock_manager'))]"/> | ||
<field name="res_model">stock.picking.unreserve</field> | ||
<field name="view_mode">form</field> | ||
<field name="view_id" ref="stock_picking_unreserve_view"/> | ||
<field name="target">new</field> | ||
<field name="binding_model_id" ref="stock.model_stock_picking" /> | ||
<field name="binding_view_types">list</field> | ||
</record> | ||
|
||
</data> | ||
</odoo> |