Skip to content

Commit

Permalink
[FIX] reset quant values when cancelling the inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
benwillig committed Aug 2, 2024
1 parent e2577ff commit 48178b1
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 57 deletions.
79 changes: 45 additions & 34 deletions stock_inventory/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-08-01 09:58+0000\n"
"Last-Translator: \"Benjamin Willig (ACSONE)\" <[email protected]>\n"
"Language-Team: none\n"
"Language: fr\n"
"POT-Creation-Date: 2024-08-01 11:57+0000\n"
"PO-Revision-Date: 2024-08-01 11:57+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: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 5.6.2\n"
"Plural-Forms: \n"

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__count_stock_quants
Expand Down Expand Up @@ -95,7 +94,7 @@ msgstr "Société"
#. module: stock_inventory
#: model:ir.model,name:stock_inventory.model_res_config_settings
msgid "Config Settings"
msgstr ""
msgstr "Paramètres de config"

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__auto_create_missing_quants
Expand All @@ -115,7 +114,7 @@ msgstr "Créé le"
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__date
msgid "Date"
msgstr "Date"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__display_name
Expand Down Expand Up @@ -155,7 +154,7 @@ msgstr ""
#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__id
msgid "ID"
msgstr "ID"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,help:stock_inventory.field_stock_inventory__message_needaction
Expand All @@ -164,6 +163,7 @@ msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,help:stock_inventory.field_stock_inventory__message_has_error
#: model:ir.model.fields,help:stock_inventory.field_stock_inventory__message_has_sms_error
msgid "If checked, some messages have a delivery error."
msgstr ""

Expand All @@ -176,6 +176,14 @@ msgstr ""
"Si activé, l'inventaire prendra en compte seul les emplacements "
"sélectionnés, et pas leurs enfants."

#. module: stock_inventory
#: model:ir.model.fields,help:stock_inventory.field_res_company__stock_inventory_auto_create_missing_quants
#: model:ir.model.fields,help:stock_inventory.field_res_config_settings__stock_inventory_auto_create_missing_quants
msgid ""
"If enabled, missing quants will be created on the inventory confirmation"
msgstr ""
"Si activé, les quants manquants seront créés au moment de la confirmation de l'inventaire"

#. module: stock_inventory
#: model:ir.model.fields,help:stock_inventory.field_res_company__stock_inventory_auto_complete
#: model:ir.model.fields,help:stock_inventory.field_res_config_settings__stock_inventory_auto_complete
Expand All @@ -184,7 +192,7 @@ msgid ""
"If enabled, when all the quants prepared for the adjustment are done, the "
"adjustment is automatically set to done."
msgstr ""
"Si activé, lorsque tout les quants préparés pour l'ajustement sont finis, "
"Si activé, lorsque tous les quants préparés pour l'ajustement sont finis, "
"l'inventaire sera automatiquement marqué comme terminé."

#. module: stock_inventory
Expand Down Expand Up @@ -275,13 +283,6 @@ msgstr ""
msgid "Messages"
msgstr ""

#. module: stock_inventory
#. odoo-python
#: code:addons/stock_inventory/models/stock_quant.py:0
#, python-format
msgid "No move lines have been created"
msgstr "Aucune ligne de mouvement de stock n'a été créée"

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__message_needaction_counter
msgid "Number of Actions"
Expand Down Expand Up @@ -315,7 +316,7 @@ msgstr "Propriétaire"
#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.stock_inventory_search_view
msgid "Product"
msgstr ""
msgstr "Produit"

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__category_id
Expand All @@ -326,7 +327,7 @@ msgstr "Catégorie d'article"
#. module: stock_inventory
#: model:ir.model,name:stock_inventory.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Mouvements de stock"
msgstr "Mouvements de produit (Ligne de mouvement de stock)"

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__product_selection
Expand All @@ -347,7 +348,12 @@ msgstr ""
#. module: stock_inventory
#: model:ir.model,name:stock_inventory.model_stock_quant
msgid "Quants"
msgstr "Quants"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__message_has_sms_error
msgid "SMS Delivery error"
msgstr ""

#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
Expand Down Expand Up @@ -380,6 +386,12 @@ msgstr "Inventaire de stock"
msgid "Stock Inventory Auto Complete"
msgstr "Fermeture automatique des inventaires"

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_res_company__stock_inventory_auto_create_missing_quants
#: model:ir.model.fields,field_description:stock_inventory.field_res_config_settings__stock_inventory_auto_create_missing_quants
msgid "Stock Inventory Auto Create Missing Quants"
msgstr "Création automatique des quants manquants sur un inventaire"

#. module: stock_inventory
#: model:ir.actions.act_window,name:stock_inventory.action_view_stock_move_line_inventory_tree
msgid "Stock Move Lines"
Expand All @@ -395,8 +407,8 @@ msgstr "Lignes de mouvement de stock"
#: code:addons/stock_inventory/models/stock_inventory.py:0
#, python-format
msgid ""
"There are active adjustments for the requested products: %(names)s. Blocking "
"adjustments: %(blocking_names)s"
"There are active adjustments for the requested products: %(names)s. Blocking"
" adjustments: %(blocking_names)s"
msgstr ""
"Il y a des ajustements actifs pour les produits demandées : %(names)s. "
"Ajustements bloquants: %(blocking_names)s"
Expand All @@ -423,6 +435,11 @@ msgstr "C'est le propriétaire de l'ajustement de stock"
msgid "To Do"
msgstr "A faire"

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_quant__virtual_in_progress_inventory_id
msgid "Virtual In Progress Inventory"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__website_message_ids
msgid "Website Messages"
Expand All @@ -438,8 +455,8 @@ msgstr ""
#: code:addons/stock_inventory/models/stock_inventory.py:0
#, python-format
msgid ""
"When 'Product Selection: Lot Serial Number' is selected you are only able to "
"add one product."
"When 'Product Selection: Lot Serial Number' is selected you are only able to"
" add one product."
msgstr ""
"Quand 'Sélection d'article : Lot/Numéro de série' est sélectionné, vous "
"n'êtes en mesure d'ajouter qu'un seul article."
Expand All @@ -452,8 +469,8 @@ msgid ""
"When 'Product Selection: One Product' is selected you are only able to add "
"one product."
msgstr ""
"Quand 'Sélection d'article : article unique' est sélectionné, vous n'êtes en "
"mesure d'ajouter qu'un seul article."
"Quand 'Sélection d'article : article unique' est sélectionné, vous n'êtes en"
" mesure d'ajouter qu'un seul article."

