Skip to content

Commit

Permalink
[ADD] Docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
angelinaanaki committed Nov 15, 2023
1 parent 8b5b8ab commit f2fa39a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions stock_quant_package_fast_move/models/stock_quant_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class StockQuantPackage(models.Model):
_inherit = "stock.quant.package"

def action_show_package_fast_move_wizard(self):
"""Open wizard for fast package movement."""
return {

Check warning on line 12 in stock_quant_package_fast_move/models/stock_quant_package.py

View check run for this annotation

Codecov / codecov/patch

stock_quant_package_fast_move/models/stock_quant_package.py#L12

Added line #L12 was not covered by tests
"type": "ir.actions.act_window",
"name": _("Move Packages"),
Expand All @@ -21,6 +22,21 @@ def action_show_package_fast_move_wizard(self):
}

def _move_to_location(self, location, destination_package=None):
"""
Move packages to a specified location.
Parameters:
- location (recordset of stock.location): The destination location.
- destination_package (recordset of stock.quant.package, optional):
Optional destination package. If provided, it must belong to the specified location.
Returns:
- bool: True if the move is successful.
Raises:
- exceptions.UserError: If the destination location is the same as the current location
or if the destination package does not belong to the specified location.
"""
# Check if the location is different from the current location
if location == self[0].location_id:
raise exceptions.UserError(
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class StockQuantPackageFastMoveWizard(models.TransientModel):
)

def action_move(self):
"""
Execute the package movement based on the specified parameters.
"""
package_ids = self._context.get("active_ids")
packages = self.env["stock.quant.package"].browse(package_ids)
if any(package.location_id != packages[0].location_id for package in packages):
Expand Down

0 comments on commit f2fa39a

Please sign in to comment.