diff options
| author | OCA Git Bot <oca-git-bot@odoo-community.org> | 2025-02-09 00:30:13 +0100 |
|---|---|---|
| committer | OCA Git Bot <oca-git-bot@odoo-community.org> | 2025-02-09 00:30:13 +0100 |
| commit | 55b638b0933fc954f97705b349b928276c044431 (patch) | |
| tree | 88342c3780002fef8865bb02065e9588ab1de0a5 /addons/account/tests/test_account_move_out_invoice.py | |
| parent | 0b55f1e35d2f49e07dc68e0212d8d4f5f0d838ca (diff) | |
| parent | 7aa2b5f9042f7c9cc190d03f224338e521f50d3a (diff) | |
Merge remote-tracking branch 'odoo/18.0' into 18.018.0
Diffstat (limited to 'addons/account/tests/test_account_move_out_invoice.py')
| -rw-r--r-- | addons/account/tests/test_account_move_out_invoice.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/addons/account/tests/test_account_move_out_invoice.py b/addons/account/tests/test_account_move_out_invoice.py index d690950a626..d7a3630c162 100644 --- a/addons/account/tests/test_account_move_out_invoice.py +++ b/addons/account/tests/test_account_move_out_invoice.py @@ -3662,6 +3662,47 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon): ] self.assertRecordValues(caba_move.line_ids, expected_values) + def test_out_invoice_caba_on_payment(self): + self.env.company.tax_exigibility = True + tax_waiting_account = self.env['account.account'].create({ + 'name': 'TAX_WAIT', + 'code': 'TWAIT', + 'account_type': 'liability_current', + 'reconcile': True, + }) + caba_tax = self.env['account.tax'].create({ + 'name': 'cash basis 10%', + 'type_tax_use': 'sale', + 'amount': 10, + 'tax_exigibility': 'on_payment', + 'cash_basis_transition_account_id': tax_waiting_account.id, + }) + caba_tax.invoice_repartition_line_ids.account_id.reconcile = True + invoice = self.env['account.move'].create({ + 'move_type': 'out_invoice', + 'partner_id': self.partner_a.id, + 'invoice_line_ids': [ + Command.create({ + 'price_unit': 1000.0, + 'tax_ids': [Command.set(caba_tax.ids)], + }) + ], + }) + invoice.invoice_line_ids.tax_ids = caba_tax + invoice.action_post() + credit_note = invoice._reverse_moves() + credit_note.action_post() + receivable_lines = (invoice + credit_note).line_ids.filtered(lambda l: l.account_id == self.partner_a.property_account_receivable_id) + invoice_receivable_matching, refund_receivable_matching = receivable_lines.mapped('matching_number') + self.assertEqual(invoice_receivable_matching, refund_receivable_matching) + # The tax account should be reconciled with the CABA entries if they exist + # But ideally, they shouldn't exist since no cash was involved. + tax_lines = (invoice + credit_note).line_ids.filtered(lambda l: l.account_id == tax_waiting_account) + invoice_tax_matching, refund_tax_matching = tax_lines.mapped('matching_number') + self.assertNotEqual(invoice_tax_matching, refund_tax_matching) + self.assertTrue(all([invoice_tax_matching, refund_tax_matching, invoice_receivable_matching, refund_receivable_matching])) + + def test_tax_grid_remove_tax(self): # Add a tag to tax_sale_a tax_line_tag = self.env['account.account.tag'].create({ |
