[MERGE] forward port of branch 7.0 up to 9b1cdea
authorChristophe Simonis <chs@odoo.com>
Fri, 12 Sep 2014 15:28:55 +0000 (17:28 +0200)
committerChristophe Simonis <chs@odoo.com>
Fri, 12 Sep 2014 15:28:55 +0000 (17:28 +0200)
1  2 
addons/hr_expense/hr_expense.py
addons/l10n_ro/res_partner.py
addons/mrp_repair/mrp_repair.py
addons/stock/wizard/stock_return_picking.py
addons/survey/wizard/survey_answer.py
addons/web/static/src/js/chrome.js
addons/web/static/src/js/data.js
openerp/addons/base/ir/ir_mail_server.py
openerp/osv/orm.py

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -3737,8 -4089,15 +3738,15 @@@ class BaseModel(object)
              if ir_value_ids:
                  ir_values_obj.unlink(cr, uid, ir_value_ids, context=context)
  
+             # For the same reason, removing the record relevant to ir_attachment
+             # The search is performed with sql as the search method of ir_attachment is overridden to hide attachments of deleted records
+             cr.execute('select id from ir_attachment where res_model = %s and res_id in %s', (self._name, sub_ids))
+             ir_attachment_ids = [ir_attachment[0] for ir_attachment in cr.fetchall()]
+             if ir_attachment_ids:
+                 ir_attachment_obj.unlink(cr, uid, ir_attachment_ids, context=context)
 -        for order, object, store_ids, fields in result_store:
 -            if object == self._name:
 +        for order, obj_name, store_ids, fields in result_store:
 +            if obj_name == self._name:
                  effective_store_ids = list(set(store_ids) - set(ids))
              else:
                  effective_store_ids = store_ids