diff --git a/account_payment_order_return/README.rst b/account_payment_order_return/README.rst index 0399d7fcd..2efdd62ab 100644 --- a/account_payment_order_return/README.rst +++ b/account_payment_order_return/README.rst @@ -14,13 +14,13 @@ Account Payment Order Return :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github - :target: https://github.com/OCA/bank-payment/tree/12.0/account_payment_order_return + :target: https://github.com/OCA/bank-payment/tree/13.0/account_payment_order_return :alt: OCA/bank-payment .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/bank-payment-12-0/bank-payment-12-0-account_payment_order_return + :target: https://translation.odoo-community.org/projects/bank-payment-13-0/bank-payment-13-0-account_payment_order_return :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/173/12.0 + :target: https://runbot.odoo-community.org/runbot/173/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -44,11 +44,11 @@ This module is auto-installed when you install *account_payment_return* and Usage ===== -#. Go to Invoicing > Payments > Debit Orders. +#. Go to Invoicing > Customers > Debit Orders. #. Create a new record. #. Click on button "Create Payment Lines from Journal Items" to open the wizard. -#. Click on the "Include move lines from returns " check. +#. Click on the "Include move lines from returns" check. #. Fill other options. #. Click on button "Add All Move Lines". @@ -58,7 +58,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. @@ -75,8 +75,9 @@ Contributors * Tecnativa - * Luis M. Ontalba - * Vicent Cubells + * Luis M. Ontalba + * Vicent Cubells + * João Marques * Kitti U. @@ -93,6 +94,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/bank-payment `_ project on GitHub. +This module is part of the `OCA/bank-payment `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_payment_order_return/__manifest__.py b/account_payment_order_return/__manifest__.py index e8e19e472..b1d6ccf9f 100644 --- a/account_payment_order_return/__manifest__.py +++ b/account_payment_order_return/__manifest__.py @@ -1,14 +1,15 @@ # Copyright 2017 Tecnativa - Luis M. Ontalba +# Copyright 2021 Tecnativa - João Marques # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { "name": "Account Payment Order Return", - "version": "12.0.1.1.0", + "version": "13.0.1.0.0", "category": "Banking addons", "author": "Tecnativa, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/bank-payment", - "depends": ["account_payment_return", "account_payment_order",], - "data": ["wizards/account_payment_line_create_view.xml",], + "depends": ["account_payment_return", "account_payment_order"], + "data": ["wizards/account_payment_line_create_view.xml"], "license": "AGPL-3", "installable": True, "auto_install": True, diff --git a/account_payment_order_return/i18n/account_payment_order_return.pot b/account_payment_order_return/i18n/account_payment_order_return.pot index 4f3089979..e887c6a65 100644 --- a/account_payment_order_return/i18n/account_payment_order_return.pot +++ b/account_payment_order_return/i18n/account_payment_order_return.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_payment_order_return +# * account_payment_order_return # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -22,4 +22,3 @@ msgstr "" #: model:ir.model,name:account_payment_order_return.model_account_payment_line_create msgid "Wizard to create payment lines" msgstr "" - diff --git a/account_payment_order_return/readme/CONTRIBUTORS.rst b/account_payment_order_return/readme/CONTRIBUTORS.rst index e6b32b377..0b3c25a4a 100644 --- a/account_payment_order_return/readme/CONTRIBUTORS.rst +++ b/account_payment_order_return/readme/CONTRIBUTORS.rst @@ -1,6 +1,7 @@ * Tecnativa - * Luis M. Ontalba - * Vicent Cubells + * Luis M. Ontalba + * Vicent Cubells + * João Marques * Kitti U. diff --git a/account_payment_order_return/readme/USAGE.rst b/account_payment_order_return/readme/USAGE.rst index 826c26df4..1bff6ad95 100644 --- a/account_payment_order_return/readme/USAGE.rst +++ b/account_payment_order_return/readme/USAGE.rst @@ -1,7 +1,7 @@ -#. Go to Invoicing > Payments > Debit Orders. +#. Go to Invoicing > Customers > Debit Orders. #. Create a new record. #. Click on button "Create Payment Lines from Journal Items" to open the wizard. -#. Click on the "Include move lines from returns " check. +#. Click on the "Include move lines from returns" check. #. Fill other options. #. Click on button "Add All Move Lines". diff --git a/account_payment_order_return/static/description/index.html b/account_payment_order_return/static/description/index.html index 8c7c5664a..9d9bfe4c5 100644 --- a/account_payment_order_return/static/description/index.html +++ b/account_payment_order_return/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/bank-payment Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/bank-payment Translate me on Weblate Try me on Runbot

This module adds a check in the wizard where move lines are imported into payment order. This check lets include in selection lines from invoices linked to a @@ -394,11 +394,11 @@ payment return.

Usage

    -
  1. Go to Invoicing > Payments > Debit Orders.
  2. +
  3. Go to Invoicing > Customers > Debit Orders.
  4. Create a new record.
  5. Click on button “Create Payment Lines from Journal Items” to open the wizard.
  6. -
  7. Click on the “Include move lines from returns ” check.
  8. +
  9. Click on the “Include move lines from returns” check.
  10. Fill other options.
  11. Click on button “Add All Move Lines”.
