fixes in quotation item code get query
This commit is contained in:
parent
57fefaa3de
commit
59fa430be3
@ -293,22 +293,22 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query=
|
||||
(\
|
||||
select q.item_code,q.quote_rate from\
|
||||
(\
|
||||
select q.transaction_date,qd.item_code,basic_rate as quote_rate from `tabQuotation Item` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s'\
|
||||
select q.transaction_date,qd.item_code,qd.basic_rate as quote_rate from `tabQuotation Item` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s'\
|
||||
)q,\
|
||||
(\
|
||||
select qd.item_code,max(transaction_date) as transaction_date from `tabQuotation Item` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s' group by qd.item_code\
|
||||
select qd.item_code,max(q.transaction_date) as transaction_date from `tabQuotation Item` qd, `tabQuotation` q where q.name=qd.parent and q.docstatus=1 and customer='%(cust)s' group by qd.item_code\
|
||||
)m where q.item_code=m.item_code and q.transaction_date=m.transaction_date\
|
||||
)q on i.item_code=q.item_code\
|
||||
left join\
|
||||
(\
|
||||
select r.item_code,r.sales_rate from\
|
||||
(\
|
||||
select r.voucher_date,rd.item_code,basic_rate as sales_rate from `tabSales Invoice Item` rd, `tabSales Invoice` r where r.name=rd.parent and r.docstatus=1 and customer='%(cust)s'\
|
||||
select r.voucher_date,rd.item_code,rd.basic_rate as sales_rate from `tabSales Invoice Item` rd, `tabSales Invoice` r where r.name=rd.parent and r.docstatus=1 and r.customer='%(cust)s'\
|
||||
)r,\
|
||||
(\
|
||||
select rd.item_code,max(voucher_date) as voucher_date from `tabSales Invoice Item` rd, `tabSales Invoice` r where r.name=rd.parent and r.docstatus=1 and customer='%(cust)s' group by rd.item_code\
|
||||
select rd.item_code,max(r.voucher_date) as voucher_date from `tabSales Invoice Item` rd, `tabSales Invoice` r where r.name=rd.parent and r.docstatus=1 and r.customer='%(cust)s' group by rd.item_code\
|
||||
)m where r.item_code=m.item_code and r.voucher_date=m.voucher_date\
|
||||
)s on i.item_code=s.item_code ORDER BY item_code LIMIT 50",{cust:doc.customer, cond:cond});
|
||||
)s on i.item_code=s.item_code ORDER BY i.item_code LIMIT 50",{cust:doc.customer, cond:cond});
|
||||
else
|
||||
return repl("SELECT name, item_name, description FROM tabItem WHERE `tabItem`.%(key)s LIKE '%s' %(cond)s ORDER BY tabItem.item_code DESC LIMIT 50", {cond:cond});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user