first push message
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class SurveyQuestionAnswer(models.Model):
|
||||
_inherit = 'survey.question.answer'
|
||||
|
||||
# Add a computed field for Khmer label
|
||||
khmer_label = fields.Char(string='Khmer Label', compute='_compute_khmer_label')
|
||||
|
||||
def _compute_khmer_label(self):
|
||||
# Khmer numerals mapping
|
||||
khmer_numerals = {
|
||||
'A': '១', 'B': '២', 'C': '៣', 'D': '៤',
|
||||
'E': '៥', 'F': '៦', 'G': '៧', 'H': '៨',
|
||||
'I': '៩', 'J': '១០'
|
||||
}
|
||||
|
||||
for answer in self:
|
||||
# Get the first character of the answer
|
||||
label = answer.answer_row or ''
|
||||
if label and label[0].upper() in khmer_numerals:
|
||||
answer.khmer_label = khmer_numerals[label[0].upper()]
|
||||
else:
|
||||
answer.khmer_label = label
|
||||
Reference in New Issue
Block a user