콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
1262 화면

I need to make a report that includes the lead_properties in a crm.lead but with the lead properties properly exported - names for the fields from the crm.team record, and value names if it's a selection.  I figured this would also be a good way to try making my first custom report in a module.

I was able to create the module, get it to add itself to the CRM/Reporting menu, and invoke it, but I'm not getting any data.  The template is being invoked, just no rows.

The report itself looks like


          model="crm.lead"
        string="Custom CRM Lead Report"
        report_type="qweb-pdf"
        file="custom_crm_lead_report.report_template"
        name="custom_crm_lead_report.report_template"    />

I have tried a bunch of different ways to get sample data in, but my generate_report() method doesn't ever get called. That's in addition to the fact that I'm probably not returning the correct thing.

Do I need to do something in the report description xml to tell it "and this is the method you call to get the rows of data" ?


class CRMLeadReport(models.Model):
    _name = 'crm.lead.report'
    _description = 'Custom CRM Lead Report'
   @api.model
  def generate_report(self):
        _logger.error("OH NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO")
sample_data = [
            {'lead_name': 'Lead 1', 'team_name': 'Sales Team A', 'custom_data': 'Sample Data 1'},
            {'lead_name': 'Lead 2', 'team_name': 'Sales Team B', 'custom_data': 'Sample Data 2'},
            {'lead_name': 'Lead 3', 'team_name': 'Sales Team C', 'custom_data': 'Sample Data 3'}
        ]   return  {            'docs': [sample_data]        }

아바타
취소
작성자

I think I did everything in that video. Also I followed github.com/vyngt
/odoo-sample-app which shows a couple of reports. I'm quite certain these line up:

<field name="model">crm.lead.coe_report</field>
class COELeadReport(models.Model):
_name = 'crm.lead.coe_report'

This model definitely gets loaded (I can see it in settings / technical / database / model).

so everything seems to be linked together, but my get_report_values never gets called:
@api.model
def _get_report_values(self, docids, data=None)

I need to check your code first, and then I'll provide the correct answer. Can you please share the code?

if you need more help feel free to contact i'll guide you.

작성자

I think I figured it out. The rules for how these pieces have to be named are a little complicated.

베스트 답변

Hello Christopher Piggott ,


Please refer the video: https://youtu.be/H7cGI23BHNs?si=F095OmTe2rewo7rR

I have shared video please checked and try after if you have any doubt let me know.


Hope this helps!

Thanks & Regards,

Name : Yahoo Baba

Email: yahoobaba077@gmail.com

아바타
취소
관련 게시물 답글 화면 활동
2
5월 25
1142
0
3월 24
1177
2
11월 16
5401
3
2월 16
16030
3
3월 15
8823