Beispiel #1
0
 def test_calendar_timezone(self):
     # user in timezone UTC-9 asks for work hours
     #  Limits: between 2013-02-19 10:00:00 and 2013-02-26 15:30:00 (User TZ)
     #          between 2013-02-19 19:00:00 and 2013-02-27 00:30:00 (UTC)
     # Leaves:  between 2013-02-21 10:00:00 and 2013-02-26 12:00:00 (User TZ)
     # res: 19/02 (10-16 (beginning)) + 22/02 (0 (leave)) + 26/02 (12-15.30 (leave+ending))
     self.env.user.tz = 'US/Alaska'
     (self.leave1 | self.leave2 | self.leave3).unlink()
     leave = self.env['resource.calendar.leaves'].create({
         'name':
         'Timezoned Leaves',
         'calendar_id':
         self.calendar.id,
         'resource_id':
         self.resource1_id,
         'date_from':
         to_naive_utc(Datetime.from_string('2013-02-21 10:00:00'),
                      self.env.user),
         'date_to':
         to_naive_utc(Datetime.from_string('2013-02-26 12:00:00'),
                      self.env.user)
     })
     res = self.calendar.get_work_hours_count(
         to_naive_utc(Datetime.from_string('2013-02-19 10:00:00'),
                      self.env.user),
         to_naive_utc(Datetime.from_string('2013-02-26 15:30:00'),
                      self.env.user),
         self.resource1_id,
         compute_leaves=True)
     self.assertEqual(res, 9.5)
Beispiel #2
0
 def test_calendar_working_hours_of_date(self):
     # Test: day1, beginning at 10:30 -> work from 10:30 (arrival) until 16:00
     wh = self.calendar.get_work_hours_count(
         Datetime.from_string('2013-02-19 10:30:00'),
         Datetime.from_string('2013-02-19 18:00:00'),
         self.resource1_id,
         compute_leaves=False)
     self.assertEqual(wh, 5.5)
Beispiel #3
0
 def test_calendar_days_scheduling_timezone(self):
     self.env.user.tz = 'US/Alaska'
     res = self.calendar.plan_days(
         5,
         to_naive_utc(Datetime.from_string('2013-02-12 09:08:07'),
                      self.env.user))
     self.assertEqual(
         to_naive_user_tz(res, self.env.user).date(),
         Datetime.from_string('2013-02-26 00:00:00').date())
Beispiel #4
0
 def test_calendar_working_hours_leaves(self):
     # new API: resource and leaves
     # res: 2 weeks -> 40 hours - (3+4) leave hours
     res = self.calendar.get_work_hours_count(
         Datetime.from_string('2013-02-12 06:00:00'),
         Datetime.from_string('2013-02-22 23:00:00'),
         self.resource1_id,
         compute_leaves=True)
     self.assertEqual(res, 33.0)
Beispiel #5
0
 def test_calendar_working_hours(self):
     # new API: resource without leaves
     # res: 2 weeks -> 40 hours
     res = self.calendar.get_work_hours_count(
         Datetime.from_string('2013-02-12 06:00:00'),
         Datetime.from_string('2013-02-22 23:00:00'),
         self.resource1_id,
         compute_leaves=False)
     self.assertEqual(res, 40.0)
Beispiel #6
0
 def test_interval_and(self):
     self.assertEqual(
         self.env['resource.calendar']._interval_and(
             self.intervals[0], self.intervals[1]),
         self.calendar._interval_new(
             Datetime.from_string('2013-02-04 09:00:00'),
             Datetime.from_string('2013-02-04 11:00:00')))
     self.assertEqual(
         self.env['resource.calendar']._interval_and(
             self.intervals[2], self.intervals[3]), None)
Beispiel #7
0
 def test_interval_remove(self):
     working_interval = self.calendar._interval_new(
         Datetime.from_string('2013-02-04 08:00:00'),
         Datetime.from_string('2013-02-04 18:00:00'))
     result = self.env['resource.calendar']._interval_remove_leaves(
         working_interval, self.intervals)
     self.assertEqual(len(result), 1)
     # First interval: 04, 14-17
     self.assertEqual(result[0][:2],
                      (Datetime.from_string('2013-02-04 14:00:00'),
                       Datetime.from_string('2013-02-04 17:00:00')))
