summaryrefslogtreecommitdiff
path: root/addons/document
diff options
context:
space:
mode:
authorFabien Pinckaers <fp@openerp.com>2012-10-10 22:21:48 +0200
committerFabien Pinckaers <fp@openerp.com>2012-10-10 22:21:48 +0200
commita435e18d83bf1027bed5f54dd5e3f301261a9f4d (patch)
tree61de3158f4b2262bbc0071cbd341d7cef178ac37 /addons/document
parentb2d8a448b47835b744e1defeef257353c6081d12 (diff)
parent9c8eab68559b98546a40dab1a535137523f7f67a (diff)
[MERGE] documents
bzr revid: fp@openerp.com-20121010202148-hsisroe6a2tra2um
Diffstat (limited to 'addons/document')
-rw-r--r--addons/document/document.py10
-rw-r--r--addons/document/document_view.xml12
2 files changed, 11 insertions, 11 deletions
diff --git a/addons/document/document.py b/addons/document/document.py
index e2fa2cecd1e..b5d0080d816 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -38,7 +38,6 @@ class document_file(osv.osv):
_inherit = 'ir.attachment'
_rec_name = 'name'
-
def _attach_parent_id(self, cr, uid, ids=None, context=None):
"""Migrate ir.attachments to the document module.
@@ -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)
diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml
index b631583fb27..54776c4d36e 100644
--- a/addons/document/document_view.xml
+++ b/addons/document/document_view.xml
@@ -228,6 +228,9 @@
<field name="priority" eval="1"/>
<field name="inherit_id" ref="base.view_attachment_form"/>
<field name="arch" type="xml">
+ <xpath expr="//field[@name='datas_fname']" position="replace">
+ <field name="datas_fname" invisible="1" on_change="onchange_file(datas_fname)"/>
+ </xpath>
<field name="url" position="after">
<field name="user_id"/>
</field>
@@ -338,15 +341,6 @@
<field name="value" eval="'ir.actions.act_window,%d'%action_document_file_directory_form"/>
</record>
- <record model="ir.ui.view" id="view_attachment_form_inherit">
- <field name="name">ir.attachment.view.inherit</field>
- <field name="model">ir.attachment</field>
- <field name="inherit_id" ref="base.view_attachment_form"/>
- <field name="arch" type="xml">
- <field name="datas_fname" position = "replace" >
- </field>
- </field>
- </record>
<record model="ir.ui.view" id="view_process_node_form_inherit1">
<field name="name">process.node.form</field>