-
-
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.
[FIX] stock_scrap_tier_validation: workaround added to escape client …
…error when pressing scrap from picking Co-authored-by: Eugene Molotov <[email protected]>
- Loading branch information
1 parent
1c4f350
commit 61c2ddc
Showing
4 changed files
with
68 additions
and
0 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Copyright 2023 Jarsa | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import stock_picking | ||
from . import stock_scrap | ||
from . import tier_definition |
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,25 @@ | ||
# Copyright 2024 360ERP (<https://www.360erp.com>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
def button_scrap(self): | ||
"""Fix compatibility with stock_scrap_tier_validation. | ||
The way that super opens the scrap form in a popup window prevents | ||
the tier validation UI elements from being effective. The record is | ||
only saved when closing the popup. Given that it's only possible to | ||
check if the record needs validation after saving, the popup will | ||
always raise the 'validation required' error which blocks saving it. | ||
As a workaround, we open the unsaved scrap record in the main window | ||
so that it can be saved first and then be requested validation for | ||
in the usual way. | ||
""" | ||
action = super().button_scrap() | ||
action.pop("target") | ||
return action |
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