Skip to content

Commit

Permalink
Merge pull request #136 from RamakrishnaVellala/17.0-develop
Browse files Browse the repository at this point in the history
G2p-2145, G2p-2149 bugs fixing
  • Loading branch information
shibu-narayanan authored May 16, 2024
2 parents 86c588c + b868fec commit 23682f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions g2p_registry_individual/models/individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 9 additions & 3 deletions g2p_registry_individual/views/individuals_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
colspan="2"
>
<tree decoration-danger="disabled">
<field
<field
name="phone_no"
string="Phone Numbers"
widget="phone"
Expand All @@ -175,7 +175,12 @@
<field name="birth_place" readonly="disabled" />
</group>
<group colspan="3">
<field name="birthdate" readonly="disabled" colspan="2" />
<field
name="birthdate"
readonly="disabled"
colspan="2"
placeholder="mm/dd/yyyy"
/>
<field name="birthdate_not_exact" readonly="disabled" />
<field name="age" readonly="disabled" />
<field name="gender" readonly="disabled" />
Expand Down Expand Up @@ -330,7 +335,8 @@
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new individual registrant!
</p><p>
</p>
<p>
Click the create button to enter the new registrant's information.
</p>
</field>
Expand Down

0 comments on commit 23682f2

Please sign in to comment.