Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Write to DB from within a Function?

By
Yakito
on 2/12/13, 2:23 AM 1,070 views

Hello,

First of all I must clarity than I am currently learning how to develop custom OpenERP modules so this questions might sound very basic, but reading the documentation I couldn't find any tip in the right direction.

Here is what I am trying to do:

I want to create a wizard which will ask the user to select the period for which it wants a report to be generated. Once he clicks on "generate" and before the PDF is created I need to perform some tasks like generate the sum of some numbers from other tables and save that result into another one. After that I will generate a PDF from the results of that table.

I couldn't find any example on how to save data into a table from within a function. Is this possible? Can I use an INSERT INTO SQL alike statement? Am I approaching my needs in the right way?

Any tip will be much appreciated! Thanks a lot!

1
allanjm
On 2/13/13, 2:05 AM

you can use SQL statement but better to use obj_model.create(cr, uid, val, context) where val is equal to a dictionary:

val = {'first_name':'allan', 'last_name':'manuel'}

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 2/12/13, 2:23 AM
Seen: 1070 times
Last updated: 3/16/15, 8:10 AM