[FIX] stock: procurement generated by scheduler truncate datetime

When purchase order are created from a scheduler they always
have the same hours even if they were created at different
time. Also the procurement order that generate the purchase
order line have the same problem.

It happens because the transformation from datetime to string
use a date format and thus truncate the DEFAULT_SERVER_TIME_FORMAT

This commit use a datetime format instead the dateformat.

opw-775833
This commit is contained in:
amoyaux
2017-10-16 13:14:21 +02:00
parent fea667a243
commit 0aefcdbad7
+2 -2
View File
@@ -8,7 +8,7 @@ from dateutil import relativedelta
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
import logging
@@ -843,7 +843,7 @@ class Orderpoint(models.Model):
# These days will be substracted when creating the PO
days += self.product_id._select_seller().delay or 0.0
date_planned = start_date + relativedelta.relativedelta(days=days)
return date_planned.strftime(DEFAULT_SERVER_DATE_FORMAT)
return date_planned.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
@api.multi
def _prepare_procurement_values(self, product_qty, date=False, group=False):