mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[FIX] mrp_multi_level: Consider timezone of the warehouse to generate mrp inventory records.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# © 2016 Ucamco - Wim Audenaert <wim.audenaert@ucamco.com>
|
||||
# Copyright 2016-19 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# Copyright 2016-21 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# - Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
|
||||
# - Lois Rilo Antelo <lois.rilo@forgeflow.com>
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class MrpArea(models.Model):
|
||||
@@ -28,6 +28,15 @@ class MrpArea(models.Model):
|
||||
related="warehouse_id.calendar_id",
|
||||
)
|
||||
|
||||
@api.model
|
||||
def _datetime_to_date_tz(self, dt_to_convert=None):
|
||||
"""Coverts a datetime to date considering the timezone of MRP Area.
|
||||
If no datetime is provided, it returns today's date in the timezone."""
|
||||
return fields.Date.context_today(
|
||||
self.with_context(tz=self.calendar_id.tz),
|
||||
timestamp=dt_to_convert,
|
||||
)
|
||||
|
||||
def _get_locations(self):
|
||||
self.ensure_one()
|
||||
return self.env["stock.location"].search(
|
||||
|
||||
Reference in New Issue
Block a user