Search 1.9 billion lines of Odoo code on GitHub

custom_download_file

Author: Erick Navarro
License: no license
Branch: 7.0
Repository: cesaraugustochirinos/custom_download_file
Dependencies: base, and web
Languages: JavaScript (35, 39.8%), Markdown (21, 23.9%), and Python (32, 36.4%)
Other branches: 11.0, and 8.0
Other repositories: 111sree/custom_download_file, Capriatto/custom_download_file, Guobower/custom_download_file, IJOL/custom_download_file, amarildogolloshi/custom_download_file, consultingerp/custom_download_file, cubicerpdev/custom_download_file, dsasoftware/custom_download_file, edanpiro/custom_download_file, erickgnavar/custom_download_file, georgeppts/custom_download_file, gitlabuser/custom_download_file, guidev224/custom_download_file, haylahi/custom_download_file, hxsam/custom_download_file, mario21ic/custom_download_file, odooerpperu/custom_download_file, one2pret/custom_download_file, pythoner-3k/custom_download_file, qq470647251/custom_download_file, sc4you/custom_download_file, and yasmanycastillo/custom_download_file

<h2>Custom Download File Odoo module</h2> <p>Widget for download a customized file</p> <h3>Extend base model</h3> <p>```python from osv import orm</p> <p>class MyFile(orm.TransientModel):</p> <pre><code>_inherit = &#39;download.file.base.model&#39; _name = &#39;my.file&#39; def init(self, cr, uid, record_id, context=None): super(MyFile, self).init(cr, uid, record_id, context=context) # initialize values def get_filename(self, cr, uid, context=None): return &#39;filename&#39; def get_content(self, cr, uid, context=None): # process a file and return content return &#39;file_content&#39; </code></pre> <p>```</p> <h3>Add to form</h3> <p><code>xml &lt;widget type=&quot;download_button&quot; model=&quot;my.file&quot; string=&quot;Download this file&quot;/&gt; </code></p>