Hey Cyllo users, what is the use of abstract model and how do I go about creating them in Cyllo?
Welcome!
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.
This question has been flagged
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}