Odoo Help

2 Answers
9/4/16, 5:27 AM

res = line.sudo()._get_sale_order_line(vals=values)


Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

10/26/16, 2:25 AM

I believe, for loop is not need,

But if you insist upon have it, no issues, However the called function api decorator should match it.

If you want to call the method _get_sale_order_line, for each and every record,  ensure you have added decorator as api.one, that way you can make a call individually for each record in the For Loop

def _get_sale_order_line(self, vals)

in source obj

for line in self:
    res = line._get_sale_order_line(vals=values)

Else keep it has api.multi, and make a call without the help of For Loop.

def _get_sale_order_line(self, vals)

 accordingly in source obj:

res = self._get_sale_order_line(vals=values)


you are performing your action in the ORM Write method, of type multi, however be aware, not always self._ids will be array/multiple, chances are there it can be singleton record/id. Hence Ensure before proceeding with you action.

Ask a Question
Keep Informed
1 follower(s)
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.

Odoo Training Center

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

Test it now