-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] stock_quantity_history_location: Migration to 17.0
- refactored .js code by inheriting `get_views` method to display a different button text for those users having the Multi Locations group enabled. Added a test case to cover the change
- Loading branch information
1 parent
910696f
commit c14f7c1
Showing
12 changed files
with
82 additions
and
49 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 +1,2 @@ | ||
from . import wizards | ||
from . import models |
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 @@ | ||
from . import stock_quant |
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 ForgeFlow S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from lxml import etree | ||
|
||
from odoo import api, models | ||
|
||
|
||
class StockQuant(models.Model): | ||
_inherit = "stock.quant" | ||
|
||
@api.model | ||
def get_views(self, views, options=None): | ||
res = super().get_views(views, options=options) | ||
user_has_group = self.user_has_groups("stock.group_stock_multi_locations") | ||
list_view = res.get("views", {}).get("list", {}) | ||
if user_has_group and list_view: | ||
arch = list_view.get("arch", "") | ||
arch_tree = etree.XML(arch) | ||
buttons = arch_tree.xpath('//button[@name="action_inventory_at_date"]') | ||
for button in buttons: | ||
button.set("string", "Inventory at Date & Location") | ||
new_arch = etree.tostring(arch_tree, encoding="unicode") | ||
list_view["arch"] = new_arch | ||
return res |
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,9 +1,15 @@ | ||
- Go to: *Inventory / Reporting / Inventory or Inventory Valuation* | ||
First, you need to activate Storage Locations. To do so, go to | ||
Inventory / Configuration / Settings / Warehouse and activate it. | ||
|
||
To use this module, go to: | ||
- *Inventory / Reporting / Locations* | ||
|
||
- Select Inventory at Date & Location | ||
|
||
- Filter by location | ||
|
||
- **Optionally: Mark if you want to include child location** | ||
|
||
- Choose a moment in time: | ||
- Choose a moment in time: | ||
- Current Inventory | ||
- At a Specific Date |
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
17 changes: 0 additions & 17 deletions
17
..._quantity_history_location/static/src/components/inventory_report/inventory_report.esm.js
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
stock_quantity_history_location/static/src/components/inventory_report/inventory_report.xml
This file was deleted.
Oops, something went wrong.
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
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