Merge PR #790 into 13.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2021-03-12 17:28:00 +00:00
2 changed files with 15 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
# Copyright 2017 Tecnativa - Luis M. Ontalba
# Copyright 2021 Tecnativa - João Marques
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0
from odoo import fields
@@ -29,13 +30,12 @@ class TestAccountPaymentOrderReturn(common.SavepointCase):
)
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", "code": "Test"}
)
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
@@ -45,7 +45,7 @@ class TestAccountPaymentOrderReturn(common.SavepointCase):
cls.payment_mode = cls.env["account.payment.mode"].create(
{
"name": "Test payment mode",
"fixed_journal_id": cls.journal.id,
"fixed_journal_id": cls.invoice.journal_id.id,
"bank_account_link": "variable",
"payment_method_id": cls.env.ref(
"account.account_payment_method_manual_in"
@@ -73,7 +73,7 @@ class TestAccountPaymentOrderReturn(common.SavepointCase):
wizard = wizard_o.with_context(context).create(
{
"order_id": self.payment_order.id,
"journal_ids": [(4, self.journal.id)],
"journal_ids": [(4, self.journal.id), (4, self.invoice.journal_id.id)],
"allow_blocked": True,
"date_type": "move",
"move_date": fields.Date.today(),
@@ -89,9 +89,7 @@ class TestAccountPaymentOrderReturn(common.SavepointCase):
)
# Invert the move to simulate the payment
self.payment_move = self.env["account.move"].create(
self.invoice._reverse_move_vals(
default_values={"journal_id": self.journal.id}
)
self.invoice._reverse_move_vals(default_values={})
)
self.payment_move.action_post()
self.payment_line = self.payment_move.line_ids.filtered(
@@ -99,6 +97,10 @@ class TestAccountPaymentOrderReturn(common.SavepointCase):
)
# Reconcile both
(self.receivable_line | self.payment_line).reconcile()
# prev_move_lines
wizard.include_returned = False
wizard.populate()
prev_move_lines = wizard.move_line_ids
# Create payment return
self.payment_return = self.env["payment.return"].create(
{
@@ -119,4 +121,4 @@ class TestAccountPaymentOrderReturn(common.SavepointCase):
self.payment_return.action_confirm()
wizard.include_returned = False
wizard.populate()
self.assertFalse(wizard.move_line_ids)
self.assertTrue((wizard.move_line_ids - prev_move_lines), 1)

View File

@@ -181,7 +181,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
{
"partner_id": cls.supplier.id,
"type": "in_invoice",
"journal_id": cls.journal_c1.id,
"journal_id": cls.journal_purchase.id,
}
)
@@ -434,7 +434,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
{
"partner_id": self.supplier.id,
"type": "in_invoice",
"journal_id": self.journal_c1.id,
"journal_id": self.journal_purchase.id,
}
)
self.assertEqual(in_invoice.payment_mode_filter_type_domain, "outbound")
@@ -445,7 +445,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
{
"partner_id": self.customer.id,
"type": "out_refund",
"journal_id": self.journal_c2.id,
"journal_id": self.journal_sale.id,
}
)
self.assertEqual(out_refund.payment_mode_filter_type_domain, "outbound")
@@ -456,7 +456,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
{
"partner_id": self.supplier.id,
"type": "in_refund",
"journal_id": self.journal_c1.id,
"journal_id": self.journal_purchase.id,
}
)
self.assertEqual(in_refund.payment_mode_filter_type_domain, "inbound")
@@ -467,7 +467,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
{
"partner_id": self.customer.id,
"type": "out_invoice",
"journal_id": self.journal_c2.id,
"journal_id": self.journal_sale.id,
}
)
self.assertEqual(out_invoice.payment_mode_filter_type_domain, "inbound")