From 4d3286c0b4f8484f501419b03be99cfb801c0ff2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Marques?=
Date: Thu, 18 Feb 2021 13:13:23 +0000
Subject: [PATCH] [FIX] intrastat_product: Missed changes in migration
Change back from invoice.type to invoice.move_type
Update method signature and calls after the refactor in "intrastat.product.declaration"
Add some docs to explain the functionality that leads to this part of the code.
TT28080
[UPD] README.rst
intrastat_product 14.0.1.0.1
---
intrastat_product/README.rst | 6 ++++++
intrastat_product/__manifest__.py | 2 +-
intrastat_product/models/account_move.py | 13 +++++++++++--
intrastat_product/readme/USAGE.rst | 6 ++++++
intrastat_product/static/description/index.html | 6 ++++++
5 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/intrastat_product/README.rst b/intrastat_product/README.rst
index 28a2020..99de851 100644
--- a/intrastat_product/README.rst
+++ b/intrastat_product/README.rst
@@ -102,6 +102,12 @@ and adapt the code for the specific needs of your country.
Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code.
+**Other functionality added by this module:**
+
+* Compute the Intrastat Lines in an invoice.
+ For this, your user needs to be in the "Technical / Invoice Intrastat Transaction Details" group.
+ Go to the "Intrastat transaction details" tab and press **Compute**
+
Known issues / Roadmap
======================
diff --git a/intrastat_product/__manifest__.py b/intrastat_product/__manifest__.py
index 4c7c415..c9aafc4 100644
--- a/intrastat_product/__manifest__.py
+++ b/intrastat_product/__manifest__.py
@@ -7,7 +7,7 @@
{
"name": "Intrastat Product",
- "version": "14.0.1.0.0",
+ "version": "14.0.1.0.1",
"category": "Intrastat",
"license": "AGPL-3",
"summary": "Base module for Intrastat Product",
diff --git a/intrastat_product/models/account_move.py b/intrastat_product/models/account_move.py
index 256cffb..90f2d0c 100644
--- a/intrastat_product/models/account_move.py
+++ b/intrastat_product/models/account_move.py
@@ -65,7 +65,12 @@ class AccountMove(models.Model):
"""
self.mapped("intrastat_line_ids").unlink()
for inv in self:
- if inv.type not in ("out_invoice", "out_refund", "in_invoice", "in_refund"):
+ if inv.move_type not in (
+ "out_invoice",
+ "out_refund",
+ "in_invoice",
+ "in_refund",
+ ):
continue
line_vals = []
for line in inv.invoice_line_ids:
@@ -77,12 +82,16 @@ class AccountMove(models.Model):
def _get_intrastat_line_vals(self, line):
vals = {}
+ notedict = {
+ "note": "",
+ "line_nbr": 0,
+ }
decl_model = self.env["intrastat.product.declaration"]
if decl_model._is_product(line):
hs_code = line.product_id.get_hs_code_recursively()
if not hs_code:
return vals
- weight, qty = decl_model._get_weight_and_supplunits(line, hs_code)
+ weight, qty = decl_model._get_weight_and_supplunits(line, hs_code, notedict)
vals.update(
{
"invoice_line_id": line.id,
diff --git a/intrastat_product/readme/USAGE.rst b/intrastat_product/readme/USAGE.rst
index 66ec809..f761637 100644
--- a/intrastat_product/readme/USAGE.rst
+++ b/intrastat_product/readme/USAGE.rst
@@ -31,3 +31,9 @@ and adapt the code for the specific needs of your country.
* XML Files: Menu, Action, Views
Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code.
+
+**Other functionality added by this module:**
+
+* Compute the Intrastat Lines in an invoice.
+ For this, your user needs to be in the "Technical / Invoice Intrastat Transaction Details" group.
+ Go to the "Intrastat transaction details" tab and press **Compute**
diff --git a/intrastat_product/static/description/index.html b/intrastat_product/static/description/index.html
index 58bd746..793da6e 100644
--- a/intrastat_product/static/description/index.html
+++ b/intrastat_product/static/description/index.html
@@ -444,6 +444,12 @@ the customization or new method is required for multiple countries).
Cf. l10n_be_istrastat_product as example, replace “be” by your Country Code.
+Other functionality added by this module:
+
+- Compute the Intrastat Lines in an invoice.
+For this, your user needs to be in the “Technical / Invoice Intrastat Transaction Details” group.
+Go to the “Intrastat transaction details” tab and press Compute
+