Beispiel #8
0
 def test_calendar_hours_scheduling_timezone(self):
     # user in timezone UTC-9 asks for work hours
     self.env.user.tz = 'US/Alaska'
     res = self.calendar.plan_hours(
         42,
         to_naive_utc(Datetime.from_string('2013-02-12 09:25:00'),
                      self.env.user))
     self.assertEqual(
         res,
         to_naive_utc(Datetime.from_string('2013-02-26 11:25:00'),
                      self.env.user))
Beispiel #9
0
    def test_calendar_working_day_intervals_limited_attendances(self):
        """ Test attendances limited in time. """
        attendance = self.env['resource.calendar.attendance'].search([
            ('name', '=', 'Att3')
        ])
        attendance.write({
            'date_from': self.date2 + relativedelta(days=7),
            'date_to': False,
        })
        intervals = self.calendar._get_day_work_intervals(
            self.date2.date(), start_time=self.date2.time())
        self.assertEqual(len(intervals), 1)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-15 10:11:12'),
                          Datetime.from_string('2013-02-15 13:00:00')))

        attendance.write({
            'date_from': False,
            'date_to': self.date2 - relativedelta(days=7),
        })
        intervals = self.calendar._get_day_work_intervals(
            self.date2.date(), start_time=self.date2.time())
        self.assertEqual(len(intervals), 1)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-15 10:11:12'),
                          Datetime.from_string('2013-02-15 13:00:00')))

        attendance.write({
            'date_from': self.date2 + relativedelta(days=7),
            'date_to': self.date2 - relativedelta(days=7),
        })
        intervals = self.calendar._get_day_work_intervals(
            self.date2.date(), start_time=self.date2.time())
        self.assertEqual(len(intervals), 1)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-15 10:11:12'),
                          Datetime.from_string('2013-02-15 13:00:00')))

        attendance.write({
            'date_from': self.date2,
            'date_to': self.date2,
        })
        intervals = self.calendar._get_day_work_intervals(
            self.date2.date(), start_time=self.date2.time())
        self.assertEqual(len(intervals), 2)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-15 10:11:12'),
                          Datetime.from_string('2013-02-15 13:00:00')))
        self.assertEqual(intervals[1][:2],
                         (Datetime.from_string('2013-02-15 16:00:00'),
                          Datetime.from_string('2013-02-15 23:00:00')))
Beispiel #10
0
 def test_interval_schedule_hours(self):
     cleaned_intervals = self.env['resource.calendar']._interval_merge(
         self.intervals)
     result = self.env['resource.calendar']._interval_schedule_hours(
         cleaned_intervals, 5.5)
     self.assertEqual(len(result), 2)
     # First interval: 03, 8-10 untouched
     self.assertEqual(result[0][:2],
                      (Datetime.from_string('2013-02-03 08:00:00'),
                       Datetime.from_string('2013-02-03 10:00:00')))
     # First interval: 04, 08-11:30
     self.assertEqual(result[1][:2],
                      (Datetime.from_string('2013-02-04 08:00:00'),
                       Datetime.from_string('2013-02-04 11:30:00')))
Beispiel #11
0
    def test_calendar_working_day_intervals_no_leaves(self):
        # Test: day0 without leaves: 1 interval
        intervals = self.calendar._get_day_work_intervals(
            Date.from_string('2013-02-12'), start_time=time(9, 8, 7))
        self.assertEqual(len(intervals), 1)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-12 09:08:07'),
                          Datetime.from_string('2013-02-12 16:00:00')))
        self.assertEqual(intervals[0][2]['attendances'], self.att_1)

        # Test: day1, beginning at 10:30 -> work from 10:30 (arrival) until 16:00
        intervals = self.calendar._get_day_work_intervals(
            Date.from_string('2013-02-19'), start_time=time(10, 30, 0))
        self.assertEqual(len(intervals), 1)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-19 10:30:00'),
                          Datetime.from_string('2013-02-19 16:00:00')))
        self.assertEqual(intervals[0][2]['attendances'], self.att_1)

        # Test: day3 without leaves: 2 interval
        intervals = self.calendar._get_day_work_intervals(
            Date.from_string('2013-02-15'), start_time=time(10, 11, 12))
        self.assertEqual(len(intervals), 2)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-15 10:11:12'),
                          Datetime.from_string('2013-02-15 13:00:00')))
        self.assertEqual(intervals[1][:2],
                         (Datetime.from_string('2013-02-15 16:00:00'),
                          Datetime.from_string('2013-02-15 23:00:00')))
        self.assertEqual(intervals[0][2]['attendances'], self.att_2)
        self.assertEqual(intervals[1][2]['attendances'], self.att_3)
Beispiel #12
0
 def _check_session_timing(self):
     self.ensure_one()
     date_today = datetime.utcnow()
     session_start = Datetime.from_string(self.start_at)
     if not date_today - timedelta(hours=24) <= session_start:
         raise UserError(
             _("This session has been opened another day. To comply with the French law, you should close sessions on a daily basis. Please close session %s and open a new one."
               ) % self.name)
     return True
Beispiel #13
0
 def test_calendar_working_hours_24(self):
     self.att_4 = self.env['resource.calendar.attendance'].create({
         'name':
         'Att4',
         'calendar_id':
         self.calendar.id,
         'dayofweek':
         '2',
         'hour_from':
         0,
         'hour_to':
         24
     })
     res = self.calendar.get_work_hours_count(
         Datetime.from_string('2018-06-19 23:00:00'),
         Datetime.from_string('2018-06-21 01:00:00'),
         self.resource1_id,
         compute_leaves=True)
     self.assertAlmostEqual(res, 24.0)
Beispiel #14
0
    def test_calendar_working_day_intervals_leaves_generic(self):
        # Test: day0 with leaves outside range: 1 interval
        intervals = self.calendar._get_day_work_intervals(
            Date.from_string('2013-02-12'),
            start_time=time(7, 0, 0),
            compute_leaves=True)
        self.assertEqual(len(intervals), 1)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-12 08:00:00'),
                          Datetime.from_string('2013-02-12 16:00:00')))

        # Test: day0 with leaves: 2 intervals because of leave between 9 and 12, ending at 15:45:30
        intervals = self.calendar._get_day_work_intervals(
            Date.from_string('2013-02-19'),
            start_time=time(8, 15, 0),
            end_time=time(15, 45, 30),
            compute_leaves=True)
        self.assertEqual(len(intervals), 2)
        self.assertEqual(intervals[0][:2],
                         (Datetime.from_string('2013-02-19 08:15:00'),
                          Datetime.from_string('2013-02-19 09:00:00')))
        self.assertEqual(intervals[1][:2],
                         (Datetime.from_string('2013-02-19 12:00:00'),
                          Datetime.from_string('2013-02-19 15:45:30')))
        self.assertEqual(intervals[0][2]['attendances'], self.att_1)
        self.assertEqual(intervals[0][2]['leaves'], self.leave1)
        self.assertEqual(intervals[1][2]['attendances'], self.att_1)
        self.assertEqual(intervals[0][2]['leaves'], self.leave1)
Beispiel #15
0
    def _get_car_atn(self, acquisition_date, car_value, fuel_type, co2):
        # Compute the correction coefficient from the age of the car
        now = Datetime.from_string(Datetime.now())
        start = Datetime.from_string(acquisition_date)
        if start:
            number_of_month = (
                now.year - start.year) * 12.0 + now.month - start.month + int(
                    bool(now.day - start.day + 1))
            if number_of_month <= 12:
                age_coefficient = 1.00
            elif number_of_month <= 24:
                age_coefficient = 0.94
            elif number_of_month <= 36:
                age_coefficient = 0.88
            elif number_of_month <= 48:
                age_coefficient = 0.82
            elif number_of_month <= 60:
                age_coefficient = 0.76
            else:
                age_coefficient = 0.70
            car_value = car_value * age_coefficient
            # Compute atn value from corrected car_value
            magic_coeff = 6.0 / 7.0  # Don't ask me why
            if fuel_type == 'electric':
                atn = 0.0
            else:
                if fuel_type in ['diesel', 'hybrid']:
                    reference = 87.0
                else:
                    reference = 105.0

                if co2 <= reference:
                    atn = car_value * max(0.04,
                                          (0.055 - 0.001 *
                                           (reference - co2))) * magic_coeff
                else:
                    atn = car_value * min(0.18,
                                          (0.055 + 0.001 *
                                           (co2 - reference))) * magic_coeff
            return max(1280, atn) / 12.0
