[FIX] point_of_sale: wrong date in pos payment

- Have a user in an early timezone (for example Samoa Standard Time);
- Open a POS session in the evening (say 20h).
- Buy something and pay with cash.
- Close the session.
- List the session orders, and open the newly create order.

Before this commit, the date of the order was correct (today at 20h),
but the date of the payment was wrong (yesterday at 13h). This error
occurs because a wrong format was used and the date was taken into
account two times the timezone.

Now, both dates are corrected.

This fix is a partial revert of 2157540768

opw-2231820

X-original-commit: 020e5547ad10583000748659de0e2b14ceabbf97
This commit is contained in:
Jorge Pinna Puissant
2020-05-11 09:32:35 +00:00
parent 9b27b4d923
commit 01c64f3907
2 changed files with 2 additions and 4 deletions
+1 -3
View File
@@ -53,11 +53,9 @@ class PosOrder(models.Model):
@api.model
def _payment_fields(self, order, ui_paymentline):
payment_date = ui_paymentline['name']
payment_date = fields.Date.context_today(self, fields.Datetime.from_string(payment_date))
return {
'amount': ui_paymentline['amount'] or 0.0,
'payment_date': payment_date,
'payment_date': ui_paymentline['name'],
'payment_method_id': ui_paymentline['payment_method_id'],
'card_type': ui_paymentline.get('card_type'),
'transaction_id': ui_paymentline.get('transaction_id'),
@@ -27,7 +27,7 @@
<field name="arch" type="xml">
<tree string="Payments" create="0" delete="0">
<field name="currency_id" invisible="1" />
<field name="payment_date" widget="date" />
<field name="payment_date"/>
<field name="payment_method_id" />
<field name="pos_order_id" />
<field name="amount" />