[FIX] Fix date_start test bug
parent
478ff1afba
commit
3a955cf949
|
@ -157,8 +157,9 @@ class SuperCalendarConfigurator(models.Model):
|
||||||
or 'UTC')
|
or 'UTC')
|
||||||
local_date_start = tz.localize(date_start)
|
local_date_start = tz.localize(date_start)
|
||||||
utc_date_start = local_date_start.astimezone(utc)
|
utc_date_start = local_date_start.astimezone(utc)
|
||||||
|
date_start = utc_date_start
|
||||||
date_start = datetime.strftime(
|
date_start = datetime.strftime(
|
||||||
utc_date_start,
|
date_start,
|
||||||
tools.DEFAULT_SERVER_DATETIME_FORMAT
|
tools.DEFAULT_SERVER_DATETIME_FORMAT
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ class TestSuperCalendar(TransactionCase):
|
||||||
('model', '=', 'res.partner')
|
('model', '=', 'res.partner')
|
||||||
])
|
])
|
||||||
self.date_start_field = self.ModelFieldsObj.search([
|
self.date_start_field = self.ModelFieldsObj.search([
|
||||||
('name', '=', 'create_date'),
|
('name', '=', 'write_date'),
|
||||||
('model', '=', 'res.partner'),
|
('model', '=', 'res.partner'),
|
||||||
])
|
])
|
||||||
self.description_field = self.ModelFieldsObj.search([
|
self.description_field = self.ModelFieldsObj.search([
|
||||||
|
@ -82,11 +82,10 @@ class TestSuperCalendar(TransactionCase):
|
||||||
"""
|
"""
|
||||||
Test if record values are correctly computed
|
Test if record values are correctly computed
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Test without any date_stop or duration
|
# Test without any date_stop or duration
|
||||||
values_partner_a = {
|
values_partner_a = {
|
||||||
'configurator_id': self.super_calendar_configurator.id,
|
'configurator_id': self.super_calendar_configurator.id,
|
||||||
'date_start': self.partner_A.create_date,
|
'date_start': self.partner_A.write_date,
|
||||||
'duration': False,
|
'duration': False,
|
||||||
'model_id': self.partner_model.id,
|
'model_id': self.partner_model.id,
|
||||||
'name': self.partner_A.name,
|
'name': self.partner_A.name,
|
||||||
|
@ -105,7 +104,7 @@ class TestSuperCalendar(TransactionCase):
|
||||||
('name', '=', 'date'),
|
('name', '=', 'date'),
|
||||||
('model', '=', 'res.partner'),
|
('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)
|
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||||
stop_date = datetime.strptime(self.partner_A.date,
|
stop_date = datetime.strptime(self.partner_A.date,
|
||||||
DEFAULT_SERVER_DATE_FORMAT)
|
DEFAULT_SERVER_DATE_FORMAT)
|
||||||
|
@ -156,5 +155,5 @@ class TestSuperCalendar(TransactionCase):
|
||||||
])
|
])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
super_calendar_record.date_start,
|
super_calendar_record.date_start,
|
||||||
self.partner_A.create_date
|
self.partner_A.write_date
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue