This question has been flagged

Hello.
I have a module for OpenERP itself must travel a table that has many rows.
The first time the module is invoked, it takes a lot, and that makes the total length of the entire table and depending on certain securities are securities acumiulan Python local variables which are then displayed in OpenERP:

SAMPLE CODE:

        for fact in exp.facturas_line:
            if fact.afecta == 'goods':
                tot_merc = tot_merc + fact.emitido
                tot_merc = tot_merc - fact.recibido
                tot_merc_fe = tot_merc_fe + fact.emitido
                tot_merc_fr = tot_merc_fr + fact.recibido
                tot_fact_emi = tot_fact_emi + fact.emitido
                tot_fact_reci = tot_fact_reci + fact.recibido
            if fact.afecta == 'vessels':
                tot_buq = tot_buq + fact.emitido
                tot_buq = tot_buq - fact.recibido
                tot_buq_fe = tot_buq_fe + fact.emitido
                tot_buq_fr = tot_buq_fr + fact.recibido
                tot_fact_emi = tot_fact_emi + fact.emitido
                tot_fact_reci = tot_fact_reci + fact.recibido
            if fact.afecta == 'no':
                tot_no = tot_no + fact.emitido
                tot_no = tot_no - fact.recibido
                tot_no_fe = tot_no_fe + fact.emitido
                tot_no_fr = tot_no_fr + fact.recibido
                tot_fact_emi = tot_fact_emi + fact.emitido
                tot_fact_reci = tot_fact_reci + fact.recibido
        tot_merc_f = tot_merc
        tot_buq_f = tot_buq



Then make another run in another table that has too many records.

My experience in other ERP, is that this can be created in a stored procedure in database and then this is invoked from the application to display these data in either mode or leave the settings variables in a temporary table and then collect them to viewing.

From OpenERP there any way to make a call to a function or stored procedure in PostgreSQL database easily and that does not conflict and that this information can be treated from OpenERP?

Avatar
Discard