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)))
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)))
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:
'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,