Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions web_edit_xmlid/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
===============
Web Edit XML ID
===============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ddf37c3c74bc3c13d6d5c0d380b67aa12ee74662494bdd24e002cde8c9e065b1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
:target: https://github.com/OCA/web/tree/18.0/web_edit_xmlid
:alt: OCA/web
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_edit_xmlid
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module override the default method used to read current record
metadata in order to provide two new actions: Create or Edit XML ID.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

1. Enable the debug mode to show the Developer menu.

2. Click on View Metadata to open the built-in metadata viewer.

3. If the record doesn't have an XML ID, the Create button will call the
same built-in method used during a row export to generate a unique
ID.

*Create a new unique XML ID*

|image|

*XML ID created*

|image1|

4. If the record is already linked to an XML ID, an Edit button will
open a Form to update it.

*Edit an existing XML ID*

|image2|

*XML ID editable form view*

|image3|

*XML ID edited*

|image4|

.. |image| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_edit_xmlid/static/img/xmlid-create.jpg
.. |image1| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_edit_xmlid/static/img/xmlid-created.jpg
.. |image2| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_edit_xmlid/static/img/xmlid-edit.jpg
.. |image3| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_edit_xmlid/static/img/xmlid-editing.jpg
.. |image4| image:: https://raw.githubusercontent.com/OCA/web/18.0/web_edit_xmlid/static/img/xmlid-edited.jpg

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_edit_xmlid%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* DEC

Contributors
------------

- `DEC <https://www.decgroupe.com>`__:

- Yann Papouin <ypa@decgroupe.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-ypapouin| image:: https://github.com/ypapouin.png?size=40px
:target: https://github.com/ypapouin
:alt: ypapouin

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ypapouin|

This module is part of the `OCA/web <https://github.com/OCA/web/tree/18.0/web_edit_xmlid>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions web_edit_xmlid/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions web_edit_xmlid/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Web Edit XML ID",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"category": "Base",
"website": "https://github.com/OCA/web",
"development_status": "Production/Stable",
"author": "DEC, Odoo Community Association (OCA)",
"maintainers": ["ypapouin"],
"depends": [
"web",
],
"data": [],
"qweb": [],
"assets": {
"web.assets_backend": [
"web_edit_xmlid/static/src/core/**/*",
"web_edit_xmlid/static/src/views/**/*",
],
},
"installable": True,
}
58 changes: 58 additions & 0 deletions web_edit_xmlid/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_edit_xmlid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-31 07:11+0000\n"
"PO-Revision-Date: 2021-05-31 09:12+0200\n"
"Last-Translator: Yann Papouin <y.papouin@dec-industrie.com>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 2.3\n"

#. module: web_edit_xmlid
#: model:ir.model,name:web_edit_xmlid.model_base
msgid "Base"
msgstr "Base"

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/xml/base.xml:10
#, python-format
msgid "Create"
msgstr "Créer"

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/xml/base.xml:7
#, python-format
msgid "Edit"
msgstr "Modifier"

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/js/tools/debug_manager.js:81
#, python-format
msgid "Edit XML ID"
msgstr "Modification du XML ID"

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/js/tools/debug_manager.js:41
#, python-format
msgid "Metadata (%s)"
msgstr "Métadonnées (%s)"

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/js/tools/debug_manager.js:25
#, python-format
msgid "No metadata available"
msgstr "Pas de méta-données disponibles"
57 changes: 57 additions & 0 deletions web_edit_xmlid/i18n/web_edit_xmlid.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * web_edit_xmlid
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-31 07:11+0000\n"
"PO-Revision-Date: 2021-05-31 07:11+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: web_edit_xmlid
#: model:ir.model,name:web_edit_xmlid.model_base
msgid "Base"
msgstr ""

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/xml/base.xml:10
#, python-format
msgid "Create"
msgstr ""

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/xml/base.xml:7
#, python-format
msgid "Edit"
msgstr ""

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/js/tools/debug_manager.js:81
#, python-format
msgid "Edit XML ID"
msgstr ""

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/js/tools/debug_manager.js:41
#, python-format
msgid "Metadata (%s)"
msgstr ""

#. module: web_edit_xmlid
#. openerp-web
#: code:addons/web_edit_xmlid/static/src/js/tools/debug_manager.js:25
#, python-format
msgid "No metadata available"
msgstr ""

1 change: 1 addition & 0 deletions web_edit_xmlid/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions web_edit_xmlid/models/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from odoo import models


class BaseModel(models.BaseModel):
_inherit = "base"

def ensure_xml_id(self, skip=False):
"""Public version of `__ensure_xml_id` used by DebugManager.
Since `__ensure_xml_id` use raw SQL queries to create data
standard ORM fields (`create_uid`, `write_uid`) are not filled correctly.
"""
res = self.__ensure_xml_id(skip)
xids = []
for _record, xid in res:
xids.append(self.env["ir.model.data"].xmlid_lookup(xid)[0])
# To avoid having our record manually linked with a XML_ID to be
# deleted when the module that owns this record will be updated, we
# set `noupdate` to True.
# This is done only once since `write_uid` will be set there.
xml_ids = self.env["ir.model.data"].search(
[("id", "in", xids), ("write_uid", "=", False)]
)
xml_ids.write({"noupdate": True})
return res
3 changes: 3 additions & 0 deletions web_edit_xmlid/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions web_edit_xmlid/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [DEC](https://www.decgroupe.com):
- Yann Papouin \<ypa@decgroupe.com\>
2 changes: 2 additions & 0 deletions web_edit_xmlid/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module override the default method used to read current record
metadata in order to provide an Edit XML ID action.
29 changes: 29 additions & 0 deletions web_edit_xmlid/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
To use this module, you need to:

1. Enable the debug mode to show the Developer menu.

2. Click on `Metadata` to open the built-in metadata viewer.

3. If the record doesn't have an XML ID, the `(create)` button will open
the built-in dialog to edit it.

*Create a new XML ID*

![image](../static/img/xmlid-create.jpg)

![image](../static/img/xmlid-creating.jpg)

4. If the record is already linked to one (and only one) XML ID, an `(edit)`
button will open a Form to update it.

*Edit an existing XML ID*

![image](../static/img/xmlid-edit.jpg)

*XML ID editable form view*

![image](../static/img/xmlid-editing.jpg)

*XML ID edited*

![image](../static/img/xmlid-edited.jpg)
Binary file added web_edit_xmlid/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading