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

Custom qweb report on multiple modules

By
Fongoh Tayong
on 1/12/16, 5:25 AM 950 views

Hi there. i want to create a qweb report that takes data from multiple models.

3 models are 

class Reservation(models.Model):
     _name = 'hotel.reservation'
     checkout_date = fields.Datetime()
     #other fields

 

class RoomServiuce(models.model):
   _name = 'hotel.room_service'
   name = fields.Char(string='service name')
  #other fields



class RoomServiceUsed(models.Model)
    _name = 'hotel.use_room_services'
   res_id = fields.Many2one('hotel.reservation')
   rs_id = fields.Many2one('hotel.room_services')



Now, i want to be able to display all the room services used ( from room_service model and reservation model) on my custom qweb report.


I don't know if am getting it all wrong. Will appreciate your response and your approach.

Thanks
 

0

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 1/12/16, 7:48 AM

You need to create a python parser for your report file. Define  functions on the python file, that brings you the required data from the 3 models. Call that function in the report qweb xml file.

For example, you may refer the qweb report of product pricelist in product addon.

Goto product >> views >> report_pricelist.xml file and check the function get_pricelist(data['form']['price_list'])
The function is defined in a report parser file for that report which you can found in product >> report >> product_pricelist.py

By checking that python parser file, you may see how the qweb template linked to the parser.

Hope it may help you.

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: 1/12/16, 5:25 AM
Seen: 950 times
Last updated: 1/12/16, 7:48 AM