Skip to content
Open
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
46 changes: 46 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
===================
Odoo 19 Remove Data
===================

This Module will help to remove transactional data from database

Installation
============

To install this module, you need to:

Download the module and add it to your Odoo addons folder. Afterward, log on to
your Odoo server and go to the Apps menu. Trigger the debug mode and update the
list by clicking on the "Update Apps List" link. Now install the module by
clicking on the install button.

Upgrade
============

To upgrade this module, you need to:

Download the module and add it to your Odoo addons folder. Restart the server
and log on to your Odoo server. Select the Apps menu and upgrade the module by
clicking on the upgrade button.


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

There is Nothing to Configure


Credits
=======

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

* Odoo Mates <odoomates@gmail.com>
* Sunpop.cn


Author & Maintainer
-------------------

This module is maintained by the Odoo Mates
2 changes: 2 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models

16 changes: 16 additions & 0 deletions __manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
'name': 'Odoo 19 Remove Data',
'version': '1.4',
'author': 'Odoo Mates, Sunpop.cn',
'category': 'Tools',
'description': 'Data Clean up, Remove Data, Database Clean UP, Reset Database',
'summary': 'Data Clean up, Remove Data, Database Clean UP, Reset Database',
'maintainer': 'Odoo Mates',
'support': 'odoomates@gmail.com',
'license': 'LGPL-3',
'depends': ['base'],
'data': [
'views/view.xml',
],
'images': ['static/description/banner.png'],
}
2 changes: 2 additions & 0 deletions models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import model

41 changes: 41 additions & 0 deletions models/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import logging
from odoo import api, fields, models, _
from odoo.exceptions import AccessError

_logger = logging.getLogger(__name__)


class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

def _remove_data(self, models_to_remove, sequences=None):
if not self.env.user.has_group('base.group_system'):
raise AccessError(_("Only Administrators can perform this operation."))

sequences = sequences or []

for model_name in models_to_remove:
try:
model = self.env.get(model_name)
if not model:
_logger.warning("Model not found: %s", model_name)
continue

table_name = model._table
sql = f'DELETE FROM "{table_name}"'

self.env.cr.execute(sql)

except Exception as e:
_logger.warning('Remove data error for %s: %s', model_name, e)

for seq_prefix in sequences:
domain = ['|', ('code', '=ilike', seq_prefix + '%'), ('prefix', '=ilike', seq_prefix + '%')]
try:
seqs = self.env['ir.sequence'].sudo().search(domain)
if seqs:
seqs.write({'number_next': 1})
except Exception as e:
_logger.warning('Reset sequence error for %s: %s', seq_prefix, e)

return True
Binary file added static/description/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 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.
70 changes: 70 additions & 0 deletions static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<section class="oe_container oe_dark">
<div class="col-md-12">
<h2 class="oe_slogan" style="font-size: 35px;color:#2C0091"><b>Odoo 19 Remove Data</b></h2>
</div>
</section>

<section class="oe_container">
<div class="oe_row oe_spaced">
<div style="align:center;">
<h1 style=" text-align: center;">
<span align="center" style="color:#148963;">
<span class="fa fa-star fa-spin">
</span>
Features:</span>
</h1>
<div class="col-sm-2"/>
<div class="col-sm-4" style="text-align:left">
<p class="fa fa-hand-o-right" style="color:CRIMSON;font-size: 25px;">
<span style="color:#2dd280;font-size: 15px;">Remove all data in single click.</span>
</p><br/>
<p class="fa fa-hand-o-right" style="color:CRIMSON;font-size: 25px;">
<span style="color:#2dd280;font-size: 15px;">Easy to test odoo.</span>
</p><br/>
</div>
</div>
<br/>
</div>
</section>

<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="color:olive;">Remove Data Screen</h2>
<div class="oe_demo oe_picture oe_screenshot">
<img src="screen.png">
</div>
</div>
</section>

<hr style="width: 100%;height: 4px;background: #2C0091;margin: 0px 0px;">
<hr style="width: 100%;height: 4px;background: #148963;margin: 0px 0px;">
<section class="oe_container oe_dark">
<div class="oe_row ">
<div class="oe_slogan text-center">
<img src="odoo_mates.png"/>
<div style="color:#269900;">
<h3 style="color:#2C0091;font-size: 25px;">If you need any support or want more features, just contact us:</h3><br>
<h3 style="color:#2C0091;font-size: 20px;">Email: <a href="odoomates@gmail.com">odoomates@gmail.com</a> <br></h3>
</div>
<div class="oe_slogan">
<h2>
<a target="_blank" href="https://www.facebook.com/odoomate/" target="new">
<i class="fa fa-facebook-square" style="font-size:38px;"></i>
</a>
<a target="_blank" href="https://twitter.com/odoomates/" target="new">
<i class="fa fa-twitter" style="font-size:38px;"></i>
</a>
<a href="#" target="_blank">
<i class="fa fa-linkedin" style="font-size:38px;"></i>
</a>
<a target="_blank" href="https://www.youtube.com/channel/UCVKlUZP7HAhdQgs-9iTJklQ">
<i class="fa fa-youtube-play" style="font-size:38px;"></i>
</a>
</h2>
</div>
</div>
</div>
</section>
<hr style="width: 100%;height: 4px;background: #148963;margin: 0px 0px;">
<hr style="width: 100%;height: 4px;background: #2C0091;margin: 0px 0px;">

Binary file added static/description/odoo_mates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/description/screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions views/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_res_config_settings_data_remove,res.config.settings.data.remove,base.model_res_config_settings,base.group_system,1,1,1,1
11 changes: 11 additions & 0 deletions views/security/om_data_remove_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<!-- Security Group for Data Removal -->
<record id="group_data_remove_admin" model="res.groups">
<field name="name">Data Remove Administrator</field>
<field name="category_id" ref="base.module_category_administration"/>
<field name="implied_ids" eval="[(4, ref('base.group_system'))]"/>
</record>

</odoo>
Loading