[IMP] account: add test

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) <wan@odoo.com>
Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
This commit is contained in:
guva-odoo
2023-11-22 00:46:23 +00:00
parent 2c3f0ead11
commit 453fe870c1
@@ -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')