@@ -408,7 +408,7 @@ wizard.

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.

@@ -423,8 +423,9 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

Contributors

diff --git a/account_payment_order_return/tests/test_account_payment_order_return.py b/account_payment_order_return/tests/test_account_payment_order_return.py index 31f03f169..c26b0e93c 100644 --- a/account_payment_order_return/tests/test_account_payment_order_return.py +++ b/account_payment_order_return/tests/test_account_payment_order_return.py @@ -1,8 +1,10 @@ # Copyright 2017 Tecnativa - Luis M. Ontalba +# Copyright 2021 Tecnativa - João Marques # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0 from odoo import fields from odoo.tests import common +from odoo.tests.common import Form class TestAccountPaymentOrderReturn(common.SavepointCase): @@ -10,42 +12,36 @@ class TestAccountPaymentOrderReturn(common.SavepointCase): def setUpClass(cls): super(TestAccountPaymentOrderReturn, cls).setUpClass() cls.account_type = cls.env["account.account.type"].create( - {"name": "Test Account Type"} + { + "name": "Test Account Type", + "type": "receivable", + "internal_group": "income", + } ) cls.a_receivable = cls.env["account.account"].create( { "code": "TAA", "name": "Test Receivable Account", + "reconcile": True, "internal_type": "receivable", "user_type_id": cls.account_type.id, } ) - cls.partner = cls.env["res.partner"].create( - {"name": "Test Partner 2", "parent_id": False,} - ) + cls.partner = cls.env["res.partner"].create({"name": "Test Partner 2"}) cls.journal = cls.env["account.journal"].create( - {"name": "Test Journal", "type": "bank",} + {"name": "Test Journal", "type": "bank"} ) - cls.invoice = cls.env["account.invoice"].create( - { - "name": "Test Invoice 3", - "partner_id": cls.partner.id, - "type": "out_invoice", - "journal_id": cls.journal.id, - "invoice_line_ids": [ - ( - 0, - 0, - { - "account_id": cls.a_receivable.id, - "name": "Test line", - "quantity": 1.0, - "price_unit": 100.00, - }, - ) - ], - } + move_form = Form( + cls.env["account.move"].with_context(default_type="out_invoice") ) + move_form.partner_id = cls.partner + move_form.journal_id = cls.journal + with move_form.invoice_line_ids.new() as line_form: + line_form.name = "Test line" + line_form.account_id = cls.a_receivable + line_form.quantity = 1.0 + line_form.price_unit = 100.00 + cls.invoice = move_form.save() cls.payment_mode = cls.env["account.payment.mode"].create( { "name": "Test payment mode", @@ -65,7 +61,7 @@ class TestAccountPaymentOrderReturn(common.SavepointCase): ) def test_global(self): - self.invoice.action_invoice_open() + self.invoice.action_post() wizard_o = self.env["account.payment.line.create"] context = wizard_o._context.copy() context.update( @@ -88,15 +84,16 @@ class TestAccountPaymentOrderReturn(common.SavepointCase): ) wizard.populate() self.assertTrue(len(wizard.move_line_ids), 1) - self.receivable_line = self.invoice.move_id.line_ids.filtered( + self.receivable_line = self.invoice.line_ids.filtered( lambda x: x.account_id.internal_type == "receivable" ) # Invert the move to simulate the payment - self.payment_move = self.invoice.move_id.copy({"journal_id": self.journal.id}) - for move_line in self.payment_move.line_ids: - move_line.with_context(check_move_validity=False).write( - {"debit": move_line.credit, "credit": move_line.debit} + self.payment_move = self.env["account.move"].create( + self.invoice._reverse_move_vals( + default_values={"journal_id": self.journal.id} ) + ) + self.payment_move.action_post() self.payment_line = self.payment_move.line_ids.filtered( lambda x: x.account_id.internal_type == "receivable" ) diff --git a/account_payment_order_return/wizards/account_payment_line_create.py b/account_payment_order_return/wizards/account_payment_line_create.py index 8053158f1..d8fa00944 100644 --- a/account_payment_order_return/wizards/account_payment_line_create.py +++ b/account_payment_order_return/wizards/account_payment_line_create.py @@ -1,7 +1,8 @@ # Copyright 2017 Tecnativa - Luis M. Ontalba +# Copyright 2021 Tecnativa - João Marques # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from odoo import api, fields, models +from odoo import fields, models class AccountPaymentLineCreate(models.TransientModel): @@ -9,13 +10,10 @@ class AccountPaymentLineCreate(models.TransientModel): include_returned = fields.Boolean(string="Include move lines from returns") - @api.multi def _prepare_move_line_domain(self): domain = super(AccountPaymentLineCreate, self)._prepare_move_line_domain() if not self.include_returned: domain += [ - "|", - ("invoice_id", "=", False), - ("invoice_id.returned_payment", "=", False), + ("move_id.returned_payment", "=", False), ] return domain