[IMP]:point_of_sale:Improves the pos_details report

bzr revid: azaz.201186@gmail.com-20101014125719-jsh654bm8dvtf97a
This commit is contained in:
saz-OpenERP
2010-10-14 18:27:19 +05:30
parent 8f309cad93
commit 66d99a2b42
2 changed files with 18 additions and 5 deletions
+16 -3
View File
@@ -76,7 +76,7 @@ class pos_details(report_sxw.rml_parse):
res2=[]
self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))" \
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt ,res_users as ru,res_company as rc " \
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state in('invoiced') " \
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('invoiced') " \
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
@@ -88,7 +88,7 @@ class pos_details(report_sxw.rml_parse):
res3=[]
self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))" \
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, res_users as ru,res_company as rc " \
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state in('paid','invoiced','done') " \
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('paid','invoiced','done') " \
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
@@ -96,6 +96,19 @@ class pos_details(report_sxw.rml_parse):
self.total_paid=res3[0]
return res3[0] or False
def _get_sum_dis_2(self,form,user):
res4=[]
self.cr.execute ("select sum(pol.price_ded * pol.qty)" \
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt ,res_users as ru,res_company as rc " \
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('paid') " \
"and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date >= %s and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date <= %s " \
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
res4=self.cr.fetchone()
self.total_invoiced=res4[0]
return res4[0] or False
def _get_sum_discount(self, objects):
#code for the sum of discount value
return reduce(lambda acc, object:
@@ -187,7 +200,7 @@ class pos_details(report_sxw.rml_parse):
'time': time,
'strip_name': self._strip_name,
'getpayments': self._get_payments,
'getsumdisc': self._get_sum_discount,
'getsumdisc': self._get_sum_dis_2,
'gettotalofthaday': self._total_of_the_day,
'gettaxamount': self._get_tax_amount,
'getperiod': self._get_period,
+2 -2
View File
@@ -247,7 +247,7 @@
<para style="terp_default_Centre_9">[[ formatLang(line_ids['discount']) ]]</para>
</td>
<td>
<para style="terp_default_9">[[ getinvoice(line_ids['invoice_id'],user) or removeParentNode('font') ]]</para>
<para style="terp_default_Centre_9">[[ getinvoice(line_ids['invoice_id'],user) or removeParentNode('font') ]]</para>
</td>
</tr>
</blockTable>
@@ -359,7 +359,7 @@
<para style="terp_default_Bold_9">Total discount</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getsumdisc(objects)) ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9_Bold">[[ formatLang(getsumdisc(data['form'],user)) ]] [[ company.currency_id.symbol ]]</para>
</td>
</tr>
<tr>