Odoo Help


POS : Add price_subtotal field on report_detailsofsales

on 9/14/15, 8:21 AM 1,017 views

Hi everybody,

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

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

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

Can you help me. Thanks.

Prasanth ks
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
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,



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

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

on 9/14/15, 11:52 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


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