[MIG] account_payment_order_return: Migration to 13.0

TT27858
This commit is contained in:
João Marques
2021-02-12 07:38:31 +00:00
committed by almumu
parent e0a178d223
commit f418bf1db5
8 changed files with 60 additions and 62 deletions

View File

@@ -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 <https://github.com/OCA/bank-payment/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 <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_return%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_return%0Aversion:%2013.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.
@@ -75,8 +75,9 @@ Contributors
* Tecnativa <https://www.tecnativa.com>
* Luis M. Ontalba <luis.martinez@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Luis M. Ontalba
* Vicent Cubells
* João Marques
* Kitti U. <kittiu@ecosoft.co.th>
@@ -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 <https://github.com/OCA/bank-payment/tree/12.0/account_payment_order_return>`_ project on GitHub.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/13.0/account_payment_order_return>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -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,

View File

@@ -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 ""

View File

@@ -1,6 +1,7 @@
* Tecnativa <https://www.tecnativa.com>
* Luis M. Ontalba <luis.martinez@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Luis M. Ontalba
* Vicent Cubells
* João Marques
* Kitti U. <kittiu@ecosoft.co.th>

View File

@@ -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".

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-payment/tree/12.0/account_payment_order_return"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-12-0/bank-payment-12-0-account_payment_order_return"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/173/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-payment/tree/13.0/account_payment_order_return"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-13-0/bank-payment-13-0-account_payment_order_return"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/173/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
<ol class="arabic simple">
<li>Go to Invoicing &gt; Payments &gt; Debit Orders.</li>
<li>Go to Invoicing &gt; Customers &gt; Debit Orders.</li>
<li>Create a new record.</li>
<li>Click on button “Create Payment Lines from Journal Items” to open the
wizard.</li>
<li>Click on the “Include move lines from returns ” check.</li>
<li>Click on the “Include move lines from returns” check.</li>
<li>Fill other options.</li>
<li>Click on button “Add All Move Lines”.</li>
</ol>
@@ -408,7 +408,7 @@ wizard.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-payment/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_return%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_return%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -423,8 +423,9 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple">
<li>Tecnativa &lt;<a class="reference external" href="https://www.tecnativa.com">https://www.tecnativa.com</a>&gt;<ul>
<li>Luis M. Ontalba &lt;<a class="reference external" href="mailto:luis.martinez&#64;tecnativa.com">luis.martinez&#64;tecnativa.com</a>&gt;</li>
<li>Vicent Cubells &lt;<a class="reference external" href="mailto:vicent.cubells&#64;tecnativa.com">vicent.cubells&#64;tecnativa.com</a>&gt;</li>
<li>Luis M. Ontalba</li>
<li>Vicent Cubells</li>
<li>João Marques</li>
</ul>
</li>
<li>Kitti U. &lt;<a class="reference external" href="mailto:kittiu&#64;ecosoft.co.th">kittiu&#64;ecosoft.co.th</a>&gt;</li>
@@ -437,7 +438,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/12.0/account_payment_order_return">OCA/bank-payment</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/13.0/account_payment_order_return">OCA/bank-payment</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -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"
)

View File

@@ -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