تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
3007 أدوات العرض

I want to pass database field name in my method as search parameter. How can I do it? Like below:

def my_method(self, search_parameter):

          return self.partner_id.search_parameter


الصورة الرمزية
إهمال
أفضل إجابة

Here the question would arise from where you will call this method?

Do you want the search to be on the view?

For extra parameters it is always advisable to use context you can pass any parameter as a key in context and you can use context in all the methods of odoo.

So instead of a separate parameter you can pass it as a key in context.

Hope this would help.

الصورة الرمزية
إهمال
الكاتب

I want to pass search parameter from the method.

أفضل إجابة

Hello Ankit,

Try this

from openerp.http import request

then in your function:

print request.session.db


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
ديسمبر 16
3513
0
مارس 15
3690
0
يوليو 16
5896
4
ديسمبر 24
30841
0
يناير 23
1496