Odoo Help

1

[SOLVED]Odoo V9. In fields.date, is it possible to display month and year only?

By
Giezel Esteves
on 11/8/16, 10:46 PM 435 views

Odoo V9. In fields.date, is it possible to display month and year only?

ex. 11-2016

1

Shameem iWesabe

--Shameem iWesabe--
758
| 5 3 5
Calicut, India
--Shameem iWesabe--

Email          :     pks.shameem@gmail.com

Activities     :    Youtube

                           Stackoverflow 

Experience

           iWesabe                                  ◉

           Axon Communications        ❍

           Cybrosys Technologies        ❍


Shameem iWesabe
On 11/9/16, 3:58 AM

Giezel,

See the alternative solution

Py

# Outside the model
def get_years():
    year_list = []
for i in range(2016, 2036):
        year_list.append((i, str(i)))
    return year_list


# Inside the model
month = fields.Selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'),
(5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'),
                          (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December'), ],
  string='Month',
year = fields.Selection(get_years(), string='Year',)

xml

<group> 
    <div>
        <label for="month" string="Month"
               style="font-weight: bold !important;margin-right:107px;margin-left: 0px;"/>
        <field name="month" style="width:110px"/>
        <field name="year" style="width:110px;margin-left: 34px;"/>
</div>
</group>

All the best !


0

deep

--deep--
1781
| 5 5 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 11/9/16, 1:50 AM

No it is not possible

But you can achieve the same using computational field of type Char, so in the method, parse the date and extract in whichever format you want.


 

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

Question tools

2 follower(s)

Stats

Asked: 11/8/16, 10:46 PM
Seen: 435 times
Last updated: 11/26/16, 3:47 AM