[FIX] various: adapt code to new datetime fields
Some code was still using the date and datetime fields as if they were strings, but they are now dates and datetimes
This commit is contained in:
@@ -18,8 +18,7 @@ def random_token():
|
||||
return ''.join(random.SystemRandom().choice(chars) for _ in range(20))
|
||||
|
||||
def now(**kwargs):
|
||||
dt = datetime.now() + timedelta(**kwargs)
|
||||
return fields.Datetime.to_string(dt)
|
||||
return datetime.now() + timedelta(**kwargs)
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
|
||||
@@ -88,7 +88,7 @@ class StockRule(models.Model):
|
||||
seller = product_id._select_seller(
|
||||
partner_id=partner,
|
||||
quantity=product_qty,
|
||||
date=fields.Date.to_string(schedule_date),
|
||||
date=schedule_date and schedule_date.date(),
|
||||
uom_id=product_uom)
|
||||
|
||||
return schedule_date - relativedelta(days=int(seller.delay))
|
||||
|
||||
@@ -220,7 +220,7 @@ class SaleOrderLine(models.Model):
|
||||
supplierinfo = self.product_id._select_seller(
|
||||
partner_id=purchase_order.partner_id,
|
||||
quantity=purchase_qty_uom,
|
||||
date=purchase_order.date_order, # and purchase_order.date_order[:10],
|
||||
date=purchase_order.date_order and purchase_order.date_order.date(), # and purchase_order.date_order[:10],
|
||||
uom_id=self.product_id.uom_po_id
|
||||
)
|
||||
fpos = purchase_order.fiscal_position_id
|
||||
|
||||
@@ -924,7 +924,7 @@ class Orderpoint(models.Model):
|
||||
# These days will be substracted when creating the PO
|
||||
days += self.product_id._select_seller(
|
||||
quantity=product_qty,
|
||||
date=fields.Date.to_string(start_date),
|
||||
date=start_date,
|
||||
uom_id=self.product_uom).delay or 0.0
|
||||
date_planned = start_date + relativedelta.relativedelta(days=days)
|
||||
return date_planned.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
|
||||
Reference in New Issue
Block a user