Thursday, 2 November 2017

Odoo , Python : To get month name list based on dates duration.

import calendar

# print calendar.month_name[9] # give your month number and it will show exact month name.


import datetime
import time
from datetime import date
from dateutil.rrule import rrule, MONTHLY
# give your date duration
date_from = '01/03/2016'
date_to = '30/04/2017'

date_from_date = date_from[:2]
date_from_month = date_from[3:5]
date_from_year = date_from[6:]

date_to_date = date_to[:2]
date_to_month = date_to[3:5]
date_to_year = date_to[6:]
#
date1 = date(int(date_from_year), int(date_from_month), int(date_from_date))
date2 = date(int(date_to_year), int(date_to_month), int(date_to_date))

months = [dt.strftime("%m") for dt in rrule(MONTHLY, dtstart=date1, until=date2)]
print months

for mo in [dt.strftime("%m") for dt in rrule(MONTHLY, dtstart=date1, until=date2)]:
    print calendar.month_name[int(mo)]

Wednesday, 30 August 2017

Odoo: Show Notification message(red color window) before wizard popup window and Show help view window on field in wizard popup.

Create a new css file in static-> css folder and add below code.

/* Show notification message at first level (above the existing popup window) - Nivas*/
/* Existing module file path: /web/static/src/less/notification.less */
.o_notification_manager {
    z-index: 5000 !important;  // above the modals. Fixme: expose a variable
}
/* Showing developer mode view in wizard option.  */
.tooltip {
z-index: 6000 !important;
}
/* End */