Odoo Help

3

0
1 Answer
4
Avatar

Muhammad Anees Saudi Arabia

--Muhammad Anees--

7439
| 7 3 9
Riyadh, Saudi Arabia
--Muhammad Anees--

Odoo, Dynamics AX and Web Developer.

Muhammad Anees Saudi Arabia
9/29/19, 4:29 AM

I done it the following way. Added new custom field by inheriting the hr.appraisal.

appraisal_quarter = fields.Char(string='Quarter', compute='_get_appraisal_quarter')
@api.multi
    def _get_appraisal_quarter(self):
    for appraisal in self:
        appraisal_date = appraisal.date_close
        month = appraisal_date.month
        year = appraisal_date.year
        if 0 <= int(month) <= 3:
            appraisal.appraisal_quarter = 'Q1 ' + str(year)
        elif 4 <= int(month) <= 6:
            appraisal.appraisal_quarter = 'Q2 ' + str(year)
        elif 7 <= int(month) <= 9:
            appraisal.appraisal_quarter = 'Q3 ' + str(year)
        elif 10 <= int(month) <= 12:
            appraisal.appraisal_quarter = 'Q4 ' + str(year)
        else:
            appraisal.appraisal_quarter = 'NA'
# list view
<field name="appraisal_quarter" />
result: Q3 2019

Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now