blob: 2c54769eff1409561ca3710b3a20947a35edcaca (
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()
|