Skip to content

Commit ef63061

Browse files
committed
[IMP] sale_picking_quick_confirm user error text
1 parent 65ce142 commit ef63061

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

sale_picking_quick_confirm/i18n/fr.po

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: Odoo Server 16.0\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2025-02-24 09:02+0000\n"
10-
"PO-Revision-Date: 2025-02-24 09:02+0000\n"
9+
"POT-Creation-Date: 2025-03-24 15:12+0000\n"
10+
"PO-Revision-Date: 2025-03-24 15:12+0000\n"
1111
"Last-Translator: \n"
1212
"Language-Team: \n"
1313
"MIME-Version: 1.0\n"
@@ -20,17 +20,10 @@ msgstr ""
2020
msgid "Confirm Sale and Picking"
2121
msgstr "Confirmer Vente et BL"
2222

23-
#. module: sale_picking_quick_confirm
24-
#. odoo-python
25-
#: code:addons/sale_picking_quick_confirm/models/stock_picking.py:0
26-
#, python-format
27-
msgid "Nothing to check the availability for."
28-
msgstr "Aucune ligne où l'on peut vérifier la disponibilité."
29-
3023
#. module: sale_picking_quick_confirm
3124
#: model:ir.model,name:sale_picking_quick_confirm.model_sale_order
3225
msgid "Sales Order"
33-
msgstr "Commandes clients"
26+
msgstr "Commande client"
3427

3528
#. module: sale_picking_quick_confirm
3629
#: model:ir.model,name:sale_picking_quick_confirm.model_stock_move
@@ -44,9 +37,11 @@ msgstr "Transfert"
4437

4538
#. module: sale_picking_quick_confirm
4639
#. odoo-python
47-
#: code:addons/sale_picking_quick_confirm/models/stock_move.py:0
40+
#: code:addons/sale_picking_quick_confirm/models/stock_picking.py:0
4841
#, python-format
4942
msgid ""
50-
"We can't quickly validate picking because there's a move with a null demand."
43+
"We can't quickly validate picking because there's moves with a null demand: "
44+
"%s"
5145
msgstr ""
52-
"On ne peut pas valider rapidement le bon de livraison car il y a une quantité nulle."
46+
"On ne peut pas valider rapidement le bon de livraison car il y a des quantités nulles "
47+
"sur ces lignes : %s"

sale_picking_quick_confirm/models/stock_move.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,14 @@
22
# @author Quentin DUPONT ([email protected])
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
from odoo import _, models
6-
from odoo.exceptions import UserError
5+
from odoo import models
76

87

98
class StockMove(models.Model):
109
_inherit = "stock.move"
1110

1211
def quick_quantity_done(self):
12+
# Handling null quantities upstream in stock_picking quick_confirm()
1313
for move in self:
14-
initial_demand = move.product_uom_qty
15-
if initial_demand:
16-
move.quantity_done = initial_demand
17-
self._quantity_done_set()
18-
else:
19-
raise UserError(
20-
_(
21-
"We can't quickly validate picking because there's a "
22-
"move with a null demand."
23-
)
24-
)
14+
move.quantity_done = move.product_uom_qty
15+
self._quantity_done_set()

sale_picking_quick_confirm/models/stock_picking.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# @author Quentin DUPONT ([email protected])
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
from odoo import models
5+
from odoo import _, models
6+
from odoo.exceptions import UserError
67

78

89
class StockPicking(models.Model):
@@ -13,8 +14,22 @@ def quick_confirm(self):
1314
moves = picking.mapped("move_ids").filtered(
1415
lambda move: move.state not in ("draft", "cancel", "done")
1516
)
16-
# Fill picking moves
17-
for move in moves:
18-
move.quick_quantity_done()
19-
# Validate picking
20-
picking.button_validate()
17+
# Handling null quantities
18+
moves_qty_zero = moves.filtered(lambda x: not x.product_uom_qty).mapped(
19+
"product_id.name"
20+
)
21+
moves_qty_zero_str = ", ".join(map(str, moves_qty_zero))
22+
if moves_qty_zero:
23+
raise UserError(
24+
_(
25+
"We can't quickly validate picking because there's "
26+
"moves with a null demand: %s",
27+
moves_qty_zero_str,
28+
)
29+
)
30+
else:
31+
# Fill picking moves
32+
for move in moves:
33+
move.quick_quantity_done()
34+
# Validate picking
35+
picking.button_validate()

0 commit comments

Comments
 (0)