-
-
Notifications
You must be signed in to change notification settings - Fork 193
/
exceptions.py
39 lines (32 loc) · 1.31 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _
from odoo.exceptions import UserError
class NoPickingCandidateError(UserError):
def __init__(self):
super(NoPickingCandidateError, self).__init__(
_("no candidate pickings to batch")
)
class PickingCandidateNumberLineExceedError(UserError):
def __init__(self, picking, max_line):
self.picking = picking
super(PickingCandidateNumberLineExceedError, self).__init__(
_(
"At least one picking candidate found %(name)s but with more line "
"to process than the maximum number of line allowed in a batch "
"picking. (%(max_line)s) vs (%(line)s)",
name=self.picking.name,
max_line=max_line,
line=len(self.picking.move_line_ids),
)
)
class NoSuitableDeviceError(UserError):
def __init__(self, pickings):
self.pickings = pickings
message = _("No device found for batch picking.")
if pickings:
message += _(
" Pickings %(names)s do not match any device",
names=", ".join(self.pickings.mapped("name")),
)
super(NoSuitableDeviceError, self).__init__(message)