Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] account_move_force_removal: Migration to 16.0 #1776

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6e671db
[ADD] account_move_force_removal: Allow force removal account moves
victoralmau Nov 18, 2020
455d057
[MIG] account_move_force_removal: Migration to 14.0
tafaRU Apr 26, 2021
17ff438
[UPD] Update account_move_force_removal.pot
oca-travis May 3, 2021
ac7d496
[UPD] README.rst
OCA-git-bot May 3, 2021
01e4751
[FIX] account_move_force_removal: Make tests resilient
pedrobaeza Aug 4, 2021
63f2559
[15.0][MIG] account_move_force_removal: Migration to 15.0
Apr 20, 2022
ebea478
[UPD] Update account_move_force_removal.pot
Apr 20, 2022
454e5a8
[UPD] README.rst
OCA-git-bot Apr 20, 2022
ccde169
[15.0][IMP] account_move_force_removal: add a new user group.
May 2, 2022
b261c66
[UPD] Update account_move_force_removal.pot
May 6, 2022
9a28c8e
account_move_force_removal 15.0.1.1.0
OCA-git-bot May 6, 2022
3b4a4ea
[FIX] account_move_force_removal: buggy migration script
yajo May 10, 2022
9848479
Added translation using Weblate (Spanish (Argentina))
ibuioli May 23, 2022
9bb63a4
Translated using Weblate (Spanish (Argentina))
ibuioli May 23, 2022
7561d98
Added translation using Weblate (Spanish)
victoralmau Aug 17, 2023
e1e981f
Translated using Weblate (Spanish)
victoralmau Aug 17, 2023
76bf5ad
[UPD] README.rst
OCA-git-bot Sep 3, 2023
3101795
[IMP] account_move_force_removal: test performance improvement
josep-tecnativa Oct 13, 2023
e5c3a8c
[BOT] post-merge updates
OCA-git-bot Oct 13, 2023
e5521f7
[IMP] account_move_force_removal: pre-commit stuff
matteoopenf Nov 8, 2023
a127c4d
[FIX] account_move_force_removal: fix test
matteoopenf Nov 8, 2023
c2e0339
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
c71777d
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
2c5804b
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
7c6e63f
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
e59d250
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
783a91a
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
416ebbf
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
681595e
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
736ae3e
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
bb205ba
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
b9df859
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
36ddc76
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
f705c91
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
2ddd17a
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
a06693a
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
c9b3944
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
127217c
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
ad321d9
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
57b0adb
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
fba5720
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
cc03d31
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
a5afc92
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
6c97c51
[FIX][account_move_force_removal] fix test
matteoopenf May 22, 2024
618bf72
[fix]account_move_force_removal fix test
matteoopenf Jun 13, 2024
eaab24e
[fix]account_move_force_removal fix test
matteoopenf Jun 13, 2024
0da6d57
[fix]account_move_force_removal fix test
matteoopenf Jun 13, 2024
a83c0b9
[fix]account_move_force_removal fix test
matteoopenf Jun 13, 2024
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
93 changes: 93 additions & 0 deletions account_move_force_removal/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
==========================
Account Move Force Removal
==========================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/16.0/account_move_force_removal
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_move_force_removal
: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/account-financial-tools&target_branch=16.0
:alt: Try me on Runboat

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

This module allows you to delete account moves, which is prevented in Odoo by default.
You must care yourself about the numbering sequence doing this.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Go to Invoicing > Customers > Invoices and enter an invoice.
#. Click on "Reset to draft"
#. Click on "Cancel entry
#. Try to delete invoice

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/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/account-financial-tools/issues/new?body=module:%20account_move_force_removal%0Aversion:%2016.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
~~~~~~~

* Tecnativa

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

* `Tecnativa <https://www.tecnativa.com>`_:

* Víctor Martínez
* Pedro M. Baeza
* Alex Comba <alex.comba@agilebg.com>

* `Sygel <https://www.sygel.es>`__:

* Ángel García de la Chica Herrera

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.

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/16.0/account_move_force_removal>`_ 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 account_move_force_removal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions account_move_force_removal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Account Move Force Removal",
"summary": """Allow force removal account moves""",
"version": "16.0.1.0.0",
"category": "Account",
"license": "AGPL-3",
"website": "https://github.com/OCA/account-financial-tools",
"author": "Tecnativa, Odoo Community Association (OCA)",
"depends": [
"account",
],
"data": ["security/account_move_force_removal_security.xml"],
}
24 changes: 24 additions & 0 deletions account_move_force_removal/i18n/account_move_force_removal.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_force_removal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \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: account_move_force_removal
#: model:res.groups,name:account_move_force_removal.group_account_move_force_removal
msgid "Allow to delete invoices/journal entries"
msgstr ""

#. module: account_move_force_removal
#: model:ir.model,name:account_move_force_removal.model_account_move
msgid "Journal Entry"
msgstr ""
27 changes: 27 additions & 0 deletions account_move_force_removal/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_force_removal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-08-17 14:10+0000\n"
"Last-Translator: Víctor Martínez <victor.martinez@tecnativa.com>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: account_move_force_removal
#: model:res.groups,name:account_move_force_removal.group_account_move_force_removal
msgid "Allow to delete invoices/journal entries"
msgstr "Permitir eliminar facturas y asientos"

#. module: account_move_force_removal
#: model:ir.model,name:account_move_force_removal.model_account_move
msgid "Journal Entry"
msgstr "Asiento contable"
27 changes: 27 additions & 0 deletions account_move_force_removal/i18n/es_AR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_move_force_removal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-05-23 06:05+0000\n"
"Last-Translator: Ignacio Buioli <ibuioli@gmail.com>\n"
"Language-Team: none\n"
"Language: es_AR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: account_move_force_removal
#: model:res.groups,name:account_move_force_removal.group_account_move_force_removal
msgid "Allow to delete invoices/journal entries"
msgstr "Permitir eliminar facturas/asientos contables"

#. module: account_move_force_removal
#: model:ir.model,name:account_move_force_removal.model_account_move
msgid "Journal Entry"
msgstr "Asiento Contable"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
users_billing = env.ref("account.group_account_invoice").users
group = env.ref("account_move_force_removal.group_account_move_force_removal")
group.users = [(4, user.id) for user in users_billing]
3 changes: 3 additions & 0 deletions account_move_force_removal/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html

from . import account_move
46 changes: 46 additions & 0 deletions account_move_force_removal/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html

from odoo import _, models
from odoo.exceptions import UserError


class AccountMove(models.Model):
_inherit = "account.move"

def unlink(self):
cancelled_moves = self.env["account.move"]
# import pdb;pdb.set_trace()
if self.env.user.has_group(
"account_move_force_removal.group_account_move_force_removal"
):
self._check_can_be_deleted(states=["posted"], check_group=False)
cancelled_moves = self.filtered(lambda m: m.state == "cancel")
super(AccountMove, cancelled_moves.with_context(force_delete=True)).unlink()
else:
# self._check_can_be_deleted(states=["cancel", "posted"])
raise UserError(
_(
"You cannot delete an entry which has been posted once, "
"You haven't the correct right"
)
)
return super(AccountMove, self - cancelled_moves).unlink()

def _check_can_be_deleted(self, states, check_group=True):
for move in self:
move_journal = move.journal_id
move_has_old_sequence = hasattr(move_journal, "name") or hasattr(
move_journal, "refund_sequence_id"
)
if (
move.state in states
and move_has_old_sequence
and (check_group or move.name != "/")
and (move_journal.sequence_id or move_journal.refund_sequence_id)
):
raise UserError(
_("You cannot delete an entry which has been posted once.")
)

return True
9 changes: 9 additions & 0 deletions account_move_force_removal/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Víctor Martínez
* Pedro M. Baeza
* Alex Comba <alex.comba@agilebg.com>

* `Sygel <https://www.sygel.es>`__:

* Ángel García de la Chica Herrera
2 changes: 2 additions & 0 deletions account_move_force_removal/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows you to delete account moves, which is prevented in Odoo by default.
You must care yourself about the numbering sequence doing this.
4 changes: 4 additions & 0 deletions account_move_force_removal/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#. Go to Invoicing > Customers > Invoices and enter an invoice.
#. Click on "Reset to draft"
#. Click on "Cancel entry
#. Try to delete invoice
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 Ángel García de la Chica Herrera <angel.garcia@sygel.es>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="group_account_move_force_removal" model="res.groups">
<field name="name">Allow to delete invoices/journal entries</field>
<field name="category_id" ref="base.module_category_accounting" />
<field name="users" eval="[(4, ref('base.user_admin'))]" />
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading