From 453fe870c13c01d8d3a6ec01b2d301f19ddb63a8 Mon Sep 17 00:00:00 2001 From: guva-odoo Date: Mon, 20 Nov 2023 14:44:58 +0000 Subject: [PATCH] [IMP] account: add test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test for 0c19497a482efe39a2c7778df4735ba548a847b4 Use case already covered since 16.0 but test was missing opw-3600605 closes odoo/odoo#142986 X-original-commit: d9505dacffc045a24d77da75e8d3956703e0fbf3 Signed-off-by: William André (wan) Signed-off-by: Guillaume Vanleynseele (guva) --- .../tests/test_account_move_out_invoice.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/addons/account/tests/test_account_move_out_invoice.py b/addons/account/tests/test_account_move_out_invoice.py index 6118a70c4a1..3313773aad1 100644 --- a/addons/account/tests/test_account_move_out_invoice.py +++ b/addons/account/tests/test_account_move_out_invoice.py @@ -1189,6 +1189,41 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon): 'amount_total': -2627.014, }) + def test_payment_term_line_fiscal_position(self): + """Test the mapping of payment term line accounts with fiscal position.""" + account_revenue_copy = self.company_data['default_account_revenue'].copy() + account_receivable_copy = self.company_data['default_account_receivable'].copy() + fp = self.env['account.fiscal.position'].create({ + 'name': 'Test FP', + 'account_ids': [ + Command.create({ + 'account_src_id': self.company_data['default_account_revenue'].id, + 'account_dest_id': account_revenue_copy.id, + }), + Command.create({ + 'account_src_id': self.company_data['default_account_receivable'].id, + 'account_dest_id': account_receivable_copy.id, + }), + ], + }) + invoice = self.env['account.move'].create({ + 'move_type': 'out_invoice', + 'invoice_date': '2019-01-01', + 'partner_id': self.partner_a.id, + 'fiscal_position_id': fp.id, + 'invoice_line_ids': [ + Command.create({ + 'product_id': self.product_a.id, + 'price_unit': 295.0, + 'tax_ids': [(6, 0, self.product_a.taxes_id.ids)], + }), + ], + }) + invoice.action_post() + + self.assertIn(account_receivable_copy, invoice.line_ids.account_id) + self.assertIn(account_revenue_copy, invoice.line_ids.account_id) + def test_out_invoice_line_onchange_analytic(self): self.env.user.groups_id += self.env.ref('analytic.group_analytic_accounting')