Odoo Help

0

How to save a model.new record

By
Jorge Barcelo Cortes
on 4/19/16, 4:30 AM 381 views

Hi. Im trying to make a sale.order virtually. In my code i have:

record = self.env['model'].new(data)

record.change_product()

record.compute_totals()

record.save()


Now, that last line is raising an exception. Can someone help?

0
Jorge Barcelo Cortes
On 4/19/16, 9:16 AM

I cant use the create method, some of the required data are set by the onchange methods

0
Motez
On 4/19/16, 7:15 AM

If you want to create a new record you should use the\ create method.

Then your code shoud look like :

record = self.env['model'].create(data)
record.change_product()
record.compute_totals()

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 4/19/16, 4:30 AM
Seen: 381 times
Last updated: 4/19/16, 9:16 AM