Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

POS : Add price_subtotal field on report_detailsofsales

By
Koffi KPONOUGLO
on 9/14/15, 8:21 AM 393 views

Hi everybody,

I would like to add in the report_detailsofsales.xml file price_subtotal field but i get error.

                    <tbody>
<tr t-foreach="pos_sales_details(data['form'])" t-as="line_ids" >
<td>
<span t-esc="formatLang(line_ids['date_order'], date_time=True)"/>
</td>
<td>
<span t-esc="line_ids['pos_name']"/>
</td>
<td>
[<t t-if="line_ids['code']">
<span t-esc="line_ids['code']"/>
</t>]
<span t-esc="line_ids['name']"/>
</td>
<td class="text-right">
<span t-esc="formatLang(line_ids['price_unit'], dp='Sale Price', currency_obj=res_company.currency_id)"/>
</td>
<td class="text-center">
<span t-esc="formatLang(line_ids['qty'])"/>
<span t-esc="line_ids['uom']"/>
</td>
<td class="text-center">
<span t-esc="formatLang(line_ids['discount'], dp='Sale Price')"/>
</td>
<td class="text-center">
<span t-esc="formatLang(line_ids['price_subtotal'], dp='Sale Price', currency_obj=res_company.currency_id)"/>
</td>

<td class="text-center">
<t t-if="line_ids['invoice_id']">
<span t-esc="getinvoice(line_ids['invoice_id'])"/>
</t>
</td>
</tr>
</tbody>


Can you help me. Thanks.

0
pks
On 9/14/15, 8:55 AM

If you want to add any fields into your report , you first define or call that variable into your py file, i will give you an example,

class report_manufacturing_order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_manufacturing_order, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'product_record': self._product_record,
})

def _product_record(self, production_ids):

product_obj = self.pool.get('mrp.production')
res = []
for production_data in product_obj.browse(self.cr, self.uid, production_ids):
# product_ids = self.pool.get('product.product').search(self.cr, self.uid, [('product_id','=',production_data.id)])
vals = {
# 'employee_id' : employee_data.employee_id,
'order_no' : production_data.name,
'product_name' : production_data.product_id.name,
'customer' : production_data.partner_id.name,
'quantity' : production_data.product_qty,
'start' : production_data.date_planned,
'end' : production_data.end_date_planned,
'cost' : production_data.product_id.cost_price
}
res.append(vals)
return res
class report_manufacturing_order_AbstractModel(osv.AbstractModel):
_name = 'report.ncr_report.report_manufacturing_order_template'
_inherit = 'report.abstract_report'
_template = 'ncr_report.report_manufacturing_order_template'
_wrapped_report_class = report_manufacturing_order

***********************

then you need to return that values and , call from xml file,

another 

 

Hi prasanth.ks, report_detailsofsales is based on a wizard. But in the py file of this wizard i have just see tree fields. but when you was seeing the xml file we have more than tree field. I don't understand anythink. Thanks

Koffi KPONOUGLO
on 9/14/15, 11:27 AM

Sorry prasanth.ks, you right. i am working on bad py file. The right py file is pos_details.py. thanks

Koffi KPONOUGLO
on 9/14/15, 11:52 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/14/15, 8:21 AM
Seen: 393 times
Last updated: 9/14/15, 11:53 AM