#. module: stock_inventory
#. odoo-python
Expand All @@ -465,10 +482,4 @@ msgstr "Vous ne pouvez pas annuler cet inventaire %(display_name)s."
#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
msgid "e.g. Annual inventory"
msgstr "par ex. Inventaire annuel"

#, python-format
#~ msgid ""
#~ "There's already an Adjustment in Process using one requested Location: %s"
#~ msgstr ""
#~ "Il y a déjà un ajustement en cours qui utilise l'emplacement demandé : %s"
msgstr "par ex. Inventaire annuel"
37 changes: 28 additions & 9 deletions stock_inventory/i18n/stock_inventory.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-01 11:57+0000\n"
"PO-Revision-Date: 2024-08-01 11:57+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -159,6 +161,7 @@ msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,help:stock_inventory.field_stock_inventory__message_has_error
#: model:ir.model.fields,help:stock_inventory.field_stock_inventory__message_has_sms_error
msgid "If checked, some messages have a delivery error."
msgstr ""

Expand All @@ -169,6 +172,13 @@ msgid ""
"their children."
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,help:stock_inventory.field_res_company__stock_inventory_auto_create_missing_quants
#: model:ir.model.fields,help:stock_inventory.field_res_config_settings__stock_inventory_auto_create_missing_quants
msgid ""
"If enabled, missing quants will be created on the inventory confirmation"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,help:stock_inventory.field_res_company__stock_inventory_auto_complete
#: model:ir.model.fields,help:stock_inventory.field_res_config_settings__stock_inventory_auto_complete
Expand Down Expand Up @@ -266,13 +276,6 @@ msgstr ""
msgid "Messages"
msgstr ""

#. module: stock_inventory
#. odoo-python
#: code:addons/stock_inventory/models/stock_quant.py:0
#, python-format
msgid "No move lines have been created"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__message_needaction_counter
msgid "Number of Actions"
Expand Down Expand Up @@ -340,6 +343,11 @@ msgstr ""
msgid "Quants"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__message_has_sms_error
msgid "SMS Delivery error"
msgstr ""

#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
msgid "Set to Done"
Expand Down Expand Up @@ -371,6 +379,12 @@ msgstr ""
msgid "Stock Inventory Auto Complete"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_res_company__stock_inventory_auto_create_missing_quants
#: model:ir.model.fields,field_description:stock_inventory.field_res_config_settings__stock_inventory_auto_create_missing_quants
msgid "Stock Inventory Auto Create Missing Quants"
msgstr ""

#. module: stock_inventory
#: model:ir.actions.act_window,name:stock_inventory.action_view_stock_move_line_inventory_tree
msgid "Stock Move Lines"
Expand Down Expand Up @@ -410,6 +424,11 @@ msgstr ""
msgid "To Do"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_quant__virtual_in_progress_inventory_id
msgid "Virtual In Progress Inventory"
msgstr ""

#. module: stock_inventory
#: model:ir.model.fields,field_description:stock_inventory.field_stock_inventory__website_message_ids
msgid "Website Messages"
Expand Down Expand Up @@ -448,4 +467,4 @@ msgstr ""
#. module: stock_inventory
#: model_terms:ir.ui.view,arch_db:stock_inventory.view_inventory_group_form
msgid "e.g. Annual inventory"
msgstr ""
msgstr ""
27 changes: 13 additions & 14 deletions stock_inventory/models/stock_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,7 @@ def action_state_to_in_progress(self):
def action_state_to_done(self):
self.ensure_one()
self.state = "done"
self.stock_quant_ids.update(
{
"to_do": False,
"user_id": False,
"inventory_date": False,
}
)
self._reset_quant_inventory_values()
return

def action_auto_state_to_done(self):
Expand All @@ -413,19 +407,14 @@ def action_auto_state_to_done(self):
def action_state_to_draft(self):
self.ensure_one()
self.state = "draft"
self.stock_quant_ids.update(
{
"to_do": False,
"user_id": False,
"inventory_date": False,
}
)
self._reset_quant_inventory_values()
self.stock_quant_ids = None
return

def action_state_to_cancel(self):
self.ensure_one()
self._check_action_state_to_cancel()
self._reset_quant_inventory_values()

Check warning on line 417 in stock_inventory/models/stock_inventory.py

View check run for this annotation

Codecov / codecov/patch

stock_inventory/models/stock_inventory.py#L417

Added line #L417 was not covered by tests
self.write(
{
"state": "cancel",
Expand Down Expand Up @@ -473,6 +462,16 @@ def action_view_stock_moves(self):
result["context"] = {}
return result

def _reset_quant_inventory_values(self):
self.ensure_one()
self.stock_quant_ids.write(
{
"to_do": False,
"user_id": False,
"inventory_date": False,
}
)

def _check_inventory_in_progress_not_override(self):
for rec in self:
if rec.state == "in_progress":
Expand Down

0 comments on commit 48178b1

Please sign in to comment.