From f3da958fa144ee1b112df166435a54c064a10812 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 18 Dec 2017 18:23:01 +0100 Subject: [PATCH] [FIX] product: price computation with dated pricelist rules and tz Take account of the user timezone to compute the price for pricelist rules with start / end date. Before this revision, the date used to compare to the dated pricelist rule is always the date of today in UTC. For instance: - If a user is in timezone UTC +12 - The 10% discount on the pricelist starts on December 19 - It's currently December 18 13:00 The user did not have the discount, because it was consdiered December 18, while the user was already in December 19. With this revision, we take account of the context and its timezone to compute the date of today and return the correct price according to the dated start and end datetime. opw-785203 --- addons/product/models/product_pricelist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/models/product_pricelist.py b/addons/product/models/product_pricelist.py index fd2bfdb9dec..d44c2ba0ebc 100644 --- a/addons/product/models/product_pricelist.py +++ b/addons/product/models/product_pricelist.py @@ -106,7 +106,7 @@ class Pricelist(models.Model): """ self.ensure_one() if not date: - date = self._context.get('date') or fields.Date.today() + date = self._context.get('date') or fields.Date.context_today(self) if not uom_id and self._context.get('uom'): uom_id = self._context['uom'] if uom_id: