← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 753286] Re: [5.0] Copy of ir_attachment

 

Hello Ignacio,

I think you may have passed the id in wrong manner just check out the
following piece of code and try to implement it again at your end.

                attachment = {'res_model': 'purchase.order.line', 'res_id': get_first_po_line.id}
                new_id = self.pool.get('ir.attachment').copy(cr, uid, po_line.attachment_id.id, attachment, context=context)

Instead of this po_line.attachment_id.id, you can pass any of ids.

If you still face the same problem then please give the whole traceback
with debug_rpc mode and also the whole piece of code i.e the arguments
which you were tried to pass in the copy method.

Thanks.

** Changed in: openobject-server
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/753286

Title:
  [5.0] Copy of ir_attachment

Status in OpenERP Server:
  Incomplete

Bug description:
  An error is thrown when duplicating an attachment using
  self.pool.get('ir.attachment').copy( ... )

  Reason being the list of ids passed to the method gets "over
  bracketed" and therefore the select query throws an exception

  I attach some logs I added to the code for debuggin purposes

  First I list some logs I get when calling to self.pool.get('ir.attachment').search (this method works fine)
   [2011-04-07 10:12:57,002] ESC[32mESC[49mINFOESC[0m:ir_attachment.read:[3, 7]
   [2011-04-07 10:12:57,003] ESC[32mESC[49mINFOESC[0m:ir_attachment.check:begin
   [2011-04-07 10:12:57,003] ESC[32mESC[49mINFOESC[0m:ir_attachment.check:3,7
   [2011-04-07 10:12:57,004] ESC[32mESC[49mINFOESC[0m:ir_attachment.check:end

  Now the logs I get when making a call to the copy method (exception thrown)
   [2011-04-07 10:12:57,006] ESC[32mESC[49mINFOESC[0m:ir_attachment.read:[[3, 7]]
   [2011-04-07 10:12:57,006] ESC[32mESC[49mINFOESC[0m:ir_attachment.check:begin
   [2011-04-07 10:12:57,006] ESC[32mESC[49mINFOESC[0m:ir_attachment.check:[3, 7]
   ...
   [2011-04-07 10:12:57,308] ESC[31mESC[49mERRORESC[0m:web-services:[74]: PrNEA 1: ...t distinct res_model from ir_attachment where id in ([3, 7])

  I'm using openERP 5.0.10 on Ubuntu

  Kind Regards



References