Skip to content
Snippets Groups Projects
Commit 8ad9c089 authored by Daniil Digtyar Vasilieva's avatar Daniil Digtyar Vasilieva :call_me: Committed by Enrico Stano
Browse files

[IMP] use method to call download of template

parent d2831bd8
No related branches found
No related tags found
2 merge requests!187Release 14.0.1.1.13,!155[IMP] energy_selfconsumption: importation of selfconsumption inscriptions, supply points and distribution tables by CSV
......@@ -9,11 +9,5 @@
</field>
<field name="company_id"></field>
</record>
<record model="ir.actions.act_url" id="distribution_table_download_act_url">
<field name="name">distribution_table_download_act_url</field>
<field name="url" eval="'/web/content/' + str(ref('distribution_table_example_attachment')) + '?download=true'"></field>
<field name="target">new</field>
</record>
</data>
</odoo>
......@@ -35,12 +35,10 @@ class DistributionTableImportWizard(models.TransientModel):
def download_template_button(self):
distribution_table_example_attachment = self.env.ref('energy_selfconsumption.distribution_table_example_attachment')
base_url = self.env['ir.config_parameter'].get_param('web.base.url')
download_url = '/web/content/' + str(distribution_table_example_attachment.id) + '?download=true'
# download
download_url = '/web/content/{}/?download=true'.format(str(distribution_table_example_attachment.id))
return {
"type": "ir.actions.act_url",
"url": str(base_url) + str(download_url),
"url": download_url,
"target": "new",
}
......
......@@ -8,7 +8,10 @@
<field name="arch" type="xml">
<form>
<sheet>
<button type="action" name="energy_selfconsumption.distribution_table_download_act_url">Download Template</button>
<p>You can download an example template for the import. The template must have this format and
be a CSV file.</p>
<button type="object" name="download_template_button">Download Template</button>
<separator/>
<group>
<field name="import_file" filename="fname" widget="binary"></field>
<field name="fname" invisible="1"></field>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment