select rp.name, cl.name,cl.date_open,cl.state,
he.lead_target,
count(cl.user_id) as achieved,
round(((cast(count(cl.user_id) as decimal(2))/he.lead_target)*100)) as val
from crm_lead cl,
hr_employee he,
res_users rs,
res_partner rp
where cl.type='opportunity' and
rs.id=he.user_id and
he.user_id=cl.user_id and
rp.id=rs.partner_id and
create_date>='2013-04-28' and create_date<=now() + interval '15 days'
group by rp.name, he.lead_target,cl.name,cl.date_open,cl.state--->shows error
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ờ
1
Trả lời
7571
Lượt xem
Hi,
try :
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
cr.execute("""select rp.name, cl.name,cl.date_open,cl.state,
he.lead_target,
count(cl.user_id) as achieved,
round(((cast(count(cl.user_id) as decimal(2))/he.lead_target)*100)) as val
from crm_lead cl,
hr_employee he,
res_users rs,
res_partner rp
where cl.type='opportunity' and
rs.id=he.user_id and
he.user_id=cl.user_id and
rp.id=rs.partner_id and
create_date>='2013-04-28' and create_date<=%s
""", (str(datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') + relativedelta(days=15).strftime('%Y-%m-%d %H:%M:%S.%f')),))
Bye
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ý