[MIG] server_action_navigate: Migration to 14.0

This commit is contained in:
Ashish Hirpara
2022-03-17 18:00:53 +05:30
parent 1206b533ff
commit 297e492d55
8 changed files with 36 additions and 18 deletions

View File

@@ -1 +1,2 @@
from . import models
from .hooks import uninstall_hook

View File

@@ -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",
}

View File

@@ -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()

View File

View File

@@ -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",

View File

@@ -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": {

View File

@@ -1 +1,2 @@
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
* Ashish Hirpara (https://ashish-hirpara.com)

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-backend/tree/13.0/server_action_navigate"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-backend-13-0/server-backend-13-0-server_action_navigate"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/253/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-backend/tree/14.0/server_action_navigate"><img alt="OCA/server-backend" src="https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-server_action_navigate"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/253/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>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 <tt class="docutils literal"><span class="pre">recordset.mapped('field1.field2')</span></tt>.</p>
<p>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.</p>
<li>Create a new item</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/server-backend/13.0/server_action_navigate/static/description/ir_actions_server_form.png" src="https://raw.githubusercontent.com/OCA/server-backend/13.0/server_action_navigate/static/description/ir_actions_server_form.png" />
<img alt="https://raw.githubusercontent.com/OCA/server-backend/14.0/server_action_navigate/static/description/ir_actions_server_form.png" src="https://raw.githubusercontent.com/OCA/server-backend/14.0/server_action_navigate/static/description/ir_actions_server_form.png" />
</div>
<ul class="simple">
<li>Set a name that will be used for the Contextual Action</li>
@@ -419,13 +419,13 @@ button.</li>
<li>click on Action Button</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/server-backend/13.0/server_action_navigate/static/description/sale_order_tree.png" src="https://raw.githubusercontent.com/OCA/server-backend/13.0/server_action_navigate/static/description/sale_order_tree.png" />
<img alt="https://raw.githubusercontent.com/OCA/server-backend/14.0/server_action_navigate/static/description/sale_order_tree.png" src="https://raw.githubusercontent.com/OCA/server-backend/14.0/server_action_navigate/static/description/sale_order_tree.png" />
</div>
<ul class="simple">
<li>then click on the name of the configured Action and see the results</li>
</ul>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/server-backend/13.0/server_action_navigate/static/description/product_product_tree.png" src="https://raw.githubusercontent.com/OCA/server-backend/13.0/server_action_navigate/static/description/product_product_tree.png" />
<img alt="https://raw.githubusercontent.com/OCA/server-backend/14.0/server_action_navigate/static/description/product_product_tree.png" src="https://raw.githubusercontent.com/OCA/server-backend/14.0/server_action_navigate/static/description/product_product_tree.png" />
</div>
</div>
<div class="section" id="bug-tracker">
@@ -433,7 +433,7 @@ button.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-backend/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20server_action_navigate%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/server-backend/issues/new?body=module:%20server_action_navigate%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -442,12 +442,16 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>GRAP</li>
<li>Ashish Hirpara</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple">
<li>Sylvain LE GAL (<a class="reference external" href="https://www.twitter.com/legalsylvain">https://www.twitter.com/legalsylvain</a>)</li>
<li>Ashish Hirpara (<a class="reference external" href="https://ashish-hirpara.com">https://ashish-hirpara.com</a>)</li>
</ul>
</div>
<div class="section" id="maintainers">
@@ -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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/legalsylvain"><img alt="legalsylvain" src="https://github.com/legalsylvain.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/13.0/server_action_navigate">OCA/server-backend</a> project on GitHub.</p>
<p><a class="reference external" href="https://github.com/ashishhirapara"><img alt="legalsylvain" src="https://github.com/ashishhirapara.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-backend/tree/14.0/server_action_navigate">OCA/server-backend</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>