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

This commit is contained in:
Denis Roussel
2021-10-24 15:54:16 +02:00
parent 69c79ae07e
commit f1d53760cf
2 changed files with 20 additions and 14 deletions

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
)