Skip to content

Instantly share code, notes, and snippets.

@dreispt
dreispt / contact_child_security.xml
Last active October 14, 2020 19:25
contact_child_security.xml
<?xml version="1.0" encoding="utf-8"?>
<!--Create a new Extra Right group that can read, create, and edit the "Child" level (individual) contacts of "Parent" level (company) contacts, but only read the parent level contacts.-->
<odoo noupdate="1">
<record id="group_child_contact_creator" model="res.groups"><!--create record fo this new group-->
<field name="name">Child Contact Creation</field><!--name this group-->
<field name="category_id"
ref="base.module_category_usability"/><!--assign this group to Extra Rights Category-->
<field name="implied_ids"
eval="[(4, ref('base.group_user'))]"/><!--assign this group to base users-->
@dreispt
dreispt / res_partner.py
Last active September 8, 2020 16:27
Example extending name_get
from odoo import fields, models
class Partner(models.Model):
_inherit = "res.partner"
def name_get(self):
orig_res = super().name_get()
# orig_names = {rec_id: rec_name for rec_id, rec_name in orig_res}
orig_names = dict(orig_res) # even simpler
@dreispt
dreispt / odoo_technical_memento.rst
Last active June 16, 2018 13:56
Odoo Technical Memento

Model

Programming API

Views

@dreispt
dreispt / Dice Stats.py
Created January 13, 2018 15:00
Dice Stats created by dreispt - https://repl.it/@dreispt/Dice-Stats
import itertools
def freqs_calc(calc_func, dice):
combs = itertools.product(*tuple(dice))
res = dict()
for comb in combs:
#import pdb; pdb.set_trace()
x = calc_func(*comb)
res.setdefault(x, 0)
@dreispt
dreispt / oca_opinion.txt
Created January 9, 2017 22:50
In your opinion, what are the most satisfying aspects of the OCA?
sharing code and business experiences
Help make quality/reliable modules
Work with the best of the best
Open Source
the focus on quality; getting things done with people from all around the world
Quality, Involvement of "leading members", expertise, Pedro ;-)
The opensource and non-profitable origin is by far the most satisfying aspect.
Feedback on contributions
The quality of the code found.
Quality of addons and maintancr
@dreispt
dreispt / validators_pt.py
Created April 14, 2016 13:44 — forked from ftcmnc/validators_pt.py
Python: Validações de BI, NIF, NISS, NIB, IBAN, Cartão de Crédito, ISBN
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
"""Funções para validar números de bilhete de identidade,
contribuinte, identificação bancária, segurança social,
cartão de crédito e ISBN.
Segundo contribuição de _kk_, B.Baixo, Jorge Buescu,
Michael Gilleland (Merriam Park Software), Filipe Polido,
Jeremy Bradbury e Hugo Pires (DRI/DRO, IIESS).
Estas rotinas são do dominio público (sem copyright).
@dreispt
dreispt / account_analytic_multidimension.md
Last active February 12, 2017 09:37
Odoo Blueprint: Analytic Account Multi Dimension support

Multi Dimension Analytic Accounts

Odoo has native Analytic Accounting support through Anaytic Accounts. Documents, such as Sales Orders or Invoices, can have Analytic Accounts on them. These are carried to the GL Accounting moves, so that finantial data ends up with analytic informatin available for management analysis.

What are Analytic Accounts is a business decision, and depends on what needs to be measured. These can be Activities, Contracts, Projects, Cost Centers, etc.

@dreispt
dreispt / odoo-requests
Last active April 17, 2023 09:10
Munin plugins for Odoo
#!/bin/sh
#%# family=manual
#%# capabilities=autoconf suggest
# Munin plugin for transactions/minute
case $1 in
autoconf)
exit 0
;;
suggest)
@dreispt
dreispt / pipo.md
Created January 3, 2015 20:48
Pipo scratchpad

Use Odoo CLI commands. Work dir is the one for the current odoo.py.

@dreispt
dreispt / odoo-sh.py
Created November 19, 2014 11:04
Odoo Shell: run Odoo commands without a server RPC connection
"""
Setup:
Assuming Odoo 8.0 sources at ~/odoo:
$ cp odoo-sh.py ~/odoo
$ cd ~/odoo
$ python -i odoo-sh.py
Usage example:
>>> env = connect('my-db-name')
>>> Users = env['res.users']