Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4613 มุมมอง

It's possible to use more than one environnement in a controller class 's function??

for example if i  want to retrieve data from sale.order and sale.order.line, can i use these codes?

class controller(.....):

http.route(.....)

def function(self):

     sales = self.env['sale.order]

     #my operations

     sales_line = self.env['sale.order.line']

     #my operations


I am using odoo8

thanks

    

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

In python self in a method refers to the object of the class.

If you want to access any model in controllers use request.env['model.name']

อวตาร
ละทิ้ง