diff --git a/account_netting/__manifest__.py b/account_netting/__manifest__.py index 7e478e29..b28c2ebb 100644 --- a/account_netting/__manifest__.py +++ b/account_netting/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Account netting', - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'summary': 'Compensate AR/AP accounts from the same partner', 'category': 'Accounting & Finance', 'author': 'Tecnativa, ' diff --git a/account_netting/readme/CONTRIBUTORS.rst b/account_netting/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..662eb892 --- /dev/null +++ b/account_netting/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Pedro M. Baeza +* Vicent Cubells diff --git a/account_netting/readme/DESCRIPTION.rst b/account_netting/readme/DESCRIPTION.rst new file mode 100644 index 00000000..0e82c4bd --- /dev/null +++ b/account_netting/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +This module allows to compensate the balance of a receivable account with the +balance of a payable account for the same partner, creating a journal item +that reflects this operation. + +**WARNING**: This operation can be forbidden in your country by the accounting +regulations, so you should check current laws before using it. For example, in +Spain, this is not allowed at first instance, unless you document well the +operation from both parties. diff --git a/account_netting/readme/USAGE.rst b/account_netting/readme/USAGE.rst new file mode 100644 index 00000000..ed5889b4 --- /dev/null +++ b/account_netting/readme/USAGE.rst @@ -0,0 +1,12 @@ +From any account journal entries view: + +* Accounting/Journal Entries/Journal Items + +select all the lines that corresponds to both AR/AP operations from the same +partner. Click on *Action > Compensate*. If the items don't correspond to the +same partner or they aren't AR/AP accounts, you will get an error. + +On contrary, a dialog box will be presented with the result of the operation +and a selection of the journal to register the operation. When you click on the +*Compensate* button, a journal entry is created with the corresponding +counterparts of the AR/AP operations. diff --git a/account_netting/tests/test_account_netting.py b/account_netting/tests/test_account_netting.py index 9b19fa42..f0094b46 100644 --- a/account_netting/tests/test_account_netting.py +++ b/account_netting/tests/test_account_netting.py @@ -2,7 +2,7 @@ # Copyright 2017 Tecnativa - Vicent Cubells # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -import openerp.tests.common as common +import odoo.tests.common as common class TestAccountNetting(common.SavepointCase): diff --git a/account_netting/wizards/account_move_make_netting.py b/account_netting/wizards/account_move_make_netting.py index fe23e170..5ed6d613 100644 --- a/account_netting/wizards/account_move_make_netting.py +++ b/account_netting/wizards/account_move_make_netting.py @@ -7,6 +7,7 @@ from odoo import _, api, exceptions, fields, models class AccountMoveMakeNetting(models.TransientModel): _name = "account.move.make.netting" + _description = 'Wizard to generate account moves for netting' journal_id = fields.Many2one( comodel_name="account.journal", @@ -28,7 +29,7 @@ class AccountMoveMakeNetting(models.TransientModel): ) @api.model - def default_get(self, fields): + def default_get(self, fields_list): if len(self.env.context.get('active_ids', [])) < 2: raise exceptions.ValidationError( _("You should compensate at least 2 journal entries.")) @@ -51,7 +52,7 @@ class AccountMoveMakeNetting(models.TransientModel): raise exceptions.ValidationError( _("All entries should have a partner and the partner must " "be the same for all.")) - res = super(AccountMoveMakeNetting, self).default_get(fields) + res = super(AccountMoveMakeNetting, self).default_get(fields_list) res['move_line_ids'] = [(6, 0, move_lines.ids)] balance = (sum(move_lines.mapped('debit')) - sum(move_lines.mapped('credit'))) @@ -59,7 +60,6 @@ class AccountMoveMakeNetting(models.TransientModel): res['balance_type'] = 'pay' if balance < 0 else 'receive' return res - @api.multi def button_compensate(self): self.ensure_one() # Create account move @@ -103,8 +103,6 @@ class AccountMoveMakeNetting(models.TransientModel): move_line_vals = { field_map[i]: amount, 'partner_id': self.move_line_ids[0].partner_id.id, - 'date': move.date, - 'journal_id': move.journal_id.id, 'name': move.ref, 'account_id': account_group['account_id'], } diff --git a/account_netting/wizards/account_move_make_netting_view.xml b/account_netting/wizards/account_move_make_netting_view.xml index 08ff7704..b0266068 100644 --- a/account_netting/wizards/account_move_make_netting_view.xml +++ b/account_netting/wizards/account_move_make_netting_view.xml @@ -15,12 +15,10 @@ account.move.make.netting
-