diff options
| author | Purnendu Singh (OpenERP) <psi@tinyerp.com> | 2012-10-03 15:12:42 +0530 |
|---|---|---|
| committer | Purnendu Singh (OpenERP) <psi@tinyerp.com> | 2012-10-03 15:12:42 +0530 |
| commit | 4ef3f9218bb97b66b301f84ed49661d3be79a909 (patch) | |
| tree | 22cf9262a2787130ee0f1303f3285f6ceab90a99 /addons/document/document.py | |
| parent | 879cdd8e40c74c4fd583d05c1cae680e76e3be9a (diff) | |
[IMP] document: add on_change on fname so it will update the download link with the name of attached document
bzr revid: psi@tinyerp.com-20121003094242-5wu6pki5cx442jte
Diffstat (limited to 'addons/document/document.py')
| -rw-r--r-- | addons/document/document.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/document/document.py b/addons/document/document.py index 3ae783f49e7..cbc20edc044 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -36,7 +36,6 @@ DMS_ROOT_PATH = tools.config.get('document_path', os.path.join(tools.config['roo class document_file(osv.osv): _inherit = 'ir.attachment' - _rec_name = 'datas_fname' def _attach_parent_id(self, cr, uid, ids=None, context=None): @@ -149,7 +148,14 @@ class document_file(osv.osv): _sql_constraints = [ # filename_uniq is not possible in pure SQL ] - def _check_duplication(self, cr, uid, vals, ids=None, op='create'): + + def onchange_file(self, cr, uid, ids, datas_fname=False, context=None): + res = {'value':{}} + if datas_fname: + res['value'].update({'name': datas_fname}) + return res + + def _check_duplication(self, cr, uid, vals, ids=[], op='create'): name = vals.get('name', False) parent_id = vals.get('parent_id', False) res_model = vals.get('res_model', False) |
