Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connector_ambugest/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Ambugest-Odoo connector",
"version": "14.0.1.0.1",
"version": "14.0.1.0.2",
"author": "NuoBiT Solutions, S.L., Eric Antones",
"license": "AGPL-3",
"category": "Connector",
Expand Down
26 changes: 15 additions & 11 deletions connector_ambugest/models/ambugest_backend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,18 @@ def _scheduler_import_services(self):
domain = [("company_id", "=", company_id.id)]
self.search(domain).import_services_since()

def tz_to_utc(self, dt):
t = pytz.timezone(self.tz).localize(dt)
t = t.astimezone(pytz.utc)
t = t.replace(tzinfo=None)
return t

def tz_to_local(self, dt):
local_tz = pytz.timezone(self.tz)
datetime_utc = pytz.utc.localize(dt)
datetime_local = datetime_utc.astimezone(local_tz)
return datetime_local
@staticmethod
def _convert_tz(dt_naive, from_tz, to_tz):
dt = pytz.timezone(from_tz).localize(dt_naive)
dt = dt.astimezone(pytz.timezone(to_tz))
return dt.replace(tzinfo=None)

def tz_to_utc(self, datetime_local_naive):
return self._convert_tz(datetime_local_naive, self.tz, "UTC")

def utc_to_local(self, datetime_utc_naive):
return self._convert_tz(datetime_utc_naive, "UTC", self.tz)

# Deprecated: use utc_to_local instead
def tz_to_local(self, datetime_utc_naive):
return self.utc_to_local(datetime_utc_naive)
2 changes: 1 addition & 1 deletion connector_ambugest/models/sale_order/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def run_order_data(self, binding, clear=False):
order_number, order_date = None, None
if not clear:
order_number = binding.name
order_date = binding.date_order
order_date = self.backend_record.utc_to_local(binding.date_order)

values = {
"Odoo_Numero_Albaran": order_number,
Expand Down
Loading