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.

21 lines
713 B

  1. # Copyright 2019-2020: Druidoo (<https://www.druidoo.io>)
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from dateutil.relativedelta import relativedelta
  4. from odoo import fields
  5. from odoo.tests import common
  6. class TestResPartner(common.TransactionCase):
  7. def setUp(self):
  8. super(TestResPartner, self).setUp()
  9. self.partner_admin = self.env.ref("base.partner_admin")
  10. self.partner_admin.write({"birthdate_date": "1991-09-05"})
  11. def test_compute_age(self):
  12. self.partner_admin._compute_age()
  13. age = relativedelta(
  14. fields.Date.today(), self.partner_admin.birthdate_date
  15. ).years
  16. self.assertEqual(self.partner_admin.age, age)