Nehal Panchal (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/6.1-opw-579669-nep into 
lp:openobject-server/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.1-opw-579669-nep/+merge/126935

Hello,

While creating an attachment by OpenERP, directory specified with resource 
model should be considered.

Steps to reproduce:
1. Create a directory with resource model for example:Invoice.
2. When you print Invoice report, attachment will be created with Document 
directory which is wrong.

This fixes the issue.

Thanks
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/6.1-opw-579669-nep/+merge/126935
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/6.1-opw-579669-nep.
=== modified file 'openerp/addons/base/ir/ir_attachment.py'
--- openerp/addons/base/ir/ir_attachment.py	2012-08-21 14:16:05 +0000
+++ openerp/addons/base/ir/ir_attachment.py	2012-09-28 11:45:28 +0000
@@ -122,6 +122,10 @@
         return super(ir_attachment, self).unlink(cr, uid, ids, context)
 
     def create(self, cr, uid, values, context=None):
+        if 'parent_id' in values and context.get('active_model'):
+            parent_ids_updated = self.pool.get('document.directory').search(cr, uid, [('ressource_type_id','=',context.get('active_model'))])
+            if parent_ids_updated:
+                values.update(parent_id=parent_ids_updated[0])        
         self.check(cr, uid, [], mode='create', context=context, values=values)
         return super(ir_attachment, self).create(cr, uid, values, context)
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to