콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
7902 화면

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?



아바타
취소
관련 게시물 답글 화면 활동
2
1월 20
5158
4
12월 22
4729
0
10월 21
2784
4
3월 21
11177
2
11월 17
7103