diff --git a/account_netting/README.rst b/account_netting/README.rst index c520bbc4..14908440 100644 --- a/account_netting/README.rst +++ b/account_netting/README.rst @@ -14,13 +14,13 @@ Account netting :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/13.0/account_netting + :target: https://github.com/OCA/account-financial-tools/tree/14.0/account_netting :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-13-0/account-financial-tools-13-0-account_netting + :target: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_netting :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/92/13.0 + :target: https://runbot.odoo-community.org/runbot/92/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -61,7 +61,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -92,6 +92,6 @@ 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 `_ project on GitHub. +This module is part of the `OCA/account-financial-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_netting/__manifest__.py b/account_netting/__manifest__.py index d520f023..5e0eedf1 100644 --- a/account_netting/__manifest__.py +++ b/account_netting/__manifest__.py @@ -4,13 +4,16 @@ { "name": "Account netting", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "summary": "Compensate AR/AP accounts from the same partner", "category": "Accounting & Finance", - "author": "Tecnativa, " "Odoo Community Association (OCA)", + "author": "Tecnativa, Odoo Community Association (OCA)", "license": "AGPL-3", - "website": "https://github.com/OCA/account-financial-tools/", + "website": "https://github.com/OCA/account-financial-tools", "depends": ["account"], - "data": ["wizards/account_move_make_netting_view.xml"], + "data": [ + "security/ir.model.access.csv", + "wizards/account_move_make_netting_view.xml", + ], "installable": True, } diff --git a/account_netting/i18n/account_netting.pot b/account_netting/i18n/account_netting.pot index 0c590a90..7eab5af1 100644 --- a/account_netting/i18n/account_netting.pot +++ b/account_netting/i18n/account_netting.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -121,7 +121,7 @@ msgstr "" #. module: account_netting #: model_terms:ir.ui.view,arch_db:account_netting.view_account_move_make_netting_form msgid "" -"This operation will generate account entries that are counterpart of the " +"This operation will generate journal entries that are counterpart of the " "receivable/payable accounts selected, and reconcile each other, letting this" " balance in the partner." msgstr "" diff --git a/account_netting/security/ir.model.access.csv b/account_netting/security/ir.model.access.csv new file mode 100644 index 00000000..569589cc --- /dev/null +++ b/account_netting/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_move_make_netting,Full access on account.move.make.netting to accountant grp,model_account_move_make_netting,account.group_account_user,1,1,1,1 diff --git a/account_netting/static/description/index.html b/account_netting/static/description/index.html index 6cd0077e..c5d6b208 100644 --- a/account_netting/static/description/index.html +++ b/account_netting/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/account-financial-tools Translate me on Weblate Try me on Runbot

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.

@@ -407,7 +407,7 @@ counterparts of the AR/AP operations.

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -432,7 +432,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

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 project on GitHub.

+