Beispiel #16
0
def ctx_tz(record, field):
    res_lang = None
    ctx = record._context
    tz_name = pytz.timezone(ctx.get('tz') or record.env.user.tz)
    timestamp = Datetime.from_string(record[field])
    if ctx.get('lang'):
        res_lang = record.env['res.lang'].search([('code', '=', ctx['lang'])],
                                                 limit=1)
    if res_lang:
        timestamp = pytz.utc.localize(timestamp, is_dst=False)
        return datetime.strftime(
            timestamp.astimezone(tz_name),
            res_lang.date_format + ' ' + res_lang.time_format)
    return Datetime.context_timestamp(record, timestamp)
Beispiel #17
0
    def test_work_days_count(self):
        # user in timezone UTC-9 asks for work hours
        self.env.user.tz = 'US/Alaska'

        res = self.test.get_work_days_count(
            to_naive_utc(Datetime.from_string('2013-02-12 06:00:00'),
                         self.env.user),
            to_naive_utc(Datetime.from_string('2013-02-22 23:00:00'),
                         self.env.user))
        self.assertEqual(res, 3.75)  # generic leaves, 3 hours

        res = self.test.get_work_days_count(
            to_naive_utc(Datetime.from_string('2013-02-12 06:00:00'),
                         self.env.user),
            to_naive_utc(Datetime.from_string('2013-02-22 20:00:00'),
                         self.env.user))
        self.assertEqual(res, 3.5)  # last day is truncated of 3 hours on 12)

        self.env['resource.calendar.leaves'].create({
            'name':
            'Timezoned Leaves',
            'calendar_id':
            self.test.resource_calendar_id.id,
            'resource_id':
            self.test.resource_id.id,
            'date_from':
            to_naive_utc(Datetime.from_string('2013-02-13 10:00:00'),
                         self.env.user),
            'date_to':
            to_naive_utc(Datetime.from_string('2013-02-17 12:00:00'),
                         self.env.user)
        })

        res = self.test.get_work_days_count(
            to_naive_utc(Datetime.from_string('2013-02-12 06:00:00'),
                         self.env.user),
            to_naive_utc(Datetime.from_string('2013-02-22 20:00:00'),
                         self.env.user))
        self.assertEqual(
            res, 2.5
        )  # one day is on leave and last day is truncated of 3 hours on 12)
Beispiel #18
0
 def test_interval_merge(self):
     cleaned_intervals = self.env['resource.calendar']._interval_merge(
         self.intervals)
     self.assertEqual(len(cleaned_intervals), 3)
     # First interval: 03, unchanged
     self.assertEqual(cleaned_intervals[0][:2],
                      (Datetime.from_string('2013-02-03 08:00:00'),
                       Datetime.from_string('2013-02-03 10:00:00')))
     # Second interval: 04, 08-14, combining 08-12 and 11-14, 09-11 being inside 08-12
     self.assertEqual(cleaned_intervals[1][:2],
                      (Datetime.from_string('2013-02-04 08:00:00'),
                       Datetime.from_string('2013-02-04 14:00:00')))
     # Third interval: 04, 17-21, 18-19 being inside 17-21
     self.assertEqual(cleaned_intervals[2][:2],
                      (Datetime.from_string('2013-02-04 17:00:00'),
                       Datetime.from_string('2013-02-04 21:00:00')))
