diff options
| author | Harry (Open ERP) <hmo@tinyerp.com> | 2010-05-27 18:14:58 +0530 |
|---|---|---|
| committer | Harry (Open ERP) <hmo@tinyerp.com> | 2010-05-27 18:14:58 +0530 |
| commit | a8556259162f57344ea7dbf80bcf38857f482694 (patch) | |
| tree | 4193e7bc338c7bd0c001cd6dd9906d51c6eff566 /addons/document/document.py | |
| parent | 636f8918dbeb2a37bc05295f83bad79f9aff389e (diff) | |
| parent | 51770be47b3073a8917bbc9b853d95d18431db2e (diff) | |
[MERGE] work of document module
bzr revid: hmo@tinyerp.com-20100527124458-02xxdfbi8kp0x94k
Diffstat (limited to 'addons/document/document.py')
| -rw-r--r-- | addons/document/document.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/addons/document/document.py b/addons/document/document.py index 2b2ac2f7587..5d3075f7a4a 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -75,7 +75,7 @@ class document_file(osv.osv): 'user_id': fields.many2one('res.users', 'Owner', select=1), 'group_ids': fields.many2many('res.groups', 'document_group_rel', 'item_id', 'group_id', 'Groups'), # the directory id now is mandatory. It can still be computed automatically. - 'parent_id': fields.many2one('document.directory', 'Directory', select=1, required=True), + 'parent_id': fields.many2one('document.directory', 'Directory', select=1), 'file_size': fields.integer('File Size', required=True), 'file_type': fields.char('Content Type', size=128), # If ir.attachment contained any data before document is installed, preserve @@ -88,11 +88,16 @@ class document_file(osv.osv): 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), 'store_method': fields.selection([('db', 'Database'), ('fs', 'Filesystem'), ('link', 'Link')], "Storing Method"), 'datas': fields.function(_data_get, method=True, fnct_inv=_data_set, string='File Content', type="binary", nodrop=True), + 'url': fields.char('File URL',size=64), 'store_fname': fields.char('Stored Filename', size=200), 'res_model': fields.char('Attached Model', size=64), #res_model 'res_id': fields.integer('Attached ID'), #res_id 'partner_id':fields.many2one('res.partner', 'Partner', select=1), - 'title': fields.char('Resource Title', size=64), + 'type':fields.selection([ + ('url','URL'), + ('binary','Binary'), + + ],'Type', help="Type is used to separate URL and binary File"), } def __get_def_directory(self, cr, uid, context=None): @@ -103,6 +108,7 @@ class document_file(osv.osv): 'user_id': lambda self, cr, uid, ctx:uid, 'file_size': lambda self, cr, uid, ctx:0, 'store_method': lambda *args: 'db', + 'type': 'binary', 'parent_id': __get_def_directory } _sql_constraints = [ @@ -155,7 +161,6 @@ class document_file(osv.osv): def create(self, cr, uid, vals, context=None): if not context: context = {} - vals['title'] = vals['name'] vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False) if not vals['parent_id']: vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context) @@ -168,8 +173,6 @@ class document_file(osv.osv): result = obj_model.read(cr, uid, [vals['res_id']], ['name', 'partner_id', 'address_id'], context=context) if len(result): obj = result[0] - if obj.get('name', False): - vals['title'] = (obj.get('name', ''))[:60] if obj_model._name == 'res.partner': vals['partner_id'] = obj['id'] elif obj.get('address_id', False): |
