Browse Source

[REF] 'document_extract_from_database': misc

pull/85/head
Sylvain LE GAL 10 years ago
parent
commit
9019952814
  1. 3
      document_extract_from_database/__openerp__.py
  2. 10
      document_extract_from_database/model/document_multiple_action.py
  3. 7
      document_extract_from_database/model/ir_attachment.py

3
document_extract_from_database/__openerp__.py

@ -43,12 +43,9 @@ Make sure you've correctly defined the filestore in your database:
Then go to your document list, select all the documents you want to extract. Then go to your document list, select all the documents you want to extract.
Then, "More > Document Extraction" Then, "More > Document Extraction"
""", """,
"demo": [],
"data": [ "data": [
'view/view.xml', 'view/view.xml',
'view/action.xml', 'view/action.xml',
'data/ir_values.xml', 'data/ir_values.xml',
], ],
'installable': True,
'active': False,
} }

10
document_extract_from_database/model/document_multiple_action.py

@ -19,17 +19,17 @@
# #
############################################################################### ###############################################################################
from openerp.osv import orm
from openerp.osv.orm import TransientModel
class document_multiple_action(orm.TransientModel):
_name = "document.multiple.action"
_description = "Multiple action on document"
class document_multiple_action(TransientModel):
_name = 'document.multiple.action'
_description = 'Multiple action on document'
def write_again(self, cr, uid, ids, context=None): def write_again(self, cr, uid, ids, context=None):
if context is None: if context is None:
context = {} context = {}
document_obj = self.pool.get('ir.attachment')
document_obj = self.pool['ir.attachment']
document_ids = context.get('active_ids') document_ids = context.get('active_ids')
if document_ids: if document_ids:
document_obj.write_again(cr, uid, document_ids, context=context) document_obj.write_again(cr, uid, document_ids, context=context)

7
document_extract_from_database/model/ir_attachment.py

@ -19,16 +19,17 @@
# #
############################################################################### ###############################################################################
from openerp.osv import orm
import base64 import base64
from openerp.osv.orm import Model
class ir_attachment(orm.Model):
class ir_attachment(Model):
_inherit = 'ir.attachment' _inherit = 'ir.attachment'
def _write_again(self, cr, uid, id, context=None): def _write_again(self, cr, uid, id, context=None):
current_data = self.browse(cr, uid, id, context=context) current_data = self.browse(cr, uid, id, context=context)
location = self.pool.get('ir.config_parameter').\
location = self.pool['ir.config_parameter'].\
get_param(cr, uid, 'ir_attachment.location') get_param(cr, uid, 'ir_attachment.location')
if current_data.db_datas and location: if current_data.db_datas and location:
vals = { vals = {

Loading…
Cancel
Save