import time
import datetime
from report import report_sxw
#from tools import amount_to_text_en
import pooler
from tools import amount_to_text
#from tools.amount_to_text
import amount_to_text_infrom tools.translate import _
class lead_target(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(lead_target, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'get_name':self.get_name,
})
self.context = context
def get_name(self, form):
crm_obj=self.pool.get('crm.lead')
sale_obj=self.pool.get('hr.employee')
for order in crm_obj.browse(cr, uid, ids, context=context):
namev=val.name
print namev,"print value"
if form['target_selection']=='daily':
todaydate=datetime.date.today()
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
You can update the object's pool attribute to report's localcontext
just like this:
self.localcontext.update({ 'time': time, 'get_name':self.get_name, 'pool': self.pool, })
and then use the pool.get('res.users').xxxooo in your report.
class lead_target(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(lead_target, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'get_name':self.get_name,
'pool': self.pool,
})
self.context = context
def get_name(self, form):
crm_obj=pool.get('crm.lead')
sale_obj=self.pool.get('hr.employee')
for order in crm_obj.browse(cr, uid, id):
namev=val.name
print namev ----> global name 'pool' is not defined
Hi!
You can browse the record from other model like this,
def get_name(self, form):
crm_obj=self.pool.get('crm.lead')
sale_obj=self.pool.get('hr.employee')
crm_ids = crm_obj.search(self.cr, self.uid, [])
for order in crm_obj.browse(self.cr, self.uid, crm_ids):
namev=val.name
print namev,"print value"
if form['target_selection']=='daily':
todaydate=datetime.date.today()
In report.py file we are not importing osv module so we have to write self.cr, self.uid instead of just cr,uid
Hope now it will work properly.
Thanks.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 11 15
|
4157 | ||
|
1
thg 3 15
|
5089 | ||
|
2
thg 3 15
|
6280 | ||
|
0
thg 3 15
|
3852 | ||
|
0
thg 3 15
|
3864 |