Beispiel #19
0
 def test_calendar_hours_scheduling_timezone_2(self):
     # Call schedule_hours for a user in Autralia, Sydney (GMT+10)
     # Two cases:
     # - start at 2013-02-15 08:00:00 => 2013-02-14 21:00:00 in UTC
     # - start at 2013-02-15 11:00:00 => 2013-02-15 00:00:00 in UTC
     self.env.user.tz = 'Australia/Sydney'
     self.env['resource.calendar.attendance'].create({
         'name':
         'Day3 - 1',
         'dayofweek':
         '3',
         'hour_from':
         8,
         'hour_to':
         12,
         'calendar_id':
         self.calendar.id,
     })
     self.env['resource.calendar.attendance'].create({
         'name':
         'Day3 - 2',
         'dayofweek':
         '3',
         'hour_from':
         13,
         'hour_to':
         17,
         'calendar_id':
         self.calendar.id,
     })
     hours = 1.0 / 60.0
     for test_date in ['2013-02-15 08:00:00', '2013-02-15 11:00:00']:
         start_dt = Datetime.from_string(test_date)
         start_dt_utc = to_naive_utc(start_dt, self.env.user)
         res = self.calendar._schedule_hours(hours, start_dt_utc)
         self.assertEqual(
             [(start_dt_utc, start_dt_utc.replace(minute=1))], res,
             'resource_calendar: wrong schedule_hours computation')
Beispiel #20
0
    def test_calendar_days_scheduling(self):
        res = self.calendar.plan_days(
            5, Datetime.from_string('2013-02-12 09:08:07'))
        self.assertEqual(res.date(),
                         Datetime.from_string('2013-02-26 00:00:00').date(),
                         'resource_calendar: wrong days scheduling')
        res = self.calendar.plan_days(
            -2, Datetime.from_string('2013-02-12 09:08:07'))
        self.assertEqual(res.date(),
                         Datetime.from_string('2013-02-08 00:00:00').date(),
                         'resource_calendar: wrong days scheduling')

        res = self.calendar.plan_days(
            5,
            Datetime.from_string('2013-02-12 09:08:07'),
            compute_leaves=True,
            resource_id=self.resource1_id)
        self.assertEqual(res.date(),
                         Datetime.from_string('2013-03-01 00:00:00').date(),
                         'resource_calendar: wrong days scheduling')
Beispiel #21
0
    def test_work_days_count_timezones_ultra(self):
        # user in timezone UTC+4 is attached to the resource and create leaves
        self.test.resource_id.write({
            'user_id': self.lost_user.id,
        })
        reunion_leave = self.env['resource.calendar.leaves'].sudo(
            self.lost_user).create({
                'name':
                'Timezoned Leaves',
                'calendar_id':
                self.test.resource_calendar_id.id,
                'resource_id':
                self.test.resource_id.id,
                'date_from':
                to_naive_utc(Datetime.from_string('2013-02-12 10:00:00'),
                             self.lost_user),
                'date_to':
                to_naive_utc(Datetime.from_string('2013-02-12 12:00:00'),
                             self.lost_user)
            })
        self.assertEqual(reunion_leave.tz, 'Indian/Reunion')

        # user in timezone UTC-9 read and manipulate leaves
        self.env.user.tz = 'US/Alaska'
        res = self.test.get_work_days_data(
            to_naive_utc(Datetime.from_string('2013-02-12 06:00:00'),
                         self.env.user),
            to_naive_utc(Datetime.from_string('2013-02-12 20:00:00'),
                         self.env.user))
        self.assertEqual(res['days'], 0.75)
        self.assertEqual(res['hours'], 6.0)

        # user in timezone UTC+4 read and manipulate leaves
        res = self.test.sudo(self.lost_user).get_work_days_data(
            to_naive_utc(Datetime.from_string('2013-02-12 06:00:00'),
                         self.env.user),
            to_naive_utc(Datetime.from_string('2013-02-12 20:00:00'),
                         self.env.user))
        self.assertEqual(res['days'], 0.75)
        self.assertEqual(res['hours'], 6.0)
 def test_07(self):
     """After 182 days, exactly half of the budget line"""
     date = Datetime.to_string(Datetime.from_string('2014-07-02 00:00:00'))
     self.mock_datetime.now.return_value = date
     self.assertAlmostEqual(self.line.theoritical_amount, -182)
 def test_06(self):
     """After 50 days"""
     date = Datetime.to_string(Datetime.from_string('2014-02-20 00:00:00'))
     self.mock_datetime.now.return_value = date
     self.assertAlmostEqual(self.line.theoritical_amount, -50)
 def test_04(self):
     """After 48 hours"""
     date = Datetime.to_string(Datetime.from_string('2014-01-03 00:00:00'))
     self.mock_datetime.now.return_value = date
     self.assertAlmostEqual(self.line.theoritical_amount, -2)
 def test_01(self):
     """Start"""
     date = Datetime.to_string(Datetime.from_string('2014-01-01 00:00:00'))
     self.mock_datetime.now.return_value = date
     self.assertAlmostEqual(self.line.theoritical_amount, 0)
 def test_10(self):
     """At last"""
     date = Datetime.to_string(Datetime.from_string('2014-12-31 00:00:00'))
     self.mock_datetime.now.return_value = date
     self.assertAlmostEqual(self.line.theoritical_amount, -364)
 def test_09(self):
     """One day before"""
     date = Datetime.to_string(Datetime.from_string('2014-12-30 00:00:00'))
     self.mock_datetime.now.return_value = date
     self.assertAlmostEqual(self.line.theoritical_amount, -363)
 def test_08(self):
     """After 308 days at noon"""
     date = Datetime.to_string(
         Datetime.from_string('2014-11-05 12:00:00'))  # remember, remember
     self.mock_datetime.now.return_value = date
     self.assertAlmostEqual(self.line.theoritical_amount, -308.5)
