Browse Source

[MIG] server_action_navigate: Migration to 14.0

14.0
Ashish Hirpara 2 years ago
parent
commit
297e492d55
  1. 1
      server_action_navigate/__init__.py
  2. 7
      server_action_navigate/__manifest__.py
  3. 7
      server_action_navigate/hooks.py
  4. 0
      server_action_navigate/i18n/it.po
  5. 4
      server_action_navigate/models/ir_actions_server.py
  6. 16
      server_action_navigate/models/ir_actions_server_navigate_line.py
  7. 1
      server_action_navigate/readme/CONTRIBUTORS.rst
  8. 18
      server_action_navigate/static/description/index.html

1
server_action_navigate/__init__.py

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

7
server_action_navigate/__manifest__.py

@ -4,14 +4,15 @@
{ {
"name": "Server Actions - Navigate", "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", "summary": "Navigate between any items of any Odoo Models",
"category": "Tools", "category": "Tools",
"website": "https://github.com/OCA/server-backend", "website": "https://github.com/OCA/server-backend",
"license": "AGPL-3", "license": "AGPL-3",
"depends": ["base"], "depends": ["base"],
"maintainers": ["legalsylvain"],
"maintainers": ["legalsylvain", "ashishhirpara"],
"data": ["security/ir.model.access.csv", "views/view_ir_actions_server.xml"], "data": ["security/ir.model.access.csv", "views/view_ir_actions_server.xml"],
"demo": ["demo/ir_actions_server.xml"], "demo": ["demo/ir_actions_server.xml"],
"uninstall_hook": "uninstall_hook",
} }

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

0
server_action_navigate/i18n/it.po

4
server_action_navigate/models/ir_actions_server.py

@ -9,7 +9,9 @@ from odoo.exceptions import UserError
class IrActionsServer(models.Model): class IrActionsServer(models.Model):
_inherit = "ir.actions.server" _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( navigate_action_id = fields.Many2one(
string="Navigation Action", string="Navigation Action",

16
server_action_navigate/models/ir_actions_server_navigate_line.py

@ -22,19 +22,21 @@ class IrActionsServerNavigateLine(models.Model):
) )
field_id = fields.Many2one( 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 # when adding a record, onchange is called for every field on the
# form, also in editable list views # form, also in editable list views
@api.onchange("field_id") @api.onchange("field_id")
def _onchange_field_id(self): 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 model = lines[-1:].field_id.relation or self.action_id.model_id.model
return { return {
"domain": { "domain": {

1
server_action_navigate/readme/CONTRIBUTORS.rst

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

18
server_action_navigate/static/description/index.html

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! 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 <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> 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 <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> <li>Create a new item</li>
</ul> </ul>
<div class="figure"> <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> </div>
<ul class="simple"> <ul class="simple">
<li>Set a name that will be used for the Contextual Action</li> <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> <li>click on ‘Action’ Button</li>
</ul> </ul>
<div class="figure"> <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> </div>
<ul class="simple"> <ul class="simple">
<li>then click on the name of the configured Action and see the results</li> <li>then click on the name of the configured Action and see the results</li>
</ul> </ul>
<div class="figure"> <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> </div>
<div class="section" id="bug-tracker"> <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>. <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. 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 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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <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> <h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>GRAP</li> <li>GRAP</li>
<li>Ashish Hirpara</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id6">Contributors</a></h2> <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple"> <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>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> </ul>
</div> </div>
<div class="section" id="maintainers"> <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 mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</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> <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>
</div> </div>

Loading…
Cancel
Save