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

hi, i am trying to transfer data from a few selected cases in a customized model called 'x_case' at tree view to account.invoice, by using server action.  From sample code, it has created case model and case_line model and transfer the data to invoice model and invoice_line model.  While i tried to avoid the case_line for my own purpose.  however, i've got the attribute error. i've browsed around and cannot find the right solution.   Can you please help? i am new to python and coding. 


ValueError: <class 'AttributeError'>: "'x_case' object has no attribute 'x_case'" while evaluating


case_lines=[] 

for case_line in record.x_case:

  case_lines.append([0,0,{

    'x_studio_case':case_line.x_studio_case_id,

    'x_studio_business_unit': case_line.x_studio_billing_centre,

    'product_id':case_line.x_studio_field_8Cfba.id,

    'name':case_line.x_studio_third_party_name_1,

    'x_studio_billing_details':case_line.x_studio_billing_details,

    'quantity':1,

    'price_unit': case_line.x_studio_price,

    'account_id': record.x_studio_field_8Cfba.property_account_income_id.id

  }]) 

env ['account.invoice'].create({

  'partner_id':record.x_studio_field_hry7Z.id,

  'currency_id':record.x_currency_id.id,

  'invoice_line_ids':case_lines

})


아바타
취소
작성자 베스트 답변

i have updated to records and its working now. However, i cannot group the case lines into 1 invoice.  What should i change? 

case_lines=[] 

for case_line in records:

  case_lines.append([0,0,{

    'x_studio_case':case_line.x_studio_case_id,

    'x_studio_business_unit': case_line.x_studio_billing_centre,

    'product_id':case_line.x_studio_field_8Cfba.id,

    'name':case_line.x_studio_third_party_name_1,

    'x_studio_billing_details':case_line.x_studio_billing_details,

    'quantity':1,

    'price_unit': case_line.x_studio_price,

    'account_id': case_line.x_studio_field_8Cfba.property_account_income_id.id

  }]) 

env ['account.invoice'].create({

  'partner_id':records.x_studio_field_hry7Z[0].id,

  'currency_id':records.x_currency_id[0].id,

  'invoice_line_ids':case_lines

})

아바타
취소
관련 게시물 답글 화면 활동
1
12월 24
3069
0
11월 24
1292
2
7월 24
2647
0
4월 24
1840
3
3월 24
1620