title: how to the ir.attachment list to a partner view in odoo version 7
body: <p>I would like to make it easy to add attachments to the <code>res.partner</code> model in my views. As a result, I've figured out that I can extend the <code>res.partner</code> model easily with a many2many field to <code>ir.attachment</code>.</p>
  
  <pre><code>_columns = {
      'attachments': fields.many2many('ir.attachment', string="Attachments")
  }
  </code></pre>
  
  <p>Now when I add this field to my view I see the list of attachments, but I have 2 problems with this simple many2many widget.</p>
  
  <ol>
  <li>I need too many clicks to get a new file attached. First, it opens the many2many cross table where I could select already uploaded documents. Second, I can open the upload view. The intermediate screen is obviously not needed for me, as this view is used to create new partners, thus the already uploaded files will never be re-used.</li>
  <li>I would like the upload view to have its relational fields filled out. These fields are res_model=res.partner, res_id= and partner_id=.</li>
  </ol>
  
  <p>I don't have any ideas on how to get rid of the first, intermediate view problem outlined below.</p>
  
  <p>I've had an idea on how to solve the second problem, to pre-fill out the upload view's data. I wrote this in my view xml</p>
  
  <pre><code>&lt;field name="attachments" 
      context="{'default_res_model': 'res.partner', 'default_res_id': active_id, 'default_partner_id': active_id}"/&gt;
  </code></pre>
  
  <p>Unfortunately, this does not work, as <code>active_id=0</code>, instead of it being active with the new resource id (this might not even exist?).</p>
  
  <p>Do you have any idea on (1) how to get an immediate upload view and (2) how to get the new record's id into the upload view?</p>