[FIX] account: caba flow with tax group
Accounting > Configuration > Settings > Enable cash basis Create [Tax 1] as follows: - Name: Tax Exigible - Tax Type: "Purchase". - In the Tax Repartition Lines, add a different tag for each repartition line - Tax Exigibility "Based on Payment". Create [Tax 2] as a standard tax for purchase Create a [Tax Group] as "Group of Taxes" using [Tax 1] and [Tax 2]. Create a Bill that uses [Tax Group], Confirm and Register payment. Issue: The CABA entry will not have tax and tax tags set up correctly, [Tax 1] information will be missing. Because tax information is missing during the creation of CABA entry an exchange rate is created when it is not necessary opw-3435601 closes odoo/odoo#132521 X-original-commit: ea848ab0f065d57b2b018a2e92479b94a49b4848 Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
@@ -252,7 +252,7 @@ class AccountPartialReconcile(models.Model):
|
||||
account.move.line.
|
||||
'''
|
||||
account = base_line.company_id.account_cash_basis_base_account_id or base_line.account_id
|
||||
tax_ids = base_line.tax_ids.filtered(lambda x: x.tax_exigibility == 'on_payment')
|
||||
tax_ids = base_line.tax_ids.flatten_taxes_hierarchy().filtered(lambda x: x.tax_exigibility == 'on_payment')
|
||||
is_refund = base_line.is_refund
|
||||
tax_tags = tax_ids.get_tax_tags(is_refund, 'base')
|
||||
product_tags = base_line.tax_tag_ids.filtered(lambda x: x.applicability == 'products')
|
||||
@@ -365,7 +365,7 @@ class AccountPartialReconcile(models.Model):
|
||||
base_line.currency_id.id,
|
||||
base_line.partner_id.id,
|
||||
(account or base_line.account_id).id,
|
||||
tuple(base_line.tax_ids.filtered(lambda x: x.tax_exigibility == 'on_payment').ids),
|
||||
tuple(base_line.tax_ids.flatten_taxes_hierarchy().filtered(lambda x: x.tax_exigibility == 'on_payment').ids),
|
||||
)
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -4329,14 +4329,20 @@ class TestAccountMoveReconcile(AccountTestInvoicingCommon):
|
||||
|
||||
caba_move = self.env['account.move'].search([('tax_cash_basis_origin_move_id', '=', invoice.id)])
|
||||
self.assertEqual(len(caba_move.line_ids), 6, "All lines should be there")
|
||||
tax_group_base_tags = (tax_a | tax_b).invoice_repartition_line_ids.filtered(lambda l: l.repartition_type == 'base').tag_ids.ids
|
||||
tax_a_tax_tag = tax_a.invoice_repartition_line_ids.filtered(lambda l: l.repartition_type == 'tax').tag_ids.ids
|
||||
tax_b_tax_tag = tax_b.invoice_repartition_line_ids.filtered(lambda l: l.repartition_type == 'tax').tag_ids.ids
|
||||
self.assertRecordValues(caba_move.line_ids, [
|
||||
{'balance': 3000.0, 'tax_line_id': False},
|
||||
{'balance': -3000.0, 'tax_line_id': False},
|
||||
{'balance': 1000.0, 'tax_line_id': False},
|
||||
{'balance': -1000.0, 'tax_line_id': tax_a.id},
|
||||
{'balance': 1.0, 'tax_line_id': False},
|
||||
{'balance': -1.0, 'tax_line_id': tax_b.id},
|
||||
{'balance': 3000.0, 'tax_line_id': False, 'tax_tag_ids': [], 'tax_ids': []},
|
||||
{'balance': -3000.0, 'tax_line_id': False, 'tax_tag_ids': tax_group_base_tags, 'tax_ids': (tax_a | tax_b).ids},
|
||||
{'balance': 1000.0, 'tax_line_id': False, 'tax_tag_ids': [], 'tax_ids': []},
|
||||
{'balance': -1000.0, 'tax_line_id': tax_a.id, 'tax_tag_ids': tax_a_tax_tag, 'tax_ids': []},
|
||||
{'balance': 1.0, 'tax_line_id': False, 'tax_tag_ids': [], 'tax_ids': []},
|
||||
{'balance': -1.0, 'tax_line_id': tax_b.id, 'tax_tag_ids': tax_b_tax_tag, 'tax_ids': []},
|
||||
])
|
||||
# No exchange journal entry created for CABA.
|
||||
exchange_difference_move = invoice.line_ids.filtered(lambda line: line.account_id.account_type == 'receivable').full_reconcile_id.exchange_move_id
|
||||
self.assertFalse(exchange_difference_move)
|
||||
|
||||
def test_caba_rounding_adjustment_monocurrency(self):
|
||||
self.env.company.tax_exigibility = True
|
||||
|
||||
Reference in New Issue
Block a user