Skip to content

Instantly share code, notes, and snippets.

@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 / 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 ################################################
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 / AES_example.py
Created July 6, 2018 10:15 — forked from syedrakib/AES_example.py
an example of symmetric encryption in python using a single known secret key - utilizes AES from PyCrypto library
# Inspired from https://pythonprogramming.net/encryption-and-decryption-in-python-code-example-with-explanation/
# PyCrypto docs available at https://www.dlitz.net/software/pycrypto/api/2.6/
from Crypto.Cipher import AES
import base64, os
def generate_secret_key_for_AES_cipher():
# AES key length must be either 16, 24, or 32 bytes long
AES_key_length = 16 # use larger value in production
# generate a random secret key with the decided key length
@yk2kus
yk2kus / git_create_orphan.sh
Created March 27, 2018 16:49 — forked from seanbuscay/git_create_orphan.sh
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
Run this command to install MG-CLI:
sudo apt-get update && wget https://minergate.com/download/deb-cli -O minergate-cli.deb && sudo dpkg -i minergate-cli.deb
to start miner (4 cores for BCN) use this command:
minergate-cli -user <[email protected]> -bcn 4
Feel free to send some of your earnings to me:
BTC (Don't attempt to send other coins to this address!): 17f77AYHsQbdsB1Q6BbqPahJ8ZrjFLYH2j
#!/bin/bash
################################################################################
# Script for Reverse proxy in Odoo
# Author: Yogesh Kushwaha, 25-December-2015
#-------------------------------------------------------------------------------
#
# This script will install ODOO Server on
# clean Ubuntu 14.04 Server
#-------------------------------------------------------------------------------
# USAGE:
//Module 1:
function pos_payment_with_decimal(instance, module){ //module is instance.point_of_sale
var QWeb = instance.web.qweb;
var _t = instance.web._t;
module.PaymentScreenWidget = module.PaymentScreenWidget.extend({
events: function(){
return _.extend({},module.PaymentScreenWidget.prototype.events,{
"change .discount-card-select": "selectCard"
});
def download_attachments(self, cr, uid, ids, context = None):
cache_buster = randint(10000000000,90000000000)
config_obj = self.pool.get('ir.config_parameter')
attachment_obj = self.pool.get('ir.attachment')
filestore_path = os.path.join(attachment_obj._filestore(cr, uid), '')
print "filestore path..............",filestore_path
attachment_dir = filestore_path + 'attachments'
#create directory and remove its content
if not os.path.exists(attachment_dir):
@yk2kus
yk2kus / PosDB
Last active August 29, 2015 14:21
var PosDBSuper = module.PosDB
module.PosDB = module.PosDB.extend({
_partner_search_string: function(partner){
PosDBSuper.__super__._partner_search_string.call(this, partner);
},
})