mirror of
https://gitlab.com/flectra-community/partner-contact.git
synced 2024-12-24 13:21:48 +00:00
22 lines
699 B
Python
22 lines
699 B
Python
# Copyright 2019-2020: Druidoo (<https://www.druidoo.io>)
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
|
|
|
from dateutil.relativedelta import relativedelta
|
|
|
|
from flectra import fields
|
|
from flectra.tests import common
|
|
|
|
|
|
class TestResPartner(common.TransactionCase):
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.partner_admin = self.env.ref("base.partner_admin")
|
|
self.partner_admin.write({"birthdate_date": "1991-09-05"})
|
|
|
|
def test_compute_age(self):
|
|
self.partner_admin._compute_age()
|
|
age = relativedelta(
|
|
fields.Date.today(), self.partner_admin.birthdate_date
|
|
).years
|
|
self.assertEqual(self.partner_admin.age, age)
|