Denis Ledoux (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/7.0-document-index-dle into lp:openobject-addons/7.0.
Requested reviews: Antony Lesuisse (OpenERP) (al-openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-document-index-dle/+merge/141221 Document index content working when adding or editing ir.attachments -- https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-document-index-dle/+merge/141221 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/7.0-document-index-dle.
=== modified file 'document/document.py' --- document/document.py 2012-12-19 17:00:05 +0000 +++ document/document.py 2012-12-24 14:19:23 +0000 @@ -117,8 +117,22 @@ # take partner from uid if vals.get('res_id', False) and vals.get('res_model', False) and not vals.get('partner_id', False): vals['partner_id'] = self.__get_partner_id(cr, uid, vals['res_model'], vals['res_id'], context) + if vals.get('datas', False): + vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None) return super(document_file, self).create(cr, uid, vals, context) + def write(self, cr, uid, ids, vals, context=None): + if context is None: + context = {} + if vals.get('datas', False): + vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None) + return super(document_file, self).write(cr, uid, ids, vals, context) + + def _index(self, cr, uid, data, datas_fname, file_type): + mime, icont = cntIndex.doIndex(data, datas_fname, file_type or None, None) + icont_u = ustr(icont) + return mime, icont_u + def __get_partner_id(self, cr, uid, res_model, res_id, context=None): """ A helper to retrieve the associated partner from any res_model+id It is a hack that will try to discover if the mentioned record is === modified file 'document/document_view.xml' --- document/document_view.xml 2012-12-20 02:04:33 +0000 +++ document/document_view.xml 2012-12-24 14:19:23 +0000 @@ -167,7 +167,7 @@ <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)"/> + <field name="datas_fname" invisible="1"/> </xpath> <field name="url" position="after"> <field name="user_id"/>
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp