'Test that creating a move.line with tax_ids generates the tax move lines and adjust line amount when a tax is price_include'

def test_tax_move_lines_creation(self):

    self.fixed_tax.price_include = True
    self.fixed_tax.include_base_amount = True
    company_id = self.env['res.users'].browse(self.env.uid).company_id.id
    vals = {'date': time.strftime('%Y-01-01'), 'journal_id': self.bank_journal.id, 'name': 'Test    move', 'line_ids': [(0, 0, {'account_id': self.bank_account.id, 'debit': 235, 'credit': 0, 'name': 'Bank    Fees', 'partner_id': False}), (0, 0, {'account_id': self.expense_account.id, 'debit': 0, 'credit': 200, 'date': time.strftime('%Y-01-01'), 'name': 'Bank    Fees', 'partner_id': False, 'tax_ids': [(4, self.group_tax.id), (4, self.fixed_tax_bis.id)]})], 'company_id': company_id}
    move = self.env['account.move'].with_context(apply_taxes=True).create(vals)
    aml_fixed_tax = move.line_ids.filtered((lambda l: (l.tax_line_id.id == self.fixed_tax.id)))
    aml_percent_tax = move.line_ids.filtered((lambda l: (l.tax_line_id.id == self.percent_tax.id)))
    aml_fixed_tax_bis = move.line_ids.filtered((lambda l: (l.tax_line_id.id == self.fixed_tax_bis.id)))
    self.assertEquals(len(aml_fixed_tax), 1)
    self.assertEquals(aml_fixed_tax.credit, 10)
    self.assertEquals(len(aml_percent_tax), 1)
    self.assertEquals(aml_percent_tax.credit, 20)
    self.assertEquals(len(aml_fixed_tax_bis), 1)
    self.assertEquals(aml_fixed_tax_bis.credit, 15)
    aml_with_taxes = move.line_ids.filtered((lambda l: (set(l.tax_ids.ids) == set([self.group_tax.id, self.fixed_tax_bis.id]))))
    self.assertEquals(len(aml_with_taxes), 1)
    self.assertEquals(aml_with_taxes.credit, 190)
