Browse Source

Merge pull request #5 from savoirfairelinux/8.0_super_calendar_ehtaga

[FIX] Fix date_start test bug
pull/139/head
Alejandro Santana 10 years ago
parent
commit
2f1475836a
  1. 9
      super_calendar/models/super_calendar_configurator.py
  2. 9
      super_calendar/tests/test_super_calendar.py

9
super_calendar/models/super_calendar_configurator.py

@ -157,10 +157,11 @@ class SuperCalendarConfigurator(models.Model):
or 'UTC')
local_date_start = tz.localize(date_start)
utc_date_start = local_date_start.astimezone(utc)
date_start = datetime.strftime(
utc_date_start,
tools.DEFAULT_SERVER_DATETIME_FORMAT
)
date_start = utc_date_start
date_start = datetime.strftime(
date_start,
tools.DEFAULT_SERVER_DATETIME_FORMAT
)
super_calendar_values = {
'name': name,

9
super_calendar/tests/test_super_calendar.py

@ -61,7 +61,7 @@ class TestSuperCalendar(TransactionCase):
('model', '=', 'res.partner')
])
self.date_start_field = self.ModelFieldsObj.search([
('name', '=', 'create_date'),
('name', '=', 'write_date'),
('model', '=', 'res.partner'),
])
self.description_field = self.ModelFieldsObj.search([
@ -82,11 +82,10 @@ class TestSuperCalendar(TransactionCase):
"""
Test if record values are correctly computed
"""
# Test without any date_stop or duration
values_partner_a = {
'configurator_id': self.super_calendar_configurator.id,
'date_start': self.partner_A.create_date,
'date_start': self.partner_A.write_date,
'duration': False,
'model_id': self.partner_model.id,
'name': self.partner_A.name,
@ -105,7 +104,7 @@ class TestSuperCalendar(TransactionCase):
('name', '=', 'date'),
('model', '=', 'res.partner'),
])
start_date = datetime.strptime(self.partner_A.create_date,
start_date = datetime.strptime(self.partner_A.write_date,
DEFAULT_SERVER_DATETIME_FORMAT)
stop_date = datetime.strptime(self.partner_A.date,
DEFAULT_SERVER_DATE_FORMAT)
@ -156,5 +155,5 @@ class TestSuperCalendar(TransactionCase):
])
self.assertEqual(
super_calendar_record.date_start,
self.partner_A.create_date
self.partner_A.write_date
)
Loading…
Cancel
Save