Skip to content

Instantly share code, notes, and snippets.

View macagua's full-sized avatar
🏠
Working from home

Leonardo J. Caballero G. macagua

🏠
Working from home
View GitHub Profile
@sehrishnaz
sehrishnaz / hide_export_option_from_more_menu_odoo.xml
Created October 13, 2021 09:43
Hide or Remove Export Option From More Menu Button in Odoo
<templates>
<t t-extend="Sidebar">
<t t-jquery="a.oe_sidebar_action_a" t-operation="replace">
<t t-if="widget.session.uid !== 1">
<a t-if="item.label !== 'Export'" class="oe_sidebar_action_a" t-att-title="item.title or ''" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank">
<t t-raw="item.label"/>
</a>
</t>
<t t-if="widget.session.uid === 1">
<a class="oe_sidebar_action_a" t-att-title="item.title or ''" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url" target="_blank">
@nzambello
nzambello / update-dvt.sh
Created August 30, 2021 14:31
Update DVT
#!/bin/bash
echo -n "Enter design-volto-theme version: "
read -r dvtVersion
npx purge-lockfile@latest volto && rm -rdf node_modules && yarn cache clean && yarn add "redturtle/design-volto-theme#v$dvtVersion" -W && yarn i18n && git commit -am "chore(upd8): update dvt v$dvtVersion" && rm -rdf node_modules && yarn install --frozen-lockfile
from PyPDF2 import PdfFileWriter, PdfFileReader
# https://stackoverflow.com/questions/490195/split-a-multi-page-pdf-file-into-multiple-pdf-files-with-python#490203
def pdf_split(fname, start, end=None):
print('pdf_split', fname, start, end)
# pdf_split ~/Downloads/4-27-files/Invoice Email-0.pdf 1 4
#inputpdf = PdfFileReader(open("document.pdf", "rb"))
inputpdf = PdfFileReader(open(fname, "rb"))
@michaelkarrer81
michaelkarrer81 / doodba_cheatsheet.md
Last active September 22, 2022 14:27
[doodba tools] doodba tools and commands #doodba #odoo #docker #invoke #pre-commit

Invoke

Invoke is a Python task execution tool & library. Following the lead of most Unix CLI applications, it offers a traditional flag-based style of command-line parsing, deriving flag names and value types from task signatures (optionally, of course!). Like many of its predecessors, it offers advanced features as well – namespacing, task aliasing, before/after hooks, parallel execution and more.

Get more information at pyinvoke.org

# List all tasks invoke can find in the current direktory (from tasks.py)
invoke --list
# Only show commands that would be executed by called task(s) (dry run)
apiVersion: v1
kind: ConfigMap
metadata:
name: odoo-conf
data:
web: |
[options]
server_wide_modules = web
max_cron_threads = 0
@sehrishnaz
sehrishnaz / odoo_web_controller.xml
Created November 19, 2020 08:19
Odoo Web Controller XML
<openerp>
<data>
<template id="graph_template">
<t t-call="website.layout">
<head>
<title>Graph Web Controller Example</title>
</head>
<body>
@fdns
fdns / version.py
Last active February 9, 2021 20:47
Version extraction for OpenedX
#!/usr/bin/env python3
# Run me with sudo ./version.py > result
import csv
import sys
import os
import re
class VersionAnalyzer:
def __init__(self):
self.out = csv.writer(sys.stdout)

Bundle para tests

    <template id="qunit_suite" inherit_id="web.qunit_suite">
        <xpath expr="//script[last()]" position="after">
            <script type="text/javascript" src="/academy/static/src/js/tools.js"></script>
            <script type="text/javascript" src="/academy/static/tests/academy_tests.js"></script>
            <script type="text/javascript" src="/academy/static/tests/academy_tests_field.js"></script>
        </xpath>
    </template>
@JVegaB
JVegaB / webinar2.md
Last active January 16, 2024 01:48

Pos order py

    @api.model
    def _order_fields(self, ui_order):
        res = super()._order_fields(ui_order)
        res['carrier_id'] = ui_order.get('carrier_id', False)
        return res

Models js