mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
[14.0][IMP] intrastat_product: Add hook for test values
This commit is contained in:
@@ -11,6 +11,16 @@ class IntrastatPurchaseCommon(IntrastatProductCommon):
|
|||||||
- Supplier in Germany
|
- 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):
|
def _check_line_values(self, final=False, declaration=None, purchase=None):
|
||||||
"""
|
"""
|
||||||
This method allows to test computation lines and declaration
|
This method allows to test computation lines and declaration
|
||||||
@@ -21,14 +31,7 @@ class IntrastatPurchaseCommon(IntrastatProductCommon):
|
|||||||
if purchase is None:
|
if purchase is None:
|
||||||
purchase = self.purchase
|
purchase = self.purchase
|
||||||
for line in purchase.order_line:
|
for line in purchase.order_line:
|
||||||
expected_vals = {
|
expected_vals = self._get_expected_vals(line)
|
||||||
"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,
|
|
||||||
}
|
|
||||||
comp_line = declaration.computation_line_ids.filtered(
|
comp_line = declaration.computation_line_ids.filtered(
|
||||||
lambda cline: cline.product_id == line.product_id
|
lambda cline: cline.product_id == line.product_id
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,6 +11,14 @@ class IntrastatSaleCommon(IntrastatProductCommon):
|
|||||||
- Customer in Netherlands
|
- 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):
|
def _check_line_values(self, final=False, declaration=None, sale=None):
|
||||||
"""
|
"""
|
||||||
This method allows to test computation lines and declaration
|
This method allows to test computation lines and declaration
|
||||||
@@ -21,12 +29,7 @@ class IntrastatSaleCommon(IntrastatProductCommon):
|
|||||||
if sale is None:
|
if sale is None:
|
||||||
sale = self.sale
|
sale = self.sale
|
||||||
for line in sale.order_line:
|
for line in sale.order_line:
|
||||||
expected_vals = {
|
expected_vals = self._get_expected_vals(line)
|
||||||
"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,
|
|
||||||
}
|
|
||||||
comp_line = declaration.computation_line_ids.filtered(
|
comp_line = declaration.computation_line_ids.filtered(
|
||||||
lambda cline: cline.product_id == line.product_id
|
lambda cline: cline.product_id == line.product_id
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user