Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
9276 มุมมอง

I've created a many2one field which holds every report in the odoo. How to select the report default by it's model name as a filter?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Yuvaraj,

def default_report_template(self):
act_model = self.env.context.get('active_model')
active_model_id = self.env['ir.model'].search([('name','=',act_model)]).id
filtered_report = self.env['ir.actions.report'].search([('binding_model_id','=',active_model_id)], limit=1)
return filtered_report and filtered_report.id or False

report_templates = fields.Many2one('ir.actions.report', default=default_report_template)

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มี.ค. 24
1524
1
ธ.ค. 21
5235
2
เม.ย. 21
11342
3
ต.ค. 18
40793
2
ก.ค. 15
4786