From 8dca1a60f54f52a5d37889775688a9e2b8ae173e Mon Sep 17 00:00:00 2001 From: RamakrishnaVellala Date: Thu, 16 May 2024 08:17:19 +0530 Subject: [PATCH 1/2] G2P-2145 adding placeholder for date of birth field --- g2p_registry_individual/views/individuals_view.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/g2p_registry_individual/views/individuals_view.xml b/g2p_registry_individual/views/individuals_view.xml index aab0c0e..449c234 100644 --- a/g2p_registry_individual/views/individuals_view.xml +++ b/g2p_registry_individual/views/individuals_view.xml @@ -157,7 +157,7 @@ colspan="2" > - - + @@ -330,7 +335,8 @@

Create a new individual registrant! -

+

+

Click the create button to enter the new registrant's information.

From b868fec801fc1fa5b8ffe2e5da4c1b591360922b Mon Sep 17 00:00:00 2001 From: RamakrishnaVellala Date: Thu, 16 May 2024 08:27:29 +0530 Subject: [PATCH 2/2] G2P-2149 Odoo17_Individual_Personal Info_Age allowed proper values now --- g2p_registry_individual/models/individual.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/g2p_registry_individual/models/individual.py b/g2p_registry_individual/models/individual.py index 9d07010..b7b8a5a 100644 --- a/g2p_registry_individual/models/individual.py +++ b/g2p_registry_individual/models/individual.py @@ -45,6 +45,12 @@ def _compute_calc_age(self): for line in self: line.age = self.compute_age_from_dates(line.birthdate) + @api.constrains("age") + def _check_age_is_integer(self): + for record in self: + if record.age and not record.age.isdigit(): + raise ValidationError(_("Age must be a valid integer.")) + def compute_age_from_dates(self, partner_dob): now = datetime.strptime(str(fields.Datetime.now())[:10], "%Y-%m-%d") if partner_dob: