I have this code which inherits the function that passes the data to be shown in the report. I wanted to add a new "docs" like so:
================
class MyCustomReport(models.AbstractModel):
_inherit = 'report.my_addon.custom_report'
def _get_report_values(self, docids, data=None):
# here i get the original data first
res = super(MyCustomReport, self)._get_report_values(docids, data)
docs = res['docs']
# i add my additional data
dict_docs = {
'my_add_on': self._my_function_to_get_the_data()
}
# i update the result
res.update({
'additional_docs': dict_docs
})
return res
======== ========
This returns:
{'doc_ids': [3], 'doc_model': 'account.move', 'docs': account.move(3,), 'qr_code_urls': {}, 'additional_docs': {'my_add_on': None}}
I tried adding it to my qweb .xml custom report. See code below for what i am currently working on. This custom_report_inherit_first_customis my first custom which works well since i am using the "docs" data. This custom_report_inherit_addon_second_custom returns an error because i can't pull the "additional_docs" data.
# inherit report invoice document > then add my customization
< # template id="second_custom_report_inherit" inherit_id="my_adodn.first_custom_report_inherit">
# I tried logging what i have fetched
< t t-esc="o"/> # this returns 'docs'
< t t-esc="o_a"/> # this returns nothing and causes an error when i call the parameter i added, saying it does not exist
< # / template>
# i try to inherit the report_invoice to add my new parameter
< # / template id="report_invoice_inherit" inherit_id="account.report_invoice">
# i inherit the xpath : < xpath expr="'web.html_container'" position="inside" >
and the do the for each like the account.report_invoice and then call the template
t t-foreach="additional_docs" t-as="o_a"
t t-call="my_addon.second_custom_report_inherit"
[close tags for all]
[close tags for all]
[close tags for all]
(sorry for the format)
I'm not sure how to get the second data to show in the report. Please help