#####
My objective is to get a predefined remark base on the inputted Result value after checking Expected Result value.
For instance:
if Expected Result is 20-30 and if any value between 20 to 30 is inputted as result value then remark will be Normal,
else if result value <= expected result then remark will be Low, and if result value >= expected result then remark will be High.
Second Condition :
If Expected Result is Yellow and Inputted Result Value is Yellow then remark will be Good else Poor if any other color
Third Condition:
If Expected Result is >50 and Inputted Result Value is 51 and above the remark will be Okay else Not Okay
class ResultGrade(models.Model):
_name = 'result.grade'
_description = 'Result grading'
name = fields.Char(string='Title', size=128, required=True)
result = fields.Text(string='Result')
expected_result = fields.Text(string='Expected Result')
sequence = fields.Integer(string='Sequence')
remark = fields.Char(string='Remark')
_order="sequence"
@api.onchange('expected_result', 'result')
def onchange_result(self):
if self.expected_result:
col1,col2 = self.expected_result.split('-')
if self.result:
if self.result >= col1 and self.result <= col2:
self.remark = 'Normal'
elif self.result <= col1:
self.remark = 'Low'
elif self.result >= col2:
self.remark = 'High'
elif self.result == col1:
self.remark = 'Good'
elif self.result != col1:
self.remark = 'Poor'
elif self.result == col1:
self.remark = 'Good'
elif self.result != col2:
self.remark = 'Poor'
My challenge is to get remark for Second and Third condition. How can i make it work please.