From 563c36e15845946ab25208737d7bfd70cd856a4d Mon Sep 17 00:00:00 2001 From: Sergio Teruel Date: Thu, 19 Mar 2020 09:13:16 +0100 Subject: [PATCH] [MIG] account_netting: Migration to v13.0 --- account_netting/README.rst | 10 +-- account_netting/__manifest__.py | 6 +- account_netting/static/description/index.html | 6 +- account_netting/tests/test_account_netting.py | 63 ++++++++++--------- .../wizards/account_move_make_netting.py | 6 +- .../account_move_make_netting_view.xml | 4 +- 6 files changed, 48 insertions(+), 47 deletions(-) diff --git a/account_netting/README.rst b/account_netting/README.rst index 860126ca4..c520bbc4e 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/12.0/account_netting + :target: https://github.com/OCA/account-financial-tools/tree/13.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-12-0/account-financial-tools-12-0-account_netting + :target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-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/12.0 + :target: https://runbot.odoo-community.org/runbot/92/13.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 a1902e1b6..d520f0234 100644 --- a/account_netting/__manifest__.py +++ b/account_netting/__manifest__.py @@ -4,13 +4,13 @@ { "name": "Account netting", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "summary": "Compensate AR/AP accounts from the same partner", "category": "Accounting & Finance", "author": "Tecnativa, " "Odoo Community Association (OCA)", "license": "AGPL-3", "website": "https://github.com/OCA/account-financial-tools/", - "depends": ["account",], - "data": ["wizards/account_move_make_netting_view.xml",], + "depends": ["account"], + "data": ["wizards/account_move_make_netting_view.xml"], "installable": True, } diff --git a/account_netting/static/description/index.html b/account_netting/static/description/index.html index 7d2ba1958..6cd0077e7 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 9024949ba..e183c51c5 100644 --- a/account_netting/tests/test_account_netting.py +++ b/account_netting/tests/test_account_netting.py @@ -9,16 +9,10 @@ class TestAccountNetting(common.SavepointCase): @classmethod def setUpClass(cls): super(TestAccountNetting, cls).setUpClass() - cls.partner = cls.env["res.partner"].create( - {"supplier": True, "customer": True, "name": "Supplier/Customer",} - ) - cls.partner1 = cls.env["res.partner"].create( - {"supplier": True, "customer": True, "name": "Supplier/Customer 1",} - ) res_users_account_manager = cls.env.ref("account.group_account_manager") partner_manager = cls.env.ref("base.group_partner_manager") cls.env.user.write( - {"groups_id": [(6, 0, [res_users_account_manager.id, partner_manager.id])],} + {"groups_id": [(6, 0, [res_users_account_manager.id, partner_manager.id])]} ) # only adviser can create an account cls.account_receivable = cls.env["account.account"].create( @@ -57,21 +51,34 @@ class TestAccountNetting(common.SavepointCase): ], limit=1, ) + cls.partner = cls.env["res.partner"].create( + { + "name": "Supplier/Customer", + "property_account_receivable_id": cls.account_receivable.id, + "property_account_payable_id": cls.account_payable.id, + } + ) + cls.partner1 = cls.env["res.partner"].create( + { + "name": "Supplier/Customer 1", + "property_account_receivable_id": cls.account_receivable.id, + "property_account_payable_id": cls.account_payable.id, + } + ) cls.journal = cls.env["account.journal"].create( - {"name": "Test sale journal", "type": "sale", "code": "TEST",} + {"name": "Test sale journal", "type": "sale", "code": "TEST"} ) cls.expenses_journal = cls.env["account.journal"].create( - {"name": "Test expense journal", "type": "purchase", "code": "EXP",} + {"name": "Test expense journal", "type": "purchase", "code": "EXP"} ) cls.miscellaneous_journal = cls.env["account.journal"].create( - {"name": "Miscellaneus journal", "type": "general", "code": "OTHER",} + {"name": "Miscellaneus journal", "type": "general", "code": "OTHER"} ) - cls.customer_invoice = cls.env["account.invoice"].create( + cls.customer_invoice = cls.env["account.move"].create( { "journal_id": cls.journal.id, "type": "out_invoice", "partner_id": cls.partner.id, - "account_id": cls.account_receivable.id, "invoice_line_ids": [ ( 0, @@ -85,17 +92,16 @@ class TestAccountNetting(common.SavepointCase): ], } ) - cls.customer_invoice.action_invoice_open() - customer_move = cls.customer_invoice.move_id + cls.customer_invoice.action_post() + customer_move = cls.customer_invoice cls.move_line_1 = customer_move.line_ids.filtered( lambda x: x.account_id == cls.account_receivable ) - cls.supplier_invoice = cls.env["account.invoice"].create( + cls.supplier_invoice = cls.env["account.move"].create( { "journal_id": cls.expenses_journal.id, "type": "in_invoice", "partner_id": cls.partner.id, - "account_id": cls.account_payable.id, "invoice_line_ids": [ ( 0, @@ -109,20 +115,19 @@ class TestAccountNetting(common.SavepointCase): ], } ) - cls.supplier_invoice.action_invoice_open() - supplier_move = cls.supplier_invoice.move_id + cls.supplier_invoice.action_post() + supplier_move = cls.supplier_invoice cls.move_line_2 = supplier_move.line_ids.filtered( lambda x: x.account_id == cls.account_payable ) cls.move_line_3 = supplier_move.line_ids.filtered( lambda x: x.account_id == cls.account_expense ) - cls.supplier_invoice = cls.env["account.invoice"].create( + cls.supplier_invoice = cls.env["account.move"].create( { "journal_id": cls.expenses_journal.id, "type": "in_invoice", "partner_id": cls.partner1.id, - "account_id": cls.account_payable.id, "invoice_line_ids": [ ( 0, @@ -136,17 +141,16 @@ class TestAccountNetting(common.SavepointCase): ], } ) - cls.supplier_invoice.action_invoice_open() - supplier_move = cls.supplier_invoice.move_id + cls.supplier_invoice.action_post() + supplier_move = cls.supplier_invoice cls.move_line_4 = supplier_move.line_ids.filtered( lambda x: x.account_id == cls.account_payable ) - cls.supplier_invoice = cls.env["account.invoice"].create( + cls.supplier_invoice = cls.env["account.move"].create( { "journal_id": cls.expenses_journal.id, "type": "in_refund", "partner_id": cls.partner1.id, - "account_id": cls.account_payable.id, "invoice_line_ids": [ ( 0, @@ -160,17 +164,16 @@ class TestAccountNetting(common.SavepointCase): ], } ) - cls.supplier_invoice.action_invoice_open() - supplier_move = cls.supplier_invoice.move_id + cls.supplier_invoice.action_post() + supplier_move = cls.supplier_invoice cls.move_line_5 = supplier_move.line_ids.filtered( lambda x: x.account_id == cls.account_payable ) - cls.supplier_invoice = cls.env["account.invoice"].create( + cls.supplier_invoice = cls.env["account.move"].create( { "journal_id": cls.expenses_journal.id, "type": "in_refund", "partner_id": cls.partner1.id, - "account_id": cls.account_payable.id, "invoice_line_ids": [ ( 0, @@ -184,8 +187,8 @@ class TestAccountNetting(common.SavepointCase): ], } ) - cls.supplier_invoice.action_invoice_open() - supplier_move = cls.supplier_invoice.move_id + cls.supplier_invoice.action_post() + supplier_move = cls.supplier_invoice cls.move_line_6 = supplier_move.line_ids.filtered( lambda x: x.account_id == cls.account_payable ) diff --git a/account_netting/wizards/account_move_make_netting.py b/account_netting/wizards/account_move_make_netting.py index 0fea5444a..e117046c5 100644 --- a/account_netting/wizards/account_move_make_netting.py +++ b/account_netting/wizards/account_move_make_netting.py @@ -17,7 +17,7 @@ class AccountMoveMakeNetting(models.TransientModel): 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 @@ -54,7 +54,7 @@ class AccountMoveMakeNetting(models.TransientModel): "be the same for all." ) ) - res = super(AccountMoveMakeNetting, self).default_get(fields_list) + res = super().default_get(fields_list) res["move_line_ids"] = [(6, 0, move_lines.ids)] debit_move_lines_debit = move_lines.filtered("debit") credit_move_lines_debit = move_lines.filtered("credit") @@ -69,7 +69,7 @@ class AccountMoveMakeNetting(models.TransientModel): self.ensure_one() # Create account move move = self.env["account.move"].create( - {"ref": _("AR/AP netting"), "journal_id": self.journal_id.id,} + {"ref": _("AR/AP netting"), "journal_id": self.journal_id.id} ) # Group amounts by account account_groups = self.move_line_ids.read_group( diff --git a/account_netting/wizards/account_move_make_netting_view.xml b/account_netting/wizards/account_move_make_netting_view.xml index 2f1ac9fa9..ed8978363 100644 --- a/account_netting/wizards/account_move_make_netting_view.xml +++ b/account_netting/wizards/account_move_make_netting_view.xml @@ -3,11 +3,9 @@