Skip to content

Instantly share code, notes, and snippets.

View bbn-bernard's full-sized avatar

Bernard bbn-bernard

View GitHub Profile
import math
import sys
import unittest
# input : N positive integer, ex. N = 10
# output : sequence as list, ex. 1 2 * 3 4 5 * 6 7 * 8 9 10 *
def fancy_pattern(N):
pattern = '11*111*' * int(math.ceil(N / 5.0))
result = []
n = 0
@bbn-bernard
bbn-bernard / gist:87a0f46af030e3d459e1
Created November 6, 2014 02:48
purchase_action_cancel
def get_return_history(self, cr, uid, pick_id, context=None):
"""
Get return_history.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param pick_id: Picking id
@param context: A standard dictionary
@return: A dictionary which of values.
"""
diff --git a/addons/report/models/report.py b/addons/report/models/report.py
index c2e1cd2..e37a721 100644
--- a/addons/report/models/report.py
+++ b/addons/report/models/report.py
@@ -46,8 +46,12 @@ from pyPdf import PdfFileWriter, PdfFileReader
_logger = logging.getLogger(__name__)
def _get_wkhtmltopdf_bin():
- defpath = os.environ.get('PATH', os.defpath).split(os.pathsep)
- return which('wkhtmltopdf', path=os.pathsep.join(defpath))
@bbn-bernard
bbn-bernard / gist:f273d40851035e18eb75
Created September 16, 2014 10:09
header_test.html
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
<script>
function subst() {
var vars={};
var x=document.location.search.substring(1).split(\'&\');
for(var i in x) {var z=x[i].split(\'=\',2);vars[z[0]] = unescape(z[1]);}
var x=[\'frompage\',\'topage\',\'page\',\'webpage\',\'section\',\'subsection\',\'subsubsection\'];
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
body, table, td, span, div {
font-family: verdana, calibri;
}