Odoo Help


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.


How to append sale order line in qweb report ?

Jignesh Mehta
on 3/8/16, 10:56 PM 640 views


I have multiple sale order line and sale order line have one field called order id.

When I print sale order line, qweb create a new page for every line that is i want.

But now, when the order id is same for multiple sale order line, it append in one report.

How to do this ??


It's Done.

Jignesh Mehta
on 3/9/16, 6:19 AM

Jignesh Mehta

--Jignesh Mehta--
| 6 4 8
Surat, India
--Jignesh Mehta--

Jignesh Mehta
On 3/10/16, 1:36 AM


I have taken one field in sale order line which is many2one to sale order line.

Now search the record where reference id are same and in that record written the first sale order line id.

For report,

Create a parser class and take method render_html.

Then search the record in the sale order line that line_id is the sale_order_line.id so i get same reference_id record in list and append in the main list.

Because there are many records which have multiple sale order line.

class PackingListReport(models.AbstractModel):

    _name = 'report.work_order.report_packing_list'


    def render_html(self, data=None):

        family = []

        report_obj = self.env['report']

        work_order_id = self.env['work.order'].browse(self.id)

        for line in work_order_id.work_order_line:

            search_id = work_order_id.work_order_line.search([('order_work_id', '=', self.id), ('reference_id', '=', line.reference_id), ('line_id', '=', line.id)])

            if search_id:


        report = report_obj._get_report_from_name('work_order.report_packing_list')

        docargs = {

            'doc_ids': self._ids,

            'doc_model': report.model,

            'docs': work_order_id,

            'family': family,


        return report_obj.render('work_order.report_packing_list', docargs)

and this family list append in the dictionary and pass through render method.

So I can easily fetch it into my report template.


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)


Asked: 3/8/16, 10:56 PM
Seen: 640 times
Last updated: 4/27/16, 2:31 AM