Skip to content

Instantly share code, notes, and snippets.

odoo.define('tko_compose_mail.compose_mail', function (require) {
"use strict";
var core = require('web.core');
var session = require('web.session');
var Widget = require('web.Widget');
var SystrayMenu = require('web.SystrayMenu');
var rpc = require('web.rpc');
var _t = core._t;
@yk2kus
yk2kus / dbs_dump.sh
Last active December 10, 2018 10:26
DBs Backups
#!/bin/bash
versions="80 90 100 110"
for version in $versions;do
echo "Creating ~ /mnt/manager1/BACKUPS/odoo$version ...."
mkdir -p ~ /mnt/manager1/BACKUPS/odoo$version
done
############################ V8 ################################################
@yk2kus
yk2kus / recompute.py
Last active February 6, 2019 20:15
re compute computed field
session.open(db="saturnprogress.com")
user = session.env['res.users'].browse(1)
model = session.env['account.invoice']
session.env.add_todo(model._fields['vendor_display_name'], session.env['account.invoice'].search([]))
model.recompute()
session.env.cr.commit()
session.close()
@yk2kus
yk2kus / python-printJS-in-pdf.py
Created February 13, 2019 16:11 — forked from rms1000watt/python-printJS-in-pdf.py
Python script to add JS to pdf so the pdf will print immediately when opened
# IE users need: https://get.adobe.com/reader/
from PyPDF2 import PdfFileWriter, PdfFileReader
output = PdfFileWriter()
ipdf = PdfFileReader(open('old.pdf', 'rb'))
for i in xrange(ipdf.getNumPages()):
page = ipdf.getPage(i)
output.addPage(page)
@yk2kus
yk2kus / embedded-file-viewer.md
Created February 16, 2019 09:37 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@yk2kus
yk2kus / postgres-import-export-csv.md
Created February 19, 2019 11:00 — forked from nepsilon/postgres-import-export-csv.md
Importing and Exporting CSV files with PostgreSQL — First published in fullweb.io issue #19

Importing and exporting CSV files with PostgreSQL

Let’s see how to use PostgreSQL to import and export CSV files painlessly with the COPY command.

Import CSV into table t_words:

COPY t_words FROM '/path/to/file.csv' DELIMITER ',' CSV;

You can tell quote char with QUOTE and change delimiter with DELIMITER.

@yk2kus
yk2kus / .pypirc
Last active March 1, 2019 12:19
~/..pypirc
[distutils]
index-servers =
pypi
[pypi]
repository: https://upload.pypi.org/legacy/
username: yk2kus
password: *********
""" Reserve stock moves by creating their stock move lines. A stock move is
considered reserved once the sum of `product_qty` for all its move lines is
equal to its `product_qty`. If it is less, the stock move is considered
partially available.
@yk2kus
yk2kus / docker-image-push.txt
Created June 23, 2019 22:11
How to push docker image
Create a repo on https://hub.docker.com
Build an image with docker build . -t username/repo_name:tagName
eg: docker build . -t yk2kus/odoo:odoo120
Push the image
docker push yk2kus/odoo:odoo120
To discard local changes on a file, you can do
git checkout yourfile
or, for all files using
git checkout -- .
You can also decide, for each file, if you want to keep your version or the repository version with
git checkout --ours yourfile # Your version
git checkout --theirs yourfile # Repository version