-
-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by StefanRijnhart
- Loading branch information
Showing
5 changed files
with
85 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
|
||
from . import models | ||
from . import wizards | ||
from . import exceptions |
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,33 @@ | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import _ | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class SplitPickNotAllowedInStateError(UserError): | ||
""" | ||
Exception class to represent stock picking split error for picking wrong state | ||
""" | ||
|
||
def __init__(self, env, picking): | ||
self.env = env | ||
super().__init__( | ||
_( | ||
"Cannot split picking %(name)s in state %(state)s", | ||
name=picking.name, | ||
state=picking.state, | ||
) | ||
) | ||
|
||
|
||
class NotPossibleToSplitPickError(UserError): | ||
""" | ||
Exception class to represent stock picking split error for picking | ||
""" | ||
|
||
def __init__(self, env, picking): | ||
self.env = env | ||
super().__init__( | ||
_("Cannot split off all moves from picking %(name)s", name=picking.name) | ||
) |
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,45 @@ | ||
# Copyright 2017 Tecnativa - Vicent Cubells <[email protected]> | ||
# Copyright 2018 Camptocamp SA - Julien Coux | ||
# Copyright 2024 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.tests.common import TransactionCase | ||
|
||
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT | ||
|
||
|
||
class TestStockSplitPickingCase(TransactionCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT)) | ||
cls.src_location = cls.env.ref("stock.stock_location_stock") | ||
cls.dest_location = cls.env.ref("stock.stock_location_customers") | ||
cls.product = cls.env["product.product"].create({"name": "Test product"}) | ||
cls.product_2 = cls.env["product.product"].create({"name": "Test product 2"}) | ||
cls.partner = cls.env["res.partner"].create({"name": "Test partner"}) | ||
cls.picking = cls.env["stock.picking"].create( | ||
{ | ||
"partner_id": cls.partner.id, | ||
"picking_type_id": cls.env.ref("stock.picking_type_out").id, | ||
"location_id": cls.src_location.id, | ||
"location_dest_id": cls.dest_location.id, | ||
} | ||
) | ||
|
||
cls.move = cls._create_stock_move(cls.product) | ||
cls.move_2 = cls._create_stock_move(cls.product_2) | ||
|
||
@classmethod | ||
def _create_stock_move(cls, product): | ||
return cls.env["stock.move"].create( | ||
{ | ||
"name": "/", | ||
"picking_id": cls.picking.id, | ||
"product_id": product.id, | ||
"product_uom_qty": 10, | ||
"product_uom": product.uom_id.id, | ||
"location_id": cls.src_location.id, | ||
"location_dest_id": cls.dest_location.id, | ||
} | ||
) |
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