You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
  3. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
  4. from odoo.tests.common import TransactionCase
  5. class TestContractShowInvoice(TransactionCase):
  6. def setUp(self):
  7. super(TestContractShowInvoice, self).setUp()
  8. self.analytic_account = self.env['account.analytic.account'].create({
  9. 'name': 'Test contract show invoice',
  10. })
  11. self.invoice = self.env['account.invoice'].create(
  12. {'partner_id': self.env.ref('base.res_partner_2').id,
  13. 'type': 'out_invoice',
  14. })
  15. self.invoice._onchange_partner_id()
  16. self.invoice_line = self.env['account.invoice.line'].create(
  17. {'product_id': self.env.ref('product.product_product_2').id,
  18. 'quantity': 1.0,
  19. 'invoice_id': self.invoice.id,
  20. 'account_analytic_id': self.analytic_account.id,
  21. })
  22. self.invoice_line._onchange_product_id()
  23. def test_contract_show_invoice(self):
  24. self.assertEqual(len(self.analytic_account.analytic_account_ids), 1)