blob: 052800b7664e39b85ac403691366245a6407513c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
from odoo import models
import datetime
from pytz import timezone
import hashlib
class RestApi(models.TransientModel):
_name = 'rest.api'
def datetime_to_str(self, object, format):
time = ''
if isinstance(object, datetime.datetime):
time = object.astimezone(timezone('Asia/Jakarta')).strftime(format)
return time
def md5_salt(self, value, salt):
return hashlib.md5((salt + '$' + str(value)).encode()).hexdigest()
|