[FIX] rma: Avoid set invoice_payment_term_id from partner default value in refund.

TT37690
This commit is contained in:
Víctor Martínez
2022-06-22 17:06:05 +02:00
committed by Nikolaus Weingartmair
parent b3f901c949
commit 75defb3d15
2 changed files with 6 additions and 0 deletions

View File

@@ -1048,6 +1048,8 @@ class Rma(models.Model):
"""
self.ensure_one()
invoice_form.partner_id = self.partner_invoice_id
# Avoid set partner default value
invoice_form.invoice_payment_term_id = self.env["account.payment.term"]
def _prepare_refund_line(self, line_form):
"""Hook method for preparing a refund line Form.

View File

@@ -39,6 +39,9 @@ class TestRma(SavepointCase):
{
"name": "Partner test",
"property_account_receivable_id": cls.account_receiv.id,
"property_payment_term_id": cls.env.ref(
"account.account_payment_term_30days"
).id,
}
)
cls.partner_invoice = cls.res_partner.create(
@@ -273,6 +276,7 @@ class TestRmaCase(TestRma):
rma.action_refund()
self.assertEqual(rma.refund_id.move_type, "out_refund")
self.assertEqual(rma.refund_id.state, "draft")
self.assertFalse(rma.refund_id.invoice_payment_term_id)
self.assertEqual(rma.refund_line_id.product_id, rma.product_id)
self.assertEqual(rma.refund_line_id.quantity, 10)
self.assertEqual(rma.refund_line_id.product_uom_id, rma.product_uom)