[MERGE] merged the dev branch of Ujjvala with improvements on point_of_sale report
bzr revid: qdp-launchpad@openerp.com-20111229165823-ql0kc6jzay6kjzjx
This commit is contained in:
commit
0c1fcf9f4a
|
@ -24,7 +24,7 @@ from report import report_sxw
|
||||||
|
|
||||||
class pos_details(report_sxw.rml_parse):
|
class pos_details(report_sxw.rml_parse):
|
||||||
|
|
||||||
def _get_invoice(self,inv_id,user):
|
def _get_invoice(self,inv_id):
|
||||||
res={}
|
res={}
|
||||||
if inv_id:
|
if inv_id:
|
||||||
self.cr.execute("select number from account_invoice as ac where id = %s", (inv_id,))
|
self.cr.execute("select number from account_invoice as ac where id = %s", (inv_id,))
|
||||||
|
@ -33,79 +33,63 @@ class pos_details(report_sxw.rml_parse):
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def _pos_sales_details(self,form,user):
|
def _get_all_users(self):
|
||||||
data={}
|
user_obj = self.pool.get('res.users')
|
||||||
self.cr.execute ("select po.name as pos_name,po.date_order,pt.name, pp.default_code as code,pol.qty,pu.name as uom,pol.price_unit,pol.discount,po.invoice_id,sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \
|
return user_obj.search(self.cr, self.uid, [])
|
||||||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu,res_users as ru,res_company as rc " \
|
|
||||||
"where pt.id=pp.product_tmpl_id and pu.id=pt.uom_id and pp.id=pol.product_id and po.id = pol.order_id and po.state IN ('done','paid','invoiced') " \
|
def _pos_sales_details(self,form):
|
||||||
"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 " \
|
pos_obj = self.pool.get('pos.order')
|
||||||
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
|
user_obj = self.pool.get('res.users')
|
||||||
"group by po.name,pol.qty,po.date_order,pt.name,pp.default_code,pu.name,pol.price_unit,pol.discount,po.invoice_id " \
|
data = []
|
||||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
result = {}
|
||||||
data=self.cr.dictfetchall()
|
user_ids = form['user_ids'] or self._get_all_users()
|
||||||
|
company_id = user_obj.browse(self.cr, self.uid, self.uid).company_id.id
|
||||||
|
pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('user_id','in',user_ids),('state','in',['done','paid','invoiced']),('company_id','=',company_id)])
|
||||||
|
for pos in pos_obj.browse(self.cr, self.uid, pos_ids):
|
||||||
|
for pol in pos.lines:
|
||||||
|
result = {
|
||||||
|
'code': pol.product_id.default_code,
|
||||||
|
'name': pol.product_id.name,
|
||||||
|
'invoice_id': pos.invoice_id.id,
|
||||||
|
'price_unit': pol.price_unit,
|
||||||
|
'qty': pol.qty,
|
||||||
|
'discount': pol.discount,
|
||||||
|
'total': (pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)),
|
||||||
|
'date_order': pos.date_order,
|
||||||
|
'pos_name': pos.name,
|
||||||
|
'uom': pol.product_id.uom_id.name
|
||||||
|
}
|
||||||
|
data.append(result)
|
||||||
|
self.total += result['total']
|
||||||
|
self.qty += result['qty']
|
||||||
|
self.discount += result['discount']
|
||||||
if data:
|
if data:
|
||||||
for d in data:
|
return data
|
||||||
self.total += d['total']
|
|
||||||
self.qty += d['qty']
|
|
||||||
return data
|
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def _get_qty_total_2(self, form,user):
|
def _get_qty_total_2(self):
|
||||||
qty=[]
|
return self.qty
|
||||||
self.cr.execute("select sum(pol.qty) as 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 ('done','paid','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)))
|
|
||||||
qty = self.cr.fetchone()
|
|
||||||
return qty[0] or 0.00
|
|
||||||
|
|
||||||
def _get_sales_total_2(self, form,user):
|
def _get_sales_total_2(self):
|
||||||
self.cr.execute("select sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \
|
return self.total
|
||||||
"from pos_order_line as pol, pos_order po, product_product as pp,product_template as pt " \
|
|
||||||
" where po.company_id='%s' and po.id=pol.order_id 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.state IN ('paid','invoiced','done') " \
|
|
||||||
" and pt.id=pp.product_tmpl_id and pol.product_id=pp.id"% (str(user.company_id.id),form['date_start'],form['date_end']))
|
|
||||||
res2=self.cr.fetchone()
|
|
||||||
return res2 and res2[0] or 0.0
|
|
||||||
|
|
||||||
def _get_sum_invoice_2(self,form,user):
|
def _get_sum_invoice_2(self,form):
|
||||||
res2=[]
|
pos_obj = self.pool.get('pos.order')
|
||||||
self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))" \
|
user_obj = self.pool.get('res.users')
|
||||||
"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,account_invoice as ai " \
|
user_ids = form['user_ids'] or self._get_all_users()
|
||||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and ai.id=po.invoice_id " \
|
company_id = user_obj.browse(self.cr, self.uid, self.uid).company_id.id
|
||||||
"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 " \
|
pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('user_id','in',user_ids),('company_id','=',company_id),('invoice_id','<>',False)])
|
||||||
"and po.user_id = ru.id and rc.id = %s and ru.id = %s " \
|
for pos in pos_obj.browse(self.cr, self.uid, pos_ids):
|
||||||
,(form['date_start'],form['date_end'],str(user.company_id.id),str(self.uid)))
|
for pol in pos.lines:
|
||||||
res2=self.cr.fetchone()
|
self.total_invoiced += (pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))
|
||||||
self.total_invoiced=res2[0]
|
return self.total_invoiced or False
|
||||||
return res2[0] or False
|
|
||||||
|
|
||||||
def _paid_total_2(self,form,user):
|
def _paid_total_2(self):
|
||||||
res3=[]
|
return self.total or 0.0
|
||||||
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') " \
|
|
||||||
"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.fetchone()
|
|
||||||
self.total_paid=res3[0]
|
|
||||||
return res3[0] or False
|
|
||||||
|
|
||||||
def _get_sum_dis_2(self,form,user):
|
def _get_sum_dis_2(self):
|
||||||
res4=[]
|
return self.discount or 0.0
|
||||||
self.cr.execute ("select sum(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):
|
def _get_sum_discount(self, objects):
|
||||||
#code for the sum of discount value
|
#code for the sum of discount value
|
||||||
|
@ -118,10 +102,11 @@ class pos_details(report_sxw.rml_parse):
|
||||||
objects,
|
objects,
|
||||||
0.0)
|
0.0)
|
||||||
|
|
||||||
def _get_payments(self, form,user):
|
def _get_payments(self, form):
|
||||||
statement_line_obj = self.pool.get("account.bank.statement.line")
|
statement_line_obj = self.pool.get("account.bank.statement.line")
|
||||||
pos_order_obj = self.pool.get("pos.order")
|
pos_order_obj = self.pool.get("pos.order")
|
||||||
pos_ids=pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','=',self.uid)])
|
user_ids = form['user_ids'] or self._get_all_users()
|
||||||
|
pos_ids = pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','in',user_ids)])
|
||||||
data={}
|
data={}
|
||||||
if pos_ids:
|
if pos_ids:
|
||||||
st_line_ids = statement_line_obj.search(self.cr, self.uid, [('pos_statement_id', 'in', pos_ids)])
|
st_line_ids = statement_line_obj.search(self.cr, self.uid, [('pos_statement_id', 'in', pos_ids)])
|
||||||
|
@ -134,17 +119,17 @@ class pos_details(report_sxw.rml_parse):
|
||||||
"where absl.statement_id = abs.id and abs.journal_id = aj.id and absl.id IN %s " \
|
"where absl.statement_id = abs.id and abs.journal_id = aj.id and absl.id IN %s " \
|
||||||
"group by aj.name ",(tuple(a_l),))
|
"group by aj.name ",(tuple(a_l),))
|
||||||
|
|
||||||
data=self.cr.dictfetchall()
|
data = self.cr.dictfetchall()
|
||||||
return data
|
return data
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def _total_of_the_day(self, objects):
|
def _total_of_the_day(self, objects):
|
||||||
if self.total_paid:
|
if self.total:
|
||||||
if self.total_paid == self.total_invoiced:
|
if self.total == self.total_invoiced:
|
||||||
return self.total_paid
|
return self.total
|
||||||
else:
|
else:
|
||||||
return ((self.total_paid or 0.00) - (self.total_invoiced or 0.00))
|
return ((self.total or 0.00) - (self.total_invoiced or 0.00))
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -164,38 +149,36 @@ class pos_details(report_sxw.rml_parse):
|
||||||
def _strip_name(self, name, maxlen=50):
|
def _strip_name(self, name, maxlen=50):
|
||||||
return self._ellipsis(name, maxlen, ' ...')
|
return self._ellipsis(name, maxlen, ' ...')
|
||||||
|
|
||||||
def _get_tax_amount(self, form,user):
|
def _get_tax_amount(self, form):
|
||||||
res = {}
|
res = {}
|
||||||
temp={}
|
temp = {}
|
||||||
list_ids = []
|
list_ids = []
|
||||||
temp2 = 0.0
|
temp2 = 0.0
|
||||||
pos_order_obj = self.pool.get("pos.order")
|
user_ids = form['user_ids'] or self._get_all_users()
|
||||||
pos_ids = pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','=',self.uid)])
|
pos_order_obj = self.pool.get('pos.order')
|
||||||
temp.update({'name':''})
|
pos_ids = pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','in',user_ids)])
|
||||||
|
temp.update({'name': ''})
|
||||||
for order in pos_order_obj.browse(self.cr, self.uid, pos_ids):
|
for order in pos_order_obj.browse(self.cr, self.uid, pos_ids):
|
||||||
temp2 +=order.amount_tax
|
temp2 += order.amount_tax
|
||||||
for line in order.lines:
|
for line in order.lines:
|
||||||
if len(line.product_id.taxes_id):
|
if len(line.product_id.taxes_id):
|
||||||
tax = line.product_id.taxes_id[0]
|
tax = line.product_id.taxes_id[0]
|
||||||
res[tax.name] = (line.price_unit * line.qty * (1-(line.discount or 0.0) / 100.0)) + (tax.id in list_ids and res[tax.name] or 0)
|
res[tax.name] = (line.price_unit * line.qty * (1-(line.discount or 0.0) / 100.0)) + (tax.id in list_ids and res[tax.name] or 0)
|
||||||
list_ids.append(tax.id)
|
list_ids.append(tax.id)
|
||||||
temp.update({'name':tax.name})
|
temp.update({'name': tax.name})
|
||||||
temp.update({'amount':temp2})
|
temp.update({'amount': temp2})
|
||||||
return [temp] or False
|
return [temp] or False
|
||||||
|
|
||||||
def _get_period(self, form):
|
def _get_user_names(self, user_ids):
|
||||||
return form['date_start']
|
user_obj = self.pool.get('res.users')
|
||||||
|
return ', '.join(map(lambda x: x.name, user_obj.browse(self.cr, self.uid, user_ids)))
|
||||||
def _get_period2(self,form):
|
|
||||||
return form['date_end']
|
|
||||||
|
|
||||||
def __init__(self, cr, uid, name, context):
|
def __init__(self, cr, uid, name, context):
|
||||||
super(pos_details, self).__init__(cr, uid, name, context=context)
|
super(pos_details, self).__init__(cr, uid, name, context=context)
|
||||||
self.total = 0.0
|
self.total = 0.0
|
||||||
self.qty = 0.0
|
self.qty = 0.0
|
||||||
self.invoice_id = ''
|
|
||||||
self.total_paid = 0.0
|
|
||||||
self.total_invoiced = 0.0
|
self.total_invoiced = 0.0
|
||||||
|
self.discount = 0.0
|
||||||
self.localcontext.update({
|
self.localcontext.update({
|
||||||
'time': time,
|
'time': time,
|
||||||
'strip_name': self._strip_name,
|
'strip_name': self._strip_name,
|
||||||
|
@ -203,14 +186,13 @@ class pos_details(report_sxw.rml_parse):
|
||||||
'getsumdisc': self._get_sum_dis_2,
|
'getsumdisc': self._get_sum_dis_2,
|
||||||
'gettotalofthaday': self._total_of_the_day,
|
'gettotalofthaday': self._total_of_the_day,
|
||||||
'gettaxamount': self._get_tax_amount,
|
'gettaxamount': self._get_tax_amount,
|
||||||
'getperiod': self._get_period,
|
|
||||||
'getperiod2':self._get_period2,
|
|
||||||
'pos_sales_details':self._pos_sales_details,
|
'pos_sales_details':self._pos_sales_details,
|
||||||
'getqtytotal2': self._get_qty_total_2,
|
'getqtytotal2': self._get_qty_total_2,
|
||||||
'getsalestotal2': self._get_sales_total_2,
|
'getsalestotal2': self._get_sales_total_2,
|
||||||
'getsuminvoice2':self._get_sum_invoice_2,
|
'getsuminvoice2':self._get_sum_invoice_2,
|
||||||
'getpaidtotal2': self._paid_total_2,
|
'getpaidtotal2': self._paid_total_2,
|
||||||
'getinvoice':self._get_invoice,
|
'getinvoice':self._get_invoice,
|
||||||
|
'get_user_names': self._get_user_names,
|
||||||
})
|
})
|
||||||
|
|
||||||
report_sxw.report_sxw('report.pos.details', 'pos.order', 'addons/point_of_sale_singer/report/pos_details.rml', parser=pos_details, header='internal')
|
report_sxw.report_sxw('report.pos.details', 'pos.order', 'addons/point_of_sale_singer/report/pos_details.rml', parser=pos_details, header='internal')
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||||
|
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||||
|
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||||
|
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||||
|
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||||
</blockTableStyle>
|
</blockTableStyle>
|
||||||
<blockTableStyle id="Table2">
|
<blockTableStyle id="Table2">
|
||||||
<blockAlignment value="LEFT"/>
|
<blockAlignment value="LEFT"/>
|
||||||
|
@ -43,6 +47,10 @@
|
||||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
|
||||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
|
||||||
|
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||||
|
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/>
|
||||||
|
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||||
|
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
|
||||||
</blockTableStyle>
|
</blockTableStyle>
|
||||||
<blockTableStyle id="Table4">
|
<blockTableStyle id="Table4">
|
||||||
<blockAlignment value="LEFT"/>
|
<blockAlignment value="LEFT"/>
|
||||||
|
@ -164,11 +172,14 @@
|
||||||
<para style="terp_default_8">
|
<para style="terp_default_8">
|
||||||
<font color="white"> </font>
|
<font color="white"> </font>
|
||||||
</para>
|
</para>
|
||||||
<blockTable colWidths="208.0,133.0,85.0,86.0" style="Table1">
|
<blockTable colWidths="104.0,104.0,133.0,85.0,86.0" style="Table1">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_tblheader_General_Centre">Company</para>
|
<para style="terp_tblheader_General_Centre">Company</para>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="terp_tblheader_General_Centre">Users</para>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_tblheader_General_Centre">Print Date</para>
|
<para style="terp_tblheader_General_Centre">Print Date</para>
|
||||||
</td>
|
</td>
|
||||||
|
@ -180,19 +191,22 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
<blockTable colWidths="208.0,133.0,85.0,85.0" style="Table2">
|
<blockTable colWidths="104.0,104.0,133.0,85.0,85.0" style="Table2">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Centre_8">[[ company.name ]]</para>
|
<para style="terp_default_Centre_8">[[ company.name ]]</para>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="terp_default_Centre_8">[[ get_user_names(data['form']['user_ids']) or 'All' ]]</para>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]</para>
|
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Centre_8">[[ formatLang(getperiod(data['form']),date = True) ]] </para>
|
<para style="terp_default_Centre_8">[[ formatLang(data['form']['date_start'],date=True) ]] </para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Centre_8">[[ formatLang(getperiod2(data['form']),date = True) ]] </para>
|
<para style="terp_default_Centre_8">[[ formatLang(data['form']['date_end'],date=True) ]] </para>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
|
@ -225,7 +239,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
<section>
|
<section>
|
||||||
<para style="terp_default_1">[[ repeatIn(pos_sales_details(data['form'],user), 'line_ids') ]]</para>
|
<para style="terp_default_1">[[ repeatIn(pos_sales_details(data['form']), 'line_ids') ]]</para>
|
||||||
<blockTable colWidths="108.0,54.0,159.0,54.0,75.0,30.0,69.0" style="Table6">
|
<blockTable colWidths="108.0,54.0,159.0,54.0,75.0,30.0,69.0" style="Table6">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -247,7 +261,7 @@
|
||||||
<para style="terp_default_Centre_9">[[ formatLang(line_ids['discount'], dp='Sale Price') ]]</para>
|
<para style="terp_default_Centre_9">[[ formatLang(line_ids['discount'], dp='Sale Price') ]]</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Centre_9">[[ getinvoice(line_ids['invoice_id'],user) or removeParentNode('font') ]]</para>
|
<para style="terp_default_Centre_9">[[ getinvoice(line_ids['invoice_id']) or removeParentNode('font') ]]</para>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
|
@ -268,7 +282,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
<section>
|
<section>
|
||||||
<para style="terp_default_1">[[ repeatIn(gettaxamount(data['form'],user), 'p')]]</para>
|
<para style="terp_default_1">[[ repeatIn(gettaxamount(data['form']), 'p')]]</para>
|
||||||
<blockTable colWidths="256.0,256.0" style="Table5">
|
<blockTable colWidths="256.0,256.0" style="Table5">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -299,7 +313,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
<section>
|
<section>
|
||||||
<para style="terp_default_1">[[ repeatIn(getpayments(data['form'],user), 'p') ]]</para>
|
<para style="terp_default_1">[[ repeatIn(getpayments(data['form']), 'p') ]]</para>
|
||||||
<blockTable colWidths="255.0,255.0" style="Table11">
|
<blockTable colWidths="255.0,255.0" style="Table11">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -335,7 +349,7 @@
|
||||||
<para style="terp_default_Bold_9">Sales total(Revenue)</para>
|
<para style="terp_default_Bold_9">Sales total(Revenue)</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Right_9_Bold">[[ formatLang(getsalestotal2(data['form'],user), dp='Sale Price') ]] [[ company.currency_id.symbol ]]</para>
|
<para style="terp_default_Right_9_Bold">[[ formatLang(getsalestotal2(), dp='Sale Price') ]] [[ company.currency_id.symbol ]]</para>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -343,7 +357,7 @@
|
||||||
<para style="terp_default_Bold_9">Qty of product</para>
|
<para style="terp_default_Bold_9">Qty of product</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Right_9_Bold">[[ formatLang(getqtytotal2(data['form'],user)) ]]</para>
|
<para style="terp_default_Right_9_Bold">[[ formatLang(getqtytotal2()) ]]</para>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -351,7 +365,7 @@
|
||||||
<para style="terp_default_Bold_9">Total invoiced</para>
|
<para style="terp_default_Bold_9">Total invoiced</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Right_9_Bold">[[ formatLang(getsuminvoice2(data['form'],user), dp='Sale Price') ]] [[ company.currency_id.symbol ]]</para>
|
<para style="terp_default_Right_9_Bold">[[ formatLang(getsuminvoice2(data['form']), dp='Sale Price') ]] [[ company.currency_id.symbol ]]</para>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -359,7 +373,7 @@
|
||||||
<para style="terp_default_Bold_9">Total discount</para>
|
<para style="terp_default_Bold_9">Total discount</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Right_9_Bold">[[ formatLang(getsumdisc(data['form'],user), dp='Sale Price') ]] [[ company.currency_id.symbol ]]</para>
|
<para style="terp_default_Right_9_Bold">[[ formatLang(getsumdisc(), dp='Sale Price') ]] [[ company.currency_id.symbol ]]</para>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -367,7 +381,7 @@
|
||||||
<para style="terp_default_Bold_9">Total paid</para>
|
<para style="terp_default_Bold_9">Total paid</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Right_9_Bold">[[ formatLang(getpaidtotal2(data['form'],user), dp='Sale Price') ]] [[ company.currency_id.symbol ]]</para>
|
<para style="terp_default_Right_9_Bold">[[ formatLang(getpaidtotal2(), dp='Sale Price') ]] [[ company.currency_id.symbol ]]</para>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
import time
|
import time
|
||||||
ctx={}
|
ctx={}
|
||||||
ctx.update({'model': 'ir.ui.menu','active_ids': []})
|
ctx.update({'model': 'ir.ui.menu','active_ids': []})
|
||||||
data_dict = {'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d')}
|
data_dict = {'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d'), 'user_ids': [(6,0,[ref('base.user_root')])]}
|
||||||
from tools import test_reports
|
from tools import test_reports
|
||||||
test_reports.try_report_action(cr, uid, 'action_report_pos_details',wiz_data=data_dict, context=ctx, our_module='point_of_sale')
|
test_reports.try_report_action(cr, uid, 'action_report_pos_details',wiz_data=data_dict, context=ctx, our_module='point_of_sale')
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ class pos_details(osv.osv_memory):
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'date_start': fields.date('Date Start', required=True),
|
'date_start': fields.date('Date Start', required=True),
|
||||||
'date_end': fields.date('Date End', required=True)
|
'date_end': fields.date('Date End', required=True),
|
||||||
|
'user_ids': fields.many2many('res.users', 'pos_details_report_user_rel', 'user_id', 'wizard_id', 'Salesmen'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'date_start': lambda *a: time.strftime('%Y-%m-%d'),
|
'date_start': lambda *a: time.strftime('%Y-%m-%d'),
|
||||||
|
@ -48,7 +49,7 @@ class pos_details(osv.osv_memory):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
datas = {'ids': context.get('active_ids', [])}
|
datas = {'ids': context.get('active_ids', [])}
|
||||||
res = self.read(cr, uid, ids, ['date_start', 'date_end'], context=context)
|
res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_ids'], context=context)
|
||||||
res = res and res[0] or {}
|
res = res and res[0] or {}
|
||||||
datas['form'] = res
|
datas['form'] = res
|
||||||
if res.get('id',False):
|
if res.get('id',False):
|
||||||
|
|
|
@ -1,23 +1,29 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
<!-- pos.details -->
|
<!-- pos.details -->
|
||||||
|
|
||||||
<record id="view_pos_details" model="ir.ui.view">
|
<record id="view_pos_details" model="ir.ui.view">
|
||||||
<field name="name">POS Details</field>
|
<field name="name">POS Details</field>
|
||||||
<field name="model">pos.details</field>
|
<field name="model">pos.details</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="POS Details :">
|
<form string="POS Details">
|
||||||
<group col="2" colspan="4">
|
<group col="4" colspan="4">
|
||||||
<field name="date_start"/>
|
<separator string="Dates" colspan="4"/>
|
||||||
<field name="date_end"/>
|
<field name="date_start"/>
|
||||||
<separator colspan="4"/>
|
<field name="date_end"/>
|
||||||
<button icon='gtk-cancel' special="cancel"
|
<separator string="User" colspan="4"/>
|
||||||
string="Close" />
|
<field name="user_ids" nolabel="1" colspan="4"/>
|
||||||
<button name="print_report" string="Print Report"
|
<separator string="" colspan="4"/>
|
||||||
colspan="1" type="object" icon="gtk-print" />
|
<label string="" colspan="2"/>
|
||||||
</group>
|
<group colspan="2" col="2">
|
||||||
|
<button icon='gtk-cancel' special="cancel"
|
||||||
|
string="Close" />
|
||||||
|
<button name="print_report" string="Print Report"
|
||||||
|
colspan="1" type="object" icon="gtk-print" />
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -32,6 +38,6 @@
|
||||||
<field name="target">new</field>
|
<field name="target">new</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
Loading…
Reference in New Issue