Skip to content

Instantly share code, notes, and snippets.

View jeanabreu's full-sized avatar

Jean Abreu jeanabreu

View GitHub Profile
@jeanabreu
jeanabreu / generate_account_move_from_stock_valoration_layer.py
Created March 9, 2025 18:21
Generar los asientos contables desde un stock.valuation.layer, tomando en cuenta las cuentas el stock.move de cada producto y las cuentas analiticas
## Obtener los registros seleccionados a través de active_ids
records = env['stock.valuation.layer'].browse(env.context.get('active_ids', []))
for svl in records:
# Verificar si ya existe un asiento contable relacionado con la capa de valoración
if svl.account_move_id:
continue # Si ya tiene un asiento contable, no hacemos nada
# Concatenar la referencia con el nombre del producto
search_reference = svl.reference + ' - ' + svl.product_id.name
@jeanabreu
jeanabreu / generate_account_move_from_stock_picking.py
Created March 9, 2025 18:18
Generar los asientos contables desde un stock.picking, tomando en cuenta las cuentas de la categoria de producto y las cuentas analiticas
def action_generate_accounting_entries(self):
for picking in self:
if picking.state == 'done': # Solo transferencias completadas
for move in picking.move_ids:
if move.product_id.valuation == 'real_time': # Solo productos con valoración automática
# Buscar o crear stock valuation layer
svl = self.env['stock.valuation.layer'].search([('stock_move_id', '=', move.id)], limit=1)
if not svl:
svl = self.env['stock.valuation.layer'].create({
'stock_move_id': move.id,
@jeanabreu
jeanabreu / odoo_calculate_workers.sh
Created January 31, 2025 20:21 — forked from Garibaldy/odoo_calculate_workers.sh
Workers by @TraderCocoCR GRATIS
#!/bin/bash
# Copyright 2023 TensorAnalytics
# Telegram @TraderCocoCR
# AVISO IMPORTANTE!!! (WARNING!!!)
# ASEGURESE DE TENER UN SERVIDOR / VPS CON AL MENOS > 2GB DE RAM > 2VCPU MINIMO DE MULTI PROCESOS
# Ubuntu 18.04, 19, 20.04 LTS tested, Debian 10
# v1.0
# Last updated:28-5-2023
# CONST 1GB
Codigo de ejemplo
for(cont=0;cont<13;cont++){
mi=(monto*tasa);
capital+=mi;
mit=0;
mit=(mi/12);
mit+=monto;
cont++;
printf("%f\n \n",mi);
printf("%f\n \n",mit);}
}