-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] repair_picking: Migration to 17.0
- Loading branch information
1 parent
dee53f9
commit 25e009b
Showing
13 changed files
with
132 additions
and
120 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
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
from . import models | ||
from . import tests |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from . import stock_warehouse | ||
from . import repair | ||
from . import stock_rule | ||
from . import procurement_group | ||
from . import stock_move |
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,17 @@ | ||
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class ProcurementGroup(models.Model): | ||
_inherit = "procurement.group" | ||
|
||
@api.model | ||
def _get_rule_domain(self, location, values): | ||
domain = super()._get_rule_domain(location, values) | ||
if values.get("source_repair_location_id"): | ||
domain.append( | ||
("location_src_id", "=", values.get("source_repair_location_id")) | ||
) | ||
return domain |
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,22 @@ | ||
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class StockMove(models.Model): | ||
_inherit = "stock.move" | ||
|
||
def _should_be_assigned(self): | ||
if self.repair_id and self._context.get("should_be_assigned", False): | ||
return True | ||
return super()._should_be_assigned() | ||
|
||
@api.model_create_multi | ||
def create(self, vals_list): | ||
moves = super().create(vals_list) | ||
if not self._context.get("should_be_assigned", False): | ||
for move in moves: | ||
if move.repair_id.state in ["confirmed", "under_repair"]: | ||
move.repair_id._action_launch_stock_rule(move) | ||
return moves |
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 |
---|---|---|
@@ -1,17 +1,15 @@ | ||
# Copyright 2023 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, models | ||
from odoo import models | ||
|
||
|
||
class ProcurementGroup(models.Model): | ||
_inherit = "procurement.group" | ||
class StockRule(models.Model): | ||
_inherit = "stock.rule" | ||
|
||
@api.model | ||
def _get_rule_domain(self, location, values): | ||
domain = super(ProcurementGroup, self)._get_rule_domain(location, values) | ||
if values.get("source_repair_location_id"): | ||
domain.append( | ||
("location_src_id", "=", values.get("source_repair_location_id")) | ||
) | ||
return domain | ||
def _get_custom_move_fields(self): | ||
move_fields = super()._get_custom_move_fields() | ||
move_fields += [ | ||
"repair_id", | ||
] | ||
return move_fields |
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
Oops, something went wrong.