Browse Source

pickup: actually use current time of record creation

if we use 'default=fields.Datetime.now' it will use the time of the
odoo server start/load,and not the time when the record is created.

Also, use the 'now' time for bot earliest and latest pickup time,
let the user modify it as needed.
master
Harald Welte 3 weeks ago
parent
commit
bfb5030701
  1. 4
      models/shipcloud_pickup.py

4
models/shipcloud_pickup.py

@ -20,10 +20,10 @@ class SCPickup(models.Model):
# address from where to pick up
address = fields.Many2one('res.partner', string='Pick-up address', required=True)
# earliest pick-up time
earliest = fields.Datetime('Earliest', required=True, default=fields.Datetime.now(),
earliest = fields.Datetime('Earliest', required=True, default=lambda self: fields.Datetime.now(),
readonly=True, states={'draft': [('readonly', False)]})
# latest pick-up time
latest = fields.Datetime('Latest', required=True,
latest = fields.Datetime('Latest', required=True, default=lambda self: fields.Datetime.now(),
readonly=True, states={'draft': [('readonly', False)]})
# draft: not yet requested from shipcloud; confirmed: confirmed by shipcloud
state = fields.Selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done','Done')],

Loading…
Cancel
Save