Skip to content

Commit

Permalink
WIP2
Browse files Browse the repository at this point in the history
  • Loading branch information
jem-odoo committed Jan 8, 2018
1 parent bb303e2 commit bc2d731
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions addons/hr_expense/tests/test_expenses.py
Expand Up @@ -11,7 +11,19 @@ class TestAccountEntry(TestExpenseCommon):

def setUp(self):
super(TestAccountEntry, self).setUp()
self.product_deliver_cost.write({'supplier_taxes_id': [(6, 0, [self.tax.id])]})

self.setUpAdditionalAccounts()

self.product_expense = self.env['product.product'].create({
'name': "Delivered at cost",
'standard_price': 700,
'list_price': 700,
'type': 'consu',
'supplier_taxes_id': [(6, 0, [self.tax.id])],
'default_code': 'CONSU-DELI-COST',
'taxes_id': False,
'property_account_expense_id': self.account_expense.id,
})

def test_account_entry(self):
""" Checking accounting move entries and analytic entries when submitting expense """
Expand All @@ -22,7 +34,7 @@ def test_account_entry(self):
expense_line = self.env['hr.expense'].create({
'name': 'Car Travel Expenses',
'employee_id': self.employee.id,
'product_id': self.product_deliver_cost.id,
'product_id': self.product_expense.id,
'unit_amount': 700.00,
'tax_ids': [(6, 0, [self.tax.id])],
'sheet_id': expense.id,
Expand Down Expand Up @@ -50,7 +62,7 @@ def test_account_entry(self):
if not line.tax_line_id == self.tax:
self.assertAlmostEquals(line.debit, 636.36)
self.assertEquals(len(line.analytic_line_ids), 1, "The debit move line should have 1 analytic lines")
self.assertEquals(line.product_id, self.product_deliver_cost, "Product of debit move line should be the one from the expense")
self.assertEquals(line.product_id, self.product_expense, "Product of debit move line should be the one from the expense")
else:
self.assertAlmostEquals(line.debit, 63.64)
self.assertEquals(len(line.analytic_line_ids), 0, "The tax move line should not have analytic lines")
Expand All @@ -59,4 +71,4 @@ def test_account_entry(self):
self.assertEquals(self.analytic_account.line_ids, expense.account_move_id.mapped('line_ids.analytic_line_ids'))
self.assertEquals(len(self.analytic_account.line_ids), 1, "Analytic Account should have only one line")
self.assertAlmostEquals(self.analytic_account.line_ids[0].amount, -636.36, "Amount on the only AAL is wrong")
self.assertEquals(self.analytic_account.line_ids[0].product_id, self.product_deliver_cost, "Product of AAL should be the one from the expense")
self.assertEquals(self.analytic_account.line_ids[0].product_id, self.product_expense, "Product of AAL should be the one from the expense")

0 comments on commit bc2d731

Please sign in to comment.