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')