[FIX] point_of_sale: payment date take into account user tz
When you apply payment in POS, it takes current time for "date" field on bank statement line, but should use context_timestamp to take care of user timezone adjustments. Example: If user is in time zone GMT-6:00, then after 6:00pm all bank statement lines will be recorded with date of next day, and all closing reports and related accounting will be wrong! Fixes #2199 Closes #2200
This commit is contained in:
parent
dae0d407c0
commit
b02afebd1e
|
@ -862,9 +862,14 @@ class pos_order(osv.osv):
|
|||
statement_line_obj = self.pool.get('account.bank.statement.line')
|
||||
property_obj = self.pool.get('ir.property')
|
||||
order = self.browse(cr, uid, order_id, context=context)
|
||||
date = data.get('payment_date', time.strftime('%Y-%m-%d'))
|
||||
if len(date) > 10:
|
||||
timestamp = datetime.strptime(date, tools.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
ts = fields.datetime.context_timestamp(cr, uid, timestamp, context)
|
||||
date = ts.strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
|
||||
args = {
|
||||
'amount': data['amount'],
|
||||
'date': data.get('payment_date', time.strftime('%Y-%m-%d')),
|
||||
'date': date,
|
||||
'name': order.name + ': ' + (data.get('payment_name', '') or ''),
|
||||
'partner_id': order.partner_id and self.pool.get("res.partner")._find_accounting_partner(order.partner_id).id or False,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue