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

I have selected partner and I have field invoice_ids. when I click add object I want that only invoices of partner, parent and all his child_ids invoice would be loaded. I tried to add the domain as you see above but I get an error

Uncaught Error: AttributeError: object has no attribute 'parent_id'

and I tried it without domain but with onchange but problem is that when i create record and chose partner onchnage starts to work but the is no partner_id yet when i select partner it's still no partner because it is not saved.. so need some help here.

'invoice_ids': fields.many2many(
            'account.invoice', 'cash_receipt_invoce_rel',
            'cash_receipt_id', 'invoice_id', "Invoices", 
            domain="[('partner_id','in', partner_id.parent_id.child_ids)]",

def onchange_field_id(self, cr, uid, ids, name, context=None):
    cash_rep = self.browse(cr,uid, ids,context=context)
    relation_ids = [x.id for x in cash_rep.partner_id.child_ids]
    return {'domain': {'invoice_ids': [('partner_id', 'in', relation_ids)]}}
아바타
취소
관련 게시물 답글 화면 활동
1
5월 21
3288
0
7월 20
3640
2
1월 18
4482
1
8월 24
3204
1
2월 24
2354