-
-
-
+
+
This will delete the following objects
+
Sales: Sale Order Line, Sale Order.
+
+
+
+
Purchases: Purchase Order Line, Purchase Order.
+
+
+
+
Accounting: Account Partial Reconcile, Account Move Line, Account Move, Account Bank Statement, Account Payment Order, Account Payment Line.
+
+
+
+
Inventory: Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock Valuation Layer, Stock Production Lot.
+
+
+
+
+
+
+
+
+
+
Squence: Reset sequences.
+
+
+
-
-
-
-
This will delete the following objects
-
Sales:
-
Sale Order Line, Sale Order.
-
-
-
-
Purchases:
-
Purchase Order Line, Purchase Order.
-
-
-
-
Accounting:
-
Account Analytic Line, Account Partial Reconcile, Account Move Line, Account Move, Account Payment Order.
-
-
-
-
Manufacturing:
-
MRP Workorder, MRP Production
-
-
-
-
Inventory:
-
Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock Valuation Layer, Stock Inventory, Stock Production Lot.
-
-
-
-
-
-
-
-
-
-
Others
-
Transport Carrier Lines To Invoice
-
-
-
-
Squence
-
Reset sequences
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/cleaning_database_operations/wizards/__init__.py b/cleaning_database_operations/wizards/__init__.py
new file mode 100644
index 0000000000..2929000501
--- /dev/null
+++ b/cleaning_database_operations/wizards/__init__.py
@@ -0,0 +1 @@
+from . import cleaning_database_warning_wizard
diff --git a/cleaning_database_operations/wizards/cleaning_database_warning_wizard.py b/cleaning_database_operations/wizards/cleaning_database_warning_wizard.py
new file mode 100644
index 0000000000..ed864c58ce
--- /dev/null
+++ b/cleaning_database_operations/wizards/cleaning_database_warning_wizard.py
@@ -0,0 +1,56 @@
+# Copyright 2023 Berezi Amubieta - AvanzOSC
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
+from odoo import _, api, fields, models
+
+
+class CleaningDatabaseWarningWizard(models.TransientModel):
+ _name = "cleaning.database.warning.wizard"
+ _description = "Wizard for warning when cleaning database operations"
+
+ text = fields.Text(
+ string="Text",
+ )
+ object_to_delete = fields.Selection(
+ selection=[
+ ("stock", "Stock"),
+ ("lot", "Lot"),
+ ("valuation", "Valuation Layer"),
+ ("sale", "Sale"),
+ ("purchase", "Purchase"),
+ ("accounting", "Accounting"),
+ ("sequences", "Sequences"),
+ ],
+ string="Status",
+ required=True,
+ )
+
+ @api.model
+ def default_get(self, fields_list):
+ res = super(CleaningDatabaseWarningWizard, self).default_get(fields_list)
+ if "object_to_delete" in self.env.context:
+ res.update({
+ "object_to_delete": self.env.context["object_to_delete"],
+ "text": _("Are you sure you want to delete the entire "
+ "operation? This action will be irreversible")
+ })
+ return res
+
+ def continue_with_cleaning_database(self):
+ self.ensure_one()
+ cleaning_database = self.env["cleaning.database"].browse(
+ self.env.context.get("active_id")
+ )
+ if self.object_to_delete == "sale":
+ return cleaning_database.action_delete_sale_operations()
+ elif self.object_to_delete == "purchase":
+ return cleaning_database.action_delete_purchase_operations()
+ elif self.object_to_delete == "stock":
+ return cleaning_database.action_delete_stock_operations()
+ elif self.object_to_delete == "lot":
+ return cleaning_database.action_delete_stock_production_lot()
+ elif self.object_to_delete == "valuation":
+ return cleaning_database.action_delete_stock_valuation_operations()
+ elif self.object_to_delete == "accounting":
+ return cleaning_database.action_delete_accounting_operations()
+ elif self.object_to_delete == "sequences":
+ return cleaning_database.action_delete_sequance_operations()
diff --git a/cleaning_database_operations/wizards/cleaning_database_warning_wizard_view.xml b/cleaning_database_operations/wizards/cleaning_database_warning_wizard_view.xml
new file mode 100644
index 0000000000..2f609325d2
--- /dev/null
+++ b/cleaning_database_operations/wizards/cleaning_database_warning_wizard_view.xml
@@ -0,0 +1,27 @@
+
+
+
+ cleaning.database.warning.wizard.form
+ cleaning.database.warning.wizard
+
+
+
+
+
diff --git a/setup/cleaning_database_operations/odoo/addons/cleaning_database_operations b/setup/cleaning_database_operations/odoo/addons/cleaning_database_operations
new file mode 120000
index 0000000000..5788e83095
--- /dev/null
+++ b/setup/cleaning_database_operations/odoo/addons/cleaning_database_operations
@@ -0,0 +1 @@
+../../../../cleaning_database_operations
\ No newline at end of file
diff --git a/setup/cleaning_database_operations/setup.py b/setup/cleaning_database_operations/setup.py
new file mode 100644
index 0000000000..28c57bb640
--- /dev/null
+++ b/setup/cleaning_database_operations/setup.py
@@ -0,0 +1,6 @@
+import setuptools
+
+setuptools.setup(
+ setup_requires=['setuptools-odoo'],
+ odoo_addon=True,
+)