Hello
I need to move the attachment(At header) from (Purchase Agreement) to (RFQs) when creating new quotation
Thank you in advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello
I need to move the attachment(At header) from (Purchase Agreement) to (RFQs) when creating new quotation
Thank you in advance
on ir.attachment model, there is res_model and res_id field you have to change that
in your case res_model filed value change from 'purchase.requisition' to 'purchase.order' and res_id will change to your new RFQ record id
in where can i change the (res_model) and (res_id)
I added below code but odoo server error popup:
Record does not exist or has been deleted.
(Records: [204], User: 1)
rfq= self.env['purchase.order'].create({
'......':
'......':
})
attachment = self.env['ir.attachment'].search([('res_model','=','purchase.requisition'), ('res_id','=', self.id)])
self.env['ir.attachment'].create({
'name': attachment.name ,
'res_name': rfq.name,
'type': 'binary',
'datas': attachment.datas,
'res_model': 'purchase.order',
'res_id': rfq.id,
})
here you are creating new attachment. you should user write method instead of create
attachment.write({res_model': 'purchase.order', 'res_id': rfq.id,})
Thanks Ravi, Solved
Ravi, in case I need to generate_access_token?
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
2
Jan 20
|
3602 | ||
|
4
Dec 22
|
3400 | ||
|
0
Oct 21
|
1572 | ||
|
4
Mar 21
|
9067 | ||
|
2
Nov 17
|
5559 |