From 3a6f6030155d9691780a9edfa1b9f29c0af9ac15 Mon Sep 17 00:00:00 2001 From: Berezi Date: Tue, 19 Nov 2024 14:00:11 +0100 Subject: [PATCH] [16.0][MIG] cleaning_database_operations: Migration to 16.0 --- cleaning_database_operations/README.rst | 11 +- cleaning_database_operations/__manifest__.py | 11 +- .../i18n/cleaning_database_operations.pot | 81 ++------ cleaning_database_operations/i18n/es.po | 125 ++++-------- .../models/cleaning_database.py | 54 +---- .../views/cleaning_database_view.xml | 185 +++++++----------- .../odoo/addons/cleaning_database_operations | 1 + setup/cleaning_database_operations/setup.py | 6 + 8 files changed, 143 insertions(+), 331 deletions(-) create mode 120000 setup/cleaning_database_operations/odoo/addons/cleaning_database_operations create mode 100644 setup/cleaning_database_operations/setup.py diff --git a/cleaning_database_operations/README.rst b/cleaning_database_operations/README.rst index 98eacd3345..542738fde8 100644 --- a/cleaning_database_operations/README.rst +++ b/cleaning_database_operations/README.rst @@ -6,10 +6,13 @@ Cleaning Database Operations ============================ -Cleaning all the database operations: Stock Move Lines, Stock Moves, Pickings, -Sale Orders, Sale Order Lines, Purchase Orders, Purchase Order Lines, -Account Moves, Account Move Lines, Account Move Reconcile, Stock Quants, -Stock Valuation Layers and Account Analytic Lines. +* Cleaning all the database operations of selected companies: + Stock Move Lines, Stock Moves, Pickings, Quants, Lots, + Valuation Layers, Sale Orders, Sale Order Lines, Purchase Orders, + Purchase Order Lines, Account Partial Reconcile, Account Moves, + Account Move Lines, Account Bank Statement, Account Payment Order and + Account Payment Line. +* Restart all sequences. Bug Tracker =========== diff --git a/cleaning_database_operations/__manifest__.py b/cleaning_database_operations/__manifest__.py index e9d1ebca15..64395d6df3 100644 --- a/cleaning_database_operations/__manifest__.py +++ b/cleaning_database_operations/__manifest__.py @@ -1,9 +1,9 @@ -# Copyright 2023 Berezi Amubieta - AvanzOSC +# Copyright 2024 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Cleaning Database Operations", - "version": "14.0.1.1.0", - "category": "Custom", + "version": "16.0.1.0.0", + "category": "Generic Modules", "license": "AGPL-3", "author": "AvanzOSC", "website": "https://github.com/avanzosc/odoo-addons", @@ -12,12 +12,7 @@ "sale", "purchase", "account", - "analytic", - "mrp", - "purchase_order_shipping_method", "account_payment_order", - "stock_location_warehouse", - "account_asset_management", ], "data": [ "security/ir.model.access.csv", diff --git a/cleaning_database_operations/i18n/cleaning_database_operations.pot b/cleaning_database_operations/i18n/cleaning_database_operations.pot index 53ac695187..edcd5f3ad5 100644 --- a/cleaning_database_operations/i18n/cleaning_database_operations.pot +++ b/cleaning_database_operations/i18n/cleaning_database_operations.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-16 09:59+0000\n" -"PO-Revision-Date: 2024-05-16 09:59+0000\n" +"POT-Creation-Date: 2024-11-19 13:03+0000\n" +"PO-Revision-Date: 2024-11-19 13:03+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -18,13 +18,8 @@ msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "" -"Account Analytic Line, Account Partial Reconcile, Account Move Line, Account" -" Move, Account Payment Order." -msgstr "" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Accounting:" +"Accounting: Account Partial Reconcile, Account Move Line, Account Move, " +"Account Bank Statement, Account Payment Order, Account Payment Line." msgstr "" #. module: cleaning_database_operations @@ -50,11 +45,6 @@ msgstr "" msgid "Cleaning Lots" msgstr "" -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning MRP Operations" -msgstr "" - #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Purchase Operations" @@ -65,21 +55,11 @@ msgstr "" msgid "Cleaning Sale Operations" msgstr "" -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Sequences" -msgstr "" - #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Stock Operations" msgstr "" -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Transport Operations" -msgstr "" - #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Valuation Layers" @@ -102,7 +82,7 @@ msgid "Created on" msgstr "" #. module: cleaning_database_operations -#: code:addons/cleaning_database_operations/models/cleaning_database.py:0 +#. odoo-python #: code:addons/cleaning_database_operations/models/cleaning_database.py:0 #, python-format msgid "Creation date: {}" @@ -125,7 +105,9 @@ msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Inventory:" +msgid "" +"Inventory: Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock " +"Valuation Layer, Stock Production Lot." msgstr "" #. module: cleaning_database_operations @@ -145,62 +127,25 @@ msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "MRP Workorder, MRP Production" +msgid "Purchases: Purchase Order Line, Purchase Order." msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Manufacturing:" +msgid "Reset Sequences" msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Others" +msgid "Sales: Sale Order Line, Sale Order." msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Purchase Order Line, Purchase Order." -msgstr "" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Purchases:" -msgstr "" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Reset sequences" -msgstr "" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Sale Order Line, Sale Order." -msgstr "" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Sales:" -msgstr "" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Squence" -msgstr "" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "" -"Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock Valuation " -"Layer, Stock Inventory, Stock Production Lot." +msgid "Squence: Reset sequences." msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "This will delete the following objects" msgstr "" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Transport Carrier Lines To Invoice" -msgstr "" diff --git a/cleaning_database_operations/i18n/es.po b/cleaning_database_operations/i18n/es.po index 57a172fd12..42a635adf7 100644 --- a/cleaning_database_operations/i18n/es.po +++ b/cleaning_database_operations/i18n/es.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-16 10:00+0000\n" -"PO-Revision-Date: 2024-05-16 10:00+0000\n" +"POT-Creation-Date: 2024-11-19 13:03+0000\n" +"PO-Revision-Date: 2024-11-19 13:03+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -18,21 +18,16 @@ msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "" -"Account Analytic Line, Account Partial Reconcile, Account Move Line, Account" -" Move, Account Payment Order." +"Accounting: Account Partial Reconcile, Account Move Line, Account Move, " +"Account Bank Statement, Account Payment Order, Account Payment Line." msgstr "" -"Líneas analítica, Conciliación parcial, Apunte contable, Asiento contable, " -"Orden de pago." - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Accounting:" -msgstr "Contabilidad:" +"Contabilidad: Conciliación parcial, apunte contable, asiento contable, " +"extracto bancario, orden de pago, líneas de pago." #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Accounting Operations" -msgstr "Borrado de facturación" +msgstr "Borrado de operaciones de contabilidad" #. module: cleaning_database_operations #: model:ir.actions.act_window,name:cleaning_database_operations.action_cleaning_database_view @@ -40,52 +35,37 @@ msgstr "Borrado de facturación" #: model:ir.ui.menu,name:cleaning_database_operations.menu_view_cleaning_database #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Database" -msgstr "Limpieza base de datos" +msgstr "Limpieza en base de datos" #. module: cleaning_database_operations #: model:ir.model,name:cleaning_database_operations.model_cleaning_database msgid "Cleaning Database Operations" -msgstr "Operaciones de limpieza de base de dato" +msgstr "Limpieza de operaciones en base de datos" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Lots" -msgstr "Borrar lotes" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning MRP Operations" -msgstr "Borrado de fabricación" +msgstr "Borrado de lotes" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Purchase Operations" -msgstr "Borrado de compras" +msgstr "Borrado de operaciones de compra" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Sale Operations" -msgstr "Borrado de ventas" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Sequences" -msgstr "Reiniciar secuencias" +msgstr "Borrado de operaciones de venta" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Stock Operations" -msgstr "Borrado de inventario" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Transport Operations" -msgstr "Borrado de transporte" +msgstr "Borrado de operaciones de stock" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Valuation Layers" -msgstr "Borrado de valoración de inventario" +msgstr "Borrado de valoración de stock" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__company_ids @@ -96,7 +76,7 @@ msgstr "Compañías" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__create_uid msgid "Created by" -msgstr "Creto por" +msgstr "Creado por" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__create_date @@ -104,11 +84,11 @@ msgid "Created on" msgstr "Creado el" #. module: cleaning_database_operations -#: code:addons/cleaning_database_operations/models/cleaning_database.py:0 +#. odoo-python #: code:addons/cleaning_database_operations/models/cleaning_database.py:0 #, python-format msgid "Creation date: {}" -msgstr "Fecha creación: {}" +msgstr "Fecha de creación: {}" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__name @@ -127,84 +107,49 @@ msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Inventory:" -msgstr "Inventario:" +msgid "" +"Inventory: Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock " +"Valuation Layer, Stock Production Lot." +msgstr "" +"Inventario: Movimiento de producto, movimiento de stock, albarán, stock, " +"valoración de stock, lote." #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database____last_update msgid "Last Modified on" -msgstr "Última modificación el" +msgstr "Modificado el" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__write_uid msgid "Last Updated by" -msgstr "Última actualización por" +msgstr "Actualizado por" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__write_date msgid "Last Updated on" -msgstr "Última actualización el" +msgstr "Actualizado el" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "MRP Workorder, MRP Production" -msgstr "Orden de trabajo, Orden de producción." +msgid "Purchases: Purchase Order Line, Purchase Order." +msgstr "Compras: Pedidos de compra, línea de compra." #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Manufacturing:" -msgstr "Fabricación:" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Others" -msgstr "Otros:" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Purchase Order Line, Purchase Order." -msgstr "Líneas de pedido de compra, pedidos de compra." - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Purchases:" -msgstr "Compras:" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Reset sequences" +msgid "Reset Sequences" msgstr "Reiniciar secuencias" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Sale Order Line, Sale Order." -msgstr "Líneas de pedido de venta, pedidos de venta." +msgid "Sales: Sale Order Line, Sale Order." +msgstr "Ventas: Pedido de venta, línea de venta." #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Sales:" -msgstr "Ventas:" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Squence" -msgstr "Secuencia" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "" -"Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock Valuation " -"Layer, Stock Inventory, Stock Production Lot." -msgstr "" -"Movimientos de Producto (Stock Move Line), Movimiento de existencias, Albaranes, Quants\n" -", Capa de valoración de stock, Inventario, Lote/Número de serie." +msgid "Squence: Reset sequences." +msgstr "Secuencia: Reiniciar secuencias" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "This will delete the following objects" -msgstr "Esto borrará los siguientes objetos" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Transport Carrier Lines To Invoice" -msgstr "Líneas de transporte a facturar." +msgstr "Esto eliminará los siguientes objetos" diff --git a/cleaning_database_operations/models/cleaning_database.py b/cleaning_database_operations/models/cleaning_database.py index 089a6e38b1..c01c9c7dfa 100644 --- a/cleaning_database_operations/models/cleaning_database.py +++ b/cleaning_database_operations/models/cleaning_database.py @@ -1,4 +1,4 @@ -# Copyright 2023 Berezi Amubieta - AvanzOSC +# Copyright 2024 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import _, api, fields, models @@ -33,19 +33,15 @@ def action_delete_stock_operations(self): self.env.cr.execute( "DELETE FROM stock_quant " "WHERE company_id in %s OR lot_id in (select l.id " - " from stock_production_lot as l" + " from stock_lot as l" " where l.id = stock_quant.lot_id " " and l.company_id in %s)", [tuple(self.company_ids.ids), tuple(self.company_ids.ids)], ) - self.env.cr.execute( - "DELETE FROM stock_inventory WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) def action_delete_stock_production_lot(self): self.env.cr.execute( - "DELETE FROM stock_production_lot WHERE company_id in %s", + "DELETE FROM stock_lot WHERE company_id in %s", [tuple(self.company_ids.ids)], ) @@ -75,23 +71,11 @@ def action_delete_purchase_operations(self): [tuple(self.company_ids.ids)], ) - def action_delete_analytic_operations(self): - self.env.cr.execute( - "DELETE FROM account_analytic_line WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) + def action_delete_accounting_operations(self): self.env.cr.execute( "DELETE FROM account_partial_reconcile WHERE company_id in %s", [tuple(self.company_ids.ids)], ) - self.env.cr.execute( - "DELETE FROM account_payment_order WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) - self.env.cr.execute( - "DELETE FROM account_payment_line WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) self.env.cr.execute( "DELETE FROM account_move_line WHERE company_id in %s", [tuple(self.company_ids.ids)], @@ -105,35 +89,11 @@ def action_delete_analytic_operations(self): [tuple(self.company_ids.ids)], ) self.env.cr.execute( - "DELETE FROM account_asset_line WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) - self.env.cr.execute( - "DELETE FROM account_asset WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) - self.env.cr.execute( - "DELETE FROM account_check_deposit WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) - - def action_delete_transport_operations(self): - self.env.cr.execute( - "DELETE FROM transport_carrier_lines_to_invoice WHERE company_id " "in %s", - [tuple(self.company_ids.ids)], - ) - - def action_delete_mrp_operations(self): - self.env.cr.execute( - "DELETE FROM mrp_workorder " - "WHERE production_id in (select p.id " - " from mrp_production as p " - " where p.id = mrp_workorder.production_id " - " and p.company_id in %s)", + "DELETE FROM account_payment_order WHERE company_id in %s", [tuple(self.company_ids.ids)], ) self.env.cr.execute( - "DELETE FROM mrp_production WHERE company_id in %s", + "DELETE FROM account_payment_line WHERE company_id in %s", [tuple(self.company_ids.ids)], ) @@ -149,6 +109,6 @@ def action_delete_sequance_operations(self): @api.model def create(self, values): - name = _("Creation date: {}".format(fields.Datetime.now())) + name = _("Creation date: {}").format(fields.Datetime.now()) values["name"] = name return super().create(values) diff --git a/cleaning_database_operations/views/cleaning_database_view.xml b/cleaning_database_operations/views/cleaning_database_view.xml index 727c4047b4..0a0dea7869 100644 --- a/cleaning_database_operations/views/cleaning_database_view.xml +++ b/cleaning_database_operations/views/cleaning_database_view.xml @@ -6,122 +6,79 @@ cleaning.database
-
-
-
-

- -

+
+

This will delete the following objects

+

Sales: Sale Order Line, Sale Order.

+

+

- - -
-

This will delete the following objects

-

Sales:

-

Sale Order Line, Sale Order.

-

-

-
- - - - - - - - -
+ + + + + + 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, +)