diff --git a/server_action_navigate/__init__.py b/server_action_navigate/__init__.py
index 0650744f6..071962a35 100644
--- a/server_action_navigate/__init__.py
+++ b/server_action_navigate/__init__.py
@@ -1 +1,2 @@
from . import models
+from .hooks import uninstall_hook
diff --git a/server_action_navigate/__manifest__.py b/server_action_navigate/__manifest__.py
index ea965ea79..45d294193 100644
--- a/server_action_navigate/__manifest__.py
+++ b/server_action_navigate/__manifest__.py
@@ -4,14 +4,15 @@
{
"name": "Server Actions - Navigate",
- "version": "13.0.1.0.0",
- "author": "GRAP, " "Odoo Community Association (OCA)",
+ "version": "14.0.1.0.0",
+ "author": "GRAP, Odoo Community Association (OCA)",
"summary": "Navigate between any items of any Odoo Models",
"category": "Tools",
"website": "https://github.com/OCA/server-backend",
"license": "AGPL-3",
"depends": ["base"],
- "maintainers": ["legalsylvain"],
+ "maintainers": ["legalsylvain", "ashishhirpara"],
"data": ["security/ir.model.access.csv", "views/view_ir_actions_server.xml"],
"demo": ["demo/ir_actions_server.xml"],
+ "uninstall_hook": "uninstall_hook",
}
diff --git a/server_action_navigate/hooks.py b/server_action_navigate/hooks.py
new file mode 100644
index 000000000..6346e2bab
--- /dev/null
+++ b/server_action_navigate/hooks.py
@@ -0,0 +1,7 @@
+from odoo import SUPERUSER_ID, api
+
+
+def uninstall_hook(cr, registry):
+ env = api.Environment(cr, SUPERUSER_ID, {})
+ env["ir.actions.server.navigate.line"].search([]).unlink()
+ env["ir.actions.server"].search([("state", "=", "navigate")]).unlink()
diff --git a/server_action_navigate/i18n/it.po b/server_action_navigate/i18n/it.po
new file mode 100644
index 000000000..e69de29bb
diff --git a/server_action_navigate/models/ir_actions_server.py b/server_action_navigate/models/ir_actions_server.py
index 5395cbba8..f59842806 100644
--- a/server_action_navigate/models/ir_actions_server.py
+++ b/server_action_navigate/models/ir_actions_server.py
@@ -9,7 +9,9 @@ from odoo.exceptions import UserError
class IrActionsServer(models.Model):
_inherit = "ir.actions.server"
- state = fields.Selection(selection_add=[("navigate", "Navigate")])
+ state = fields.Selection(
+ selection_add=[("navigate", "Navigate")], ondelete={"navigate": "set default"}
+ )
navigate_action_id = fields.Many2one(
string="Navigation Action",
diff --git a/server_action_navigate/models/ir_actions_server_navigate_line.py b/server_action_navigate/models/ir_actions_server_navigate_line.py
index 4daa8ff10..07343d410 100644
--- a/server_action_navigate/models/ir_actions_server_navigate_line.py
+++ b/server_action_navigate/models/ir_actions_server_navigate_line.py
@@ -22,19 +22,21 @@ class IrActionsServerNavigateLine(models.Model):
)
field_id = fields.Many2one(
- comodel_name="ir.model.fields", string="Field", required=True
+ comodel_name="ir.model.fields",
+ string="Field",
+ required=True,
+ ondelete="cascade",
)
# when adding a record, onchange is called for every field on the
# form, also in editable list views
@api.onchange("field_id")
def _onchange_field_id(self):
- # check out the docstring of this in odoo/models.py
- lines = self.action_id.resolve_2many_commands(
- "navigate_line_ids",
- self.env.context.get("navigate_line_ids", []),
- )
- lines = sum(map(self.new, lines), self.browse([]))
+
+ lines = self.action_id.new(
+ {"navigate_line_ids": self.env.context.get("navigate_line_ids", [])}
+ ).navigate_line_ids
+
model = lines[-1:].field_id.relation or self.action_id.model_id.model
return {
"domain": {
diff --git a/server_action_navigate/readme/CONTRIBUTORS.rst b/server_action_navigate/readme/CONTRIBUTORS.rst
index e1525ce04..6da162667 100644
--- a/server_action_navigate/readme/CONTRIBUTORS.rst
+++ b/server_action_navigate/readme/CONTRIBUTORS.rst
@@ -1 +1,2 @@
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
+* Ashish Hirpara (https://ashish-hirpara.com)
diff --git a/server_action_navigate/static/description/index.html b/server_action_navigate/static/description/index.html
index eeac420e2..70c5af21e 100644
--- a/server_action_navigate/static/description/index.html
+++ b/server_action_navigate/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module provides a generic tool to have the possibility to see a list of
records associated to a given selection of records. This is basically the UI version of recordset.mapped('field1.field2').
For example, if you use the sale module, you can configure an action to see
@@ -393,7 +393,7 @@ all the products that have been sold for a given selection of sale orders.
Create a new item
- Set a name that will be used for the Contextual Action
@@ -419,13 +419,13 @@ button.
- click on ‘Action’ Button
- then click on the name of the configured Action and see the results
@@ -433,7 +433,7 @@ button.
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+
feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -442,12 +442,16 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
@@ -458,8 +462,8 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
mission is to support the collaborative development of Odoo features and
promote its widespread use.
Current maintainer:
-
-
This module is part of the OCA/server-backend project on GitHub.
+
+
This module is part of the OCA/server-backend project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.