Beispiel #29
0
    def setUp(self):
        super(TestResourceCommon, self).setUp()
        self.env.user.tz = 'UTC'

        # Some demo data
        self.date1 = Datetime.from_string('2013-02-12 09:08:07')  # weekday() returns 1, isoweekday() returns 2
        self.date2 = Datetime.from_string('2013-02-15 10:11:12')  # weekday() returns 4, isoweekday() returns 5

        # Resource data
        # Calendar working days: 1 (8-16 -> 8hours), 4 (8-13, 16-23 -> 12hours)
        self.calendar = self.env['resource.calendar'].create({
            'name': 'TestCalendar',
            'attendance_ids': [(5, 0, 0)]
        })
        self.att_1 = self.env['resource.calendar.attendance'].create({
            'name': 'Att1',
            'calendar_id': self.calendar.id,
            'dayofweek': '1',
            'hour_from': 8,
            'hour_to': 16
        })
        self.att_2 = self.env['resource.calendar.attendance'].create({
            'name': 'Att2',
            'calendar_id': self.calendar.id,
            'dayofweek': '4',
            'hour_from': 8,
            'hour_to': 13
        })
        self.att_3 = self.env['resource.calendar.attendance'].create({
            'name': 'Att3',
            'calendar_id': self.calendar.id,
            'dayofweek': '4',
            'hour_from': 16,
            'hour_to': 23
        })

        self.resource1_id = self.env['resource.resource'].create(
            {
                'name': 'TestResource1',
                'resource_type': 'user',
                'time_efficiency': 150.0,
                'calendar_id': self.calendar.id,
            }
        ).id

        # Leave1: 19/02/2013, from 9 to 12, is a day 1
        self.leave1 = self.env['resource.calendar.leaves'].create({
            'name': 'GenericLeave',
            'calendar_id': self.calendar.id,
            'date_from': Datetime.from_string('2013-02-19 09:00:00'),
            'date_to': Datetime.from_string('2013-02-19 12:00:00')})
        # Leave2: 22/02/2013, from 9 to 15, is a day 4
        self.leave2 = self.env['resource.calendar.leaves'].create({
            'name': 'ResourceLeave',
            'calendar_id': self.calendar.id,
            'resource_id': self.resource1_id,
            'date_from': Datetime.from_string('2013-02-22 09:00:00'),
            'date_to': Datetime.from_string('2013-02-22 15:00:00')})
        # Leave3: 25/02/2013 (day0) -> 01/03/2013 (day4)
        self.leave3 = self.env['resource.calendar.leaves'].create({
            'name': 'ResourceLeave2',
            'calendar_id': self.calendar.id,
            'resource_id': self.resource1_id,
            'date_from': Datetime.from_string('2013-02-25 13:00:00'),
            'date_to': Datetime.from_string('2013-03-01 11:30:00')})
Beispiel #30
0
 def _get_acquisition_date(self):
     self.ensure_one()
     return babel.dates.format_date(
         date=Datetime.from_string(self.acquisition_date),
         format='MMMM y',
         locale=self._context.get('lang') or 'en_US')