I have a problem doing a method, it turns out that I want to make a ledger but the code I try to do does not work for me, the idea is that with a date filter it shows me the account and all the movements, for this I have a table that contains All the data I need. The document detail table contains the debit and credit along with the company id and the id account, as well as the date the movement was made. As I said before I tried to make a code that would call me that data to the pdf report but it did not work, can you guide me how to solve the problem please.
class Reportledger (models.AbstractModel):
_name = 'reports.project_rc.ledger_view' @api.model def _get_report_values (self, docids, data = None): start_date = data ['form'] ['start_date'] end_date = data ['form'] ['end_date'] docs = [] document_detail = self.env ['project_rc.detail_document']. search ([ ('date', '> =', start_date.strftime (DATETIME_FORMAT)), ('date', '<=', end_date.strftime (DATETIME_FORMAT)), ('title', '=', account.id), ('name', '=', razon_social.id), ('debit', '=', total_debit), ('credit', '=', total_credit), ]) docs.append ({ 'title': self.detail_document.account_id.title, 'date': detail_document.date, 'name': self.detail_document.company_id.name, 'must': detail_document.total_debit, 'credit': detail_document.total_credit, }) return { 'doc_ids': data ['ids'], 'doc_model': data ['model'], 'start_date': start_date, 'end_date': end_date, 'docs': docs, }