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
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
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.
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
1
Nov 15
|
4360 | ||
|
1
Mar 15
|
5460 | ||
|
2
Mar 15
|
6557 | ||
|
0
Mar 15
|
4125 | ||
|
0
Mar 15
|
4101 |