From 1561c870ae6abbd6440e1b59ec835f5863e46f59 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Fri, 31 Dec 2021 16:20:45 +0100 Subject: [PATCH] [13.0]intrastat_product - fix amount_company_currency --- intrastat_product/models/intrastat_product_declaration.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/intrastat_product/models/intrastat_product_declaration.py b/intrastat_product/models/intrastat_product_declaration.py index b48d8da..88c02c7 100644 --- a/intrastat_product/models/intrastat_product_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -474,7 +474,7 @@ class IntrastatProductDeclaration(models.Model): ("state", "=", "posted"), ("intrastat_country", "=", True), ("company_id", "=", self.company_id.id), - ("type", "!=", "entry"), + ("type", "in", ("out_invoice", "out_refund", "in_invoice", "in_refund")), ] return domain @@ -597,7 +597,9 @@ class IntrastatProductDeclaration(models.Model): ) total_inv_weight += weight - amount_company_currency = -inv_line.balance + sign = invoice.type in ("in_invoice", "out_refund") and 1 or -1 + amount_company_currency = sign * inv_line.balance + total_inv_product_cc += amount_company_currency if inv_intrastat_line: