2017-10-23 20 views
1

분석 항목을 생성하기 위해 통화와 관련 금액 라인을 원합니다.통화와 관련된 금액의 관계

@api.multi 
def action_test(self): 
    for order in self: 
     for line in order.order_line: 
      amount = (self.credit or 0.0) - (self.debit or 0.0) 
      if line.account_analytic_id: 
       vals_line= { 
        'name': line.name, 
        'date': order.date_order, 
        'account_id': line.account_analytic_id.id, 
        'tag_ids': [(6, 0, line.analytic_tag_ids.ids)], 
        'unit_amount': line.product_qty, 
        'product_id': line.product_id and line.product_id.id or False, 
        'amount': order.company_currency_id.with_context(date=order.date_order or fields.Date.context_today(self)).compute(amount, line.account_analytic_id.currency_id) if line.account_analytic_id.currency_id else amount, 
        #'general_account_id': self.account_id.id, 
        #'ref': order.ref, 
        'move_id': line.id, 
        #'user_id': order.invoice_id.user_id.id or self._uid, 
       } 
       self.env['account.analytic.line'].create(vals_line) 

답변

3

다음 해당 필드를 금액 유사한 빈 필드 (부동 소수점 또는 정수)를 추가 시도 :

vals_line = { 
'amount' : line.amount 
} 
1

당신은 시도 할 수 있습니다 : 당신이 금액을 반환하려면

vals_line= { 
    'currency_id': line.currency_id 
     } 
+0

안녕하세요, 어떻게 두 줄의 구매 라인과 인보이스 라인 비교 –