Skip to content

Commit

Permalink
history hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
NouranElshaer committed Jun 1, 2021
1 parent 1c37752 commit 7f0e256
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Binary file modified models/__pycache__/models.cpython-38.pyc
Binary file not shown.
20 changes: 15 additions & 5 deletions models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,21 @@ class HmsPatient(models.Model):
address = fields.Text()
age = fields.Integer()

# @api.onchange('pcr')
# @api.onchange('age')
# @api.constrains('age')
# @api.depends('age')
# def on_change(self):
# self.cr_ratio = self.value / 3
# # if self.is_opend:
# raise ValidationError('value 2 must be less than 200')

# for record in self:
# if record.age < 30:
# record.pcr = True
# # if self.is_opend:
# raise ValidationError('value 2 must be less than 200')
@api.onchange('age')
def on_change(self):
if self.age < 30:
self.pcr = True
# raise ValidationError('PCR is Ckecked')
else:
self.pcr = False


4 changes: 3 additions & 1 deletion views/views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
<field name="department_id"/>
<field name="age"/>
<field name="date_of_birth"/>
<field name="history"/>
<field name="history" attrs="{'invisible': [('age','&lt;',50)]}"/>
<!-- <field name="history" attrs="{'invisible':[('age','<','50')]}"/>-->
<field name="cr_ratio" attrs="{'required': [('pcr','!=', False)]}"/>
<field name="blood_type"/>
<field name="pcr"/>
<!-- <field name="pcr" attrs="{'default': [('age','&lt;',30)]}"/>-->
<field name="address"/>
</group>

Expand Down

0 comments on commit 7f0e256

Please sign in to comment.