Skip to content

Commit

Permalink
[FIX] Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SMaciasOSI committed Jan 2, 2025
1 parent b1c3b2f commit 9d9bfb3
Showing 1 changed file with 5 additions and 31 deletions.
36 changes: 5 additions & 31 deletions l10n_mx_cfdi_account/tests/test_account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def setUp(self):
{
"name": "Test Product",
"default_code": "TP",
# Add other required fields here
"lst_price": "100",
}
)

Expand All @@ -71,30 +71,10 @@ def setUp(self):
)

self.move_line_1_vals = {
"name": "Test Move Line 1",
"product_id": self.product.id,
"price_unit": 100,
"name": "Test Move Line 1",
"quantity": 2,
"price_subtotal": 200.00,
"price_total": 220.00,
# 'tax_ids': [(6, 0, [self.tax.id])],
"amount_currency": 200,
"balance": 200,
"debit": 200,
"account_id": self.account.id,
}

self.move_line_2_vals = {
"name": "Test Move Line 2",
"product_id": self.product.id,
"price_unit": 200,
"quantity": 1,
"price_subtotal": 200.00,
"price_total": 220.00,
# 'tax_ids': [(6, 0, [self.tax.id])],
"amount_currency": -200,
"balance": -200,
"credit": 200,
"account_id": self.account.id,
}

Expand All @@ -104,7 +84,7 @@ def setUp(self):
"currency_id": self.currency.id,
"company_id": self.company.id,
"journal_id": self.journal.id,
"line_ids": [(0, 0, self.move_line_1_vals), (0, 0, self.move_line_2_vals)],
"invoice_line_ids": [(0, 0, self.move_line_1_vals)],
}

def test_compute_cfdi_fields(self):
Expand All @@ -113,18 +93,12 @@ def test_compute_cfdi_fields(self):
move_line_1 = move.line_ids.filtered(
lambda line: line.name == "Test Move Line 1"
)
move_line_2 = move.line_ids.filtered(
lambda line: line.name == "Test Move Line 2"
)

move_line_1._compute_cfdi_fields()
move_line_2._compute_cfdi_fields()

# Assuming the test logic for computing CFDI fields here...

self.assertEqual(move_line_1.cfdi_subtotal, -200.00)
self.assertEqual(move_line_1.cfdi_price_unit, -100.00)
self.assertEqual(move_line_2.cfdi_subtotal, 200.00)
self.assertEqual(move_line_2.cfdi_price_unit, 200.00)
self.assertEqual(move_line_1.cfdi_subtotal, 200.00)
self.assertEqual(move_line_1.cfdi_price_unit, 100.00)

# Add assertions for move_line_2 if necessary

0 comments on commit 9d9bfb3

Please sign in to comment.