This module is part of the OCA/account-financial-tools project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/account_netting/tests/test_account_netting.py b/account_netting/tests/test_account_netting.py index e183c51c..acb0b0e2 100644 --- a/account_netting/tests/test_account_netting.py +++ b/account_netting/tests/test_account_netting.py @@ -2,6 +2,8 @@ # Copyright 2017 Tecnativa - Vicent Cubells # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from datetime import datetime + import odoo.tests.common as common @@ -14,6 +16,7 @@ class TestAccountNetting(common.SavepointCase): cls.env.user.write( {"groups_id": [(6, 0, [res_users_account_manager.id, partner_manager.id])]} ) + company = cls.env.ref("base.main_company") # only adviser can create an account cls.account_receivable = cls.env["account.account"].create( { @@ -21,6 +24,7 @@ class TestAccountNetting(common.SavepointCase): "name": "customer account", "user_type_id": cls.env.ref("account.data_account_type_receivable").id, "reconcile": True, + "company_id": company.id, } ) cls.account_payable = cls.env["account.account"].create( @@ -29,6 +33,7 @@ class TestAccountNetting(common.SavepointCase): "name": "supplier account", "user_type_id": cls.env.ref("account.data_account_type_payable").id, "reconcile": True, + "company_id": company.id, } ) cls.account_revenue = cls.env["account.account"].search( @@ -37,7 +42,8 @@ class TestAccountNetting(common.SavepointCase): "user_type_id", "=", cls.env.ref("account.data_account_type_revenue").id, - ) + ), + ("company_id", "=", company.id), ], limit=1, ) @@ -47,7 +53,8 @@ class TestAccountNetting(common.SavepointCase): "user_type_id", "=", cls.env.ref("account.data_account_type_expenses").id, - ) + ), + ("company_id", "=", company.id), ], limit=1, ) @@ -66,19 +73,35 @@ class TestAccountNetting(common.SavepointCase): } ) cls.journal = cls.env["account.journal"].create( - {"name": "Test sale journal", "type": "sale", "code": "TEST"} + { + "name": "Test sale journal", + "type": "sale", + "code": "TEST", + "company_id": company.id, + } ) cls.expenses_journal = cls.env["account.journal"].create( - {"name": "Test expense journal", "type": "purchase", "code": "EXP"} + { + "name": "Test expense journal", + "type": "purchase", + "code": "EXP", + "company_id": company.id, + } ) cls.miscellaneous_journal = cls.env["account.journal"].create( - {"name": "Miscellaneus journal", "type": "general", "code": "OTHER"} + { + "name": "Miscellaneus journal", + "type": "general", + "code": "OTHER", + "company_id": company.id, + } ) cls.customer_invoice = cls.env["account.move"].create( { "journal_id": cls.journal.id, - "type": "out_invoice", + "move_type": "out_invoice", "partner_id": cls.partner.id, + "company_id": company.id, "invoice_line_ids": [ ( 0, @@ -100,8 +123,10 @@ class TestAccountNetting(common.SavepointCase): cls.supplier_invoice = cls.env["account.move"].create( { "journal_id": cls.expenses_journal.id, - "type": "in_invoice", + "move_type": "in_invoice", "partner_id": cls.partner.id, + "company_id": company.id, + "invoice_date": datetime.now(), "invoice_line_ids": [ ( 0, @@ -126,8 +151,10 @@ class TestAccountNetting(common.SavepointCase): cls.supplier_invoice = cls.env["account.move"].create( { "journal_id": cls.expenses_journal.id, - "type": "in_invoice", + "move_type": "in_invoice", "partner_id": cls.partner1.id, + "company_id": company.id, + "invoice_date": datetime.now(), "invoice_line_ids": [ ( 0, @@ -149,8 +176,10 @@ class TestAccountNetting(common.SavepointCase): cls.supplier_invoice = cls.env["account.move"].create( { "journal_id": cls.expenses_journal.id, - "type": "in_refund", + "move_type": "in_refund", "partner_id": cls.partner1.id, + "company_id": company.id, + "invoice_date": datetime.now(), "invoice_line_ids": [ ( 0, @@ -172,8 +201,10 @@ class TestAccountNetting(common.SavepointCase): cls.supplier_invoice = cls.env["account.move"].create( { "journal_id": cls.expenses_journal.id, - "type": "in_refund", + "move_type": "in_refund", "partner_id": cls.partner1.id, + "company_id": company.id, + "invoice_date": datetime.now(), "invoice_line_ids": [ ( 0, diff --git a/account_netting/wizards/account_move_make_netting.py b/account_netting/wizards/account_move_make_netting.py index e117046c..839c731a 100644 --- a/account_netting/wizards/account_move_make_netting.py +++ b/account_netting/wizards/account_move_make_netting.py @@ -14,10 +14,11 @@ class AccountMoveMakeNetting(models.TransientModel): required=True, domain="[('type', '=', 'general')]", ) - move_line_ids = fields.Many2many(comodel_name="account.move.line",) - balance = fields.Float(readonly=True,) + move_line_ids = fields.Many2many(comodel_name="account.move.line") + balance = fields.Float(readonly=True) balance_type = fields.Selection( - selection=[("pay", "To pay"), ("receive", "To receive")], readonly=True, + selection=[("pay", "To pay"), ("receive", "To receive")], + readonly=True, ) @api.model @@ -116,6 +117,7 @@ class AccountMoveMakeNetting(models.TransientModel): break if move_lines: move.write({"line_ids": move_lines}) + move.action_post() # Make reconciliation for move_line in move.line_ids: to_reconcile = move_line + self.move_line_ids.filtered( diff --git a/account_netting/wizards/account_move_make_netting_view.xml b/account_netting/wizards/account_move_make_netting_view.xml index ed897836..fe2b21e6 100644 --- a/account_netting/wizards/account_move_make_netting_view.xml +++ b/account_netting/wizards/account_move_make_netting_view.xml @@ -1,23 +1,27 @@ - + + Compensate + account.move.make.netting + form + new + + list + + Compensate entries account.move.make.netting

This operation will generate account entries that are counterpart of the receivable/payable accounts selected, and reconcile each other, letting this balance in the partner.

+ >This operation will generate journal entries that are counterpart of the receivable/payable accounts selected, and reconcile each other, letting this balance in the partner.

- +