Odoo Help

0
2 Answers
1
Premananth
9/4/16, 5:27 AM

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

0
Avatar
--deep--

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

deep
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

@api.one
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.

@api.multi
def _get_sale_order_line(self, vals)

 accordingly in source obj:

res = self._get_sale_order_line(vals=values)

Note:

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
Writer
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.

Register
Odoo Training Center

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

Test it now