Skip to content

Commit

Permalink
[ADD] server_action_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed Aug 24, 2023
1 parent 542fe0c commit 0298e46
Show file tree
Hide file tree
Showing 43 changed files with 1,878 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# generated from manifests external_dependencies
openupgradelib
pdf2image
python-stdnum
pyzbar
Expand Down
110 changes: 110 additions & 0 deletions server_action_merge/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
=============
Merge records
=============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |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%2Fserver--ux-lightgray.png?logo=github
:target: https://github.com/OCA/server-ux/tree/13.0/server_action_merge
:alt: OCA/server-ux
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-ux-13-0/server-ux-13-0-server_action_merge
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/250/13.0
:alt: Try me on Runbot

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

This module allows users to merge records of arbitrary models.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

#. Go to Settings/Technical/Server actions
#. Create a server action of type `Merge` (field `Action To Do`)
#. Click `Create Contextual Action` to make the action accessible for users

Usage
=====

To use this module, you need to:

#. Go to a list view of a model for which you have created a merge server action
#. Mark at least two records and start your merge action
#. Select the record to merge into
#. Click `Merge`

Known issues / Roadmap
======================

* add a cronjob that merges records based on some field(s) configured on the server action

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-ux/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 <https://github.com/OCA/server-ux/issues/new?body=module:%20server_action_merge%0Aversion:%2013.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
~~~~~~~

* Hunki Enterprises BV

Contributors
~~~~~~~~~~~~

* Holger Brunn <[email protected]> (https://hunki-enterprises.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-hbrunn| image:: https://github.com/hbrunn.png?size=40px
:target: https://github.com/hbrunn
:alt: hbrunn

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

|maintainer-hbrunn|

This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/13.0/server_action_merge>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions server_action_merge/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
18 changes: 18 additions & 0 deletions server_action_merge/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

{
"name": "Merge records",
"summary": "Allows you to configure a wizard to merge records of arbitrary models",
"version": "13.0.1.0.0",
"development_status": "Alpha",
"category": "Extra Tools",
"website": "https://github.com/OCA/server-ux",
"author": "Hunki Enterprises BV, Odoo Community Association (OCA)",
"maintainers": ["hbrunn"],
"license": "AGPL-3",
"external_dependencies": {"python": ["openupgradelib"]},
"depends": ["base"],
"data": ["wizards/server_action_merge_wizard.xml", "views/ir_actions_server.xml"],
"demo": ["demo/ir_actions_server.xml"],
}
19 changes: 19 additions & 0 deletions server_action_merge/demo/ir_actions_server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Hunki Enterprises BV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) -->
<data>

<record id="server_action_merge_users" model="ir.actions.server">
<field name="name">Merge users</field>
<field name="state">merge</field>
<field name="model_id" ref="base.model_res_users" />
<field name="merge_sudo" eval="True" />
</record>

<function
name="create_action"
model="ir.actions.server"
eval="[ref('server_action_merge_users')]"
/>

</data>
1 change: 1 addition & 0 deletions server_action_merge/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import ir_actions_server
36 changes: 36 additions & 0 deletions server_action_merge/models/ir_actions_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2023 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)


from odoo import fields, models


class IrActionsServer(models.Model):
_inherit = "ir.actions.server"

state = fields.Selection(selection_add=[("merge", "Merge records")])
merge_method = fields.Selection(
[("orm", "ORM"), ("sql", "SQL")], default="orm", string="Merge method"
)
merge_handling = fields.Selection(
[("delete", "Delete"), ("deactivate", "Deactivate"), ("none", "Do nothing")],
string="Merged records handling",
default="delete",
help="This determines what to do with records that have been merged into "
"another one, default is to delete them",
)
merge_sudo = fields.Boolean("Run merge as superuser", default=False)

def run_action_merge_multi(self, action, eval_context=None):
"""Return the merge wizard"""
wizard = self.env["server.action.merge.wizard"].create({"action_id": action.id})
wizard._onchange_line_ids()
return {
"type": "ir.actions.act_window",
"name": action.name,
"res_model": wizard._name,
"res_id": wizard.id,
"target": "new",
"view_mode": "form",
"context": self.env.context,
}
5 changes: 5 additions & 0 deletions server_action_merge/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To configure this module, you need to:

#. Go to Settings/Technical/Server actions
#. Create a server action of type `Merge` (field `Action To Do`)
#. Click `Create Contextual Action` to make the action accessible for users
1 change: 1 addition & 0 deletions server_action_merge/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Holger Brunn <[email protected]> (https://hunki-enterprises.com)
1 change: 1 addition & 0 deletions server_action_merge/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows users to merge records of arbitrary models.
1 change: 1 addition & 0 deletions server_action_merge/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* add a cronjob that merges records based on some field(s) configured on the server action
6 changes: 6 additions & 0 deletions server_action_merge/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To use this module, you need to:

#. Go to a list view of a model for which you have created a merge server action
#. Mark at least two records and start your merge action
#. Select the record to merge into
#. Click `Merge`
Empty file.
Binary file added server_action_merge/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

0 comments on commit 0298e46

Please sign in to comment.