Skip to content

Instantly share code, notes, and snippets.

@bitodoo
bitodoo / start.sh
Last active November 9, 2017 19:24
#!/bin/bash
# run this as the odoo* user!
# create dir logs
WDIR=/opt/odev10/log
# path virtualenv
VIRTUALENV_DIR=/opt/odev10/virt_odev10
source $VIRTUALENV_DIR/bin/activate
[Unit]
Description=Odoo 10 Open Source ERP and CRM (Test Env)
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
PermissionsStartOnly=true
SyslogIdentifier=odev10-server
User=odev10
from odoo.modules.module import get_module_resource
.
.
.
def pdf_file(self):
path_pdf = get_module_resource('module', 'files', 'file.pdf')
print(path_pdf)
# Out
# /home/user/addons/bo_btn_download_file/files/file.pdf
return open(path_pdf, 'rb').read()
from odoo.tools import misc
@api.model
def _get_default_faq(self):
with misc.file_open('website_forum/data/forum_default_faq.html', 'r') as f:
return f.read()
faq = fields.Html('Guidelines', default=_get_default_faq, translate=True)
import base64
from odoo import tools
@api.model
def _default_image(self):
image_path = get_module_resource('hr', 'static/src/img', 'default_image.png')
return tools.image_resize_image_big(base64.b64encode(open(image_path, 'rb').read()))
image = fields.Binary(
@bitodoo
bitodoo / install_posbox_in_pc.sh
Created December 13, 2019 21:54
Install Odoo posbox in pc
#!/bin/bash
# Run not as root
# ./install_posbox_in_pc.sh
# No LSB modules are available.
# Distributor ID: Ubuntu
# Description: Ubuntu 18.04.3 LTS
# Release: 18.04
# Codename: bionic
@bitodoo
bitodoo / install_posbox_in_pc_2.sh
Created September 4, 2021 01:58
Mode posbox in PC with ubuntu 18.01.5
#!/bin/bash
# Run not as root
# ./install_posbox_in_pc.sh
# No LSB modules are available.
# Distributor ID: Ubuntu
# Description: Ubuntu 18.04.5 LTS
# Release: 18.04
# Codename: bionic