2017-12-12 8 views
0

VAT가있는 제품에 새로운 인보이스 통화를 추가 한 후 인보이스를 저장하면 총 부가가치세 금액이 자동으로 업데이트되지 않습니다.인보이스 저장 세금 갱신 금액

인보이스가 저장 될 때 자동으로 세금 계산 방법이 있습니까?

왜 네이티브 동작이 아닌가요?

어떤 도움이 많이

건배

답변

0
amount_untaxed = fields.Monetary(string='Untaxed Amount', 
    store=True, readonly=True, compute='_compute_amount', track_visibility='always') 
amount_tax = fields.Monetary(string='Tax', 
    store=True, readonly=True, compute='_compute_amount') 
amount_total = fields.Monetary(string='Total', 
    store=True, readonly=True, compute='_compute_amount') 

@api.one 
@api.depends('invoice_line_ids.price_subtotal', 'tax_line_ids.amount', 'currency_id', 'company_id', 'date_invoice', 'type') 
def _compute_amount(self): 
    round_curr = self.currency_id.round 
    self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line_ids) 
    self.amount_tax = sum(round_curr(line.amount) for line in self.tax_line_ids) 
    self.amount_total = self.amount_untaxed + self.amount_tax 

당신이 account.invoice 기본 모듈을 볼 수 있습니다을 이해할 수있을 것이다. 생성하는 동안 항상 레코드를 업데이트하십시오. 사용자 정의 모듈에서 create 메소드에서 위와 같이 레코드를 업데이트하십시오.

+0

다음과 같이 코드를 지나치게하지 마십시오. 설명해주십시오. – Cherif