Odoo Help


How to append sale order line in qweb report ?

Jignesh Mehta
on 3/8/16, 10:56 PM 1,837 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 5 8
Surat, India
--Jignesh Mehta--

- I have 3+ years of Industry Experience, specializing Odoo Development, Analysis, Customization, Implementation, Integration.
- I have done many Customization modules in Sale, Purchase, Point of Sale, Inventory, CRM and much more. Also Worked in the Odoo Themes like Business Theme or E-Commerce Theme.
- Develop Jewelery Manufacturing process from Scratch. It have more than 10 Department. Develop PDF and Excel reports for this project around 150 per format.

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.


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: 3/8/16, 10:56 PM
Seen: 1837 times
Last updated: 4/27/16, 2:31 AM