#!/usr/bin/env python3
import odoo
import base64
import os

def update_logo():
    db_name = 'lims_demo'
    registry = odoo.registry(db_name)
    
    with registry.cursor() as cr:
        env = odoo.api.Environment(cr, odoo.SUPERUSER_ID, {})
        
        # Buscar la empresa principal
        company = env['res.company'].browse(1)
        
        # Leer el logo
        logo_path = '/mnt/extra-addons/lims_management/static/img/lab_logo.png'
        with open(logo_path, 'rb') as f:
            logo_base64 = base64.b64encode(f.read()).decode('utf-8')
        
        # Actualizar
        company.write({
            'logo': logo_base64,
            'name': 'Laboratorio Clínico LIMS'
        })
        
        cr.commit()
        print("Logo actualizado exitosamente")

if __name__ == '__main__':
    update_logo()