summaryrefslogtreecommitdiff
path: root/addons/account/tests/test_account_move_out_invoice.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/account/tests/test_account_move_out_invoice.py')
-rw-r--r--addons/account/tests/test_account_move_out_invoice.py41
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({