[14.0][IMP] intrastat_product: Add hook for test values

intrastat_product 14.0.1.4.0
This commit is contained in:
Denis Roussel
2021-10-24 15:54:16 +02:00
committed by Víctor Martínez
parent afcb5530f8
commit 7e6e7226d5
3 changed files with 21 additions and 15 deletions

View File

@@ -7,7 +7,7 @@
{
"name": "Intrastat Product",
"version": "14.0.1.3.0",
"version": "14.0.1.4.0",
"category": "Intrastat",
"license": "AGPL-3",
"summary": "Base module for Intrastat Product",

View File

@@ -11,6 +11,16 @@ class IntrastatPurchaseCommon(IntrastatProductCommon):
- Supplier in Germany
"""
def _get_expected_vals(self, line):
return {
"declaration_type": "arrivals",
"suppl_unit_qty": line.qty_received,
"hs_code_id": line.product_id.hs_code_id,
"product_origin_country_id": line.product_id.origin_country_id,
"amount_company_currency": line.price_subtotal,
"src_dest_country_id": line.partner_id.country_id,
}
def _check_line_values(self, final=False, declaration=None, purchase=None):
"""
This method allows to test computation lines and declaration
@@ -21,14 +31,7 @@ class IntrastatPurchaseCommon(IntrastatProductCommon):
if purchase is None:
purchase = self.purchase
for line in purchase.order_line:
expected_vals = {
"declaration_type": "arrivals",
"suppl_unit_qty": line.qty_received,
"hs_code_id": line.product_id.hs_code_id,
"product_origin_country_id": line.product_id.origin_country_id,
"amount_company_currency": line.price_subtotal,
"src_dest_country_id": line.partner_id.country_id,
}
expected_vals = self._get_expected_vals(line)
comp_line = declaration.computation_line_ids.filtered(
lambda cline: cline.product_id == line.product_id
)

View File

@@ -11,6 +11,14 @@ class IntrastatSaleCommon(IntrastatProductCommon):
- Customer in Netherlands
"""
def _get_expected_vals(self, line):
return {
"declaration_type": "dispatches",
"suppl_unit_qty": line.qty_delivered,
"hs_code_id": line.product_id.hs_code_id,
"product_origin_country_id": line.product_id.origin_country_id,
}
def _check_line_values(self, final=False, declaration=None, sale=None):
"""
This method allows to test computation lines and declaration
@@ -21,12 +29,7 @@ class IntrastatSaleCommon(IntrastatProductCommon):
if sale is None:
sale = self.sale
for line in sale.order_line:
expected_vals = {
"declaration_type": "dispatches",
"suppl_unit_qty": line.qty_delivered,
"hs_code_id": line.product_id.hs_code_id,
"product_origin_country_id": line.product_id.origin_country_id,
}
expected_vals = self._get_expected_vals(line)
comp_line = declaration.computation_line_ids.filtered(
lambda cline: cline.product_id == line.product_id
)