Welcome!

Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

Sign up

You need to be registered to interact with the community.
This question has been flagged
1 Reply
50 Views

Hey Cyllo users, what is the use of abstract model and how do I go about creating them in Cyllo?

Avatar
Discard

This Odoo code defines an abstract model 'ReportExample' inheriting from 'models.AbstractModel'. The '_get_report_values' method fetches data from the model based on the provided 'docids' and returns a dictionary containing necessary data for the report.
This structure enables creating reusable report logic that can be extended by other report models.

 from odoo import api, models

class ReportExample(models.AbstractModel):
​_name = 'report.my_module.report_template'

  ​@api.model def _get_report_values(self, docids, data=None):
  ​docs = self.env['example.model'].browse(docids)
  ​return {'doc_ids': docids, 'doc_model': 'example.model', 'docs': docs}

Avatar
Discard

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!