From 4f1734aa04baf73cfa16db0a65a5fd6b6af64a8d Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Thu, 12 Sep 2024 07:17:11 +0100 Subject: [PATCH] [REF] intrastat_product: fix lint --- intrastat_product/__manifest__.py | 3 ++- intrastat_product/models/account_move.py | 2 +- intrastat_product/models/intrastat_product_declaration.py | 8 +++++--- intrastat_product/tests/common_purchase.py | 4 ++-- intrastat_product/tests/common_sale.py | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/intrastat_product/__manifest__.py b/intrastat_product/__manifest__.py index b205bfb..891d3ee 100644 --- a/intrastat_product/__manifest__.py +++ b/intrastat_product/__manifest__.py @@ -11,7 +11,8 @@ "category": "Intrastat", "license": "AGPL-3", "summary": "Base module for Intrastat Product", - "author": "ACSONE SA/NV, brain-tec AG, Akretion, Noviat, Odoo Community Association (OCA)", + "author": "ACSONE SA/NV, brain-tec AG, Akretion, Noviat" + ", Odoo Community Association (OCA)", "website": "https://github.com/OCA/intrastat-extrastat", "depends": [ "intrastat_base", diff --git a/intrastat_product/models/account_move.py b/intrastat_product/models/account_move.py index e25dddc..d135c83 100644 --- a/intrastat_product/models/account_move.py +++ b/intrastat_product/models/account_move.py @@ -149,7 +149,7 @@ class AccountMoveLine(models.Model): def _compute_hs_code_id(self): for rec in self: intrastat_line = self.move_id.intrastat_line_ids.filtered( - lambda r: r.invoice_line_id == rec + lambda r, rec=rec: r.invoice_line_id == rec ) rec.hs_code_id = ( intrastat_line.hs_code_id or rec.product_id.get_hs_code_recursively() diff --git a/intrastat_product/models/intrastat_product_declaration.py b/intrastat_product/models/intrastat_product_declaration.py index 0c18276..70925a1 100644 --- a/intrastat_product/models/intrastat_product_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -601,7 +601,7 @@ class IntrastatProductDeclaration(models.Model): "line_nbr": line_nbr, } inv_intrastat_line = invoice.intrastat_line_ids.filtered( - lambda r: r.invoice_line_id == inv_line + lambda r, inv_line=inv_line: r.invoice_line_id == inv_line ) if ( @@ -1191,7 +1191,8 @@ class IntrastatProductComputationLine(models.Model): + computation_line["amount_accessory_cost_company_currency"] ) # on computation lines, weight and suppl_unit_qty are floats - # on declaration lines, weight and suppl_unit_qty are integer => so we must round() + # on declaration lines, weight and suppl_unit_qty + # are integer => so we must round() for field in fields_to_sum: vals[field] = int(round(vals[field])) # the intrastat specs say that, if the value is between 0 and 0.5, @@ -1266,7 +1267,8 @@ class IntrastatProductDeclarationLine(models.Model): product_origin_country_code = fields.Char( string="Country of Origin of the Product", size=2, - help="2 letters ISO code of the country of origin of the product except for the UK.\n" + help="2 letters ISO code of the country of origin of the product" + " except for the UK.\n" "Specify 'XI' for Northern Ireland and 'XU' for Great Britain.\n" "Specify 'QU' when the country is unknown.\n", ) diff --git a/intrastat_product/tests/common_purchase.py b/intrastat_product/tests/common_purchase.py index 2133e94..cc2d0a3 100644 --- a/intrastat_product/tests/common_purchase.py +++ b/intrastat_product/tests/common_purchase.py @@ -33,14 +33,14 @@ class IntrastatPurchaseCommon(IntrastatProductCommon): for line in purchase.order_line: expected_vals = self._get_expected_vals(line) comp_line = declaration.computation_line_ids.filtered( - lambda cline: cline.product_id == line.product_id + lambda x, line=line: x.product_id == line.product_id ) self.assertTrue( all(comp_line[key] == val for key, val in expected_vals.items()) ) if final: decl_line = declaration.declaration_line_ids.filtered( - lambda dline: comp_line in dline.computation_line_ids + lambda x, comp_line=comp_line: comp_line in x.computation_line_ids ) self.assertTrue( all(decl_line[key] == val for key, val in expected_vals.items()) diff --git a/intrastat_product/tests/common_sale.py b/intrastat_product/tests/common_sale.py index 875c33d..9282ebe 100644 --- a/intrastat_product/tests/common_sale.py +++ b/intrastat_product/tests/common_sale.py @@ -31,14 +31,14 @@ class IntrastatSaleCommon(IntrastatProductCommon): for line in sale.order_line: expected_vals = self._get_expected_vals(line) comp_line = declaration.computation_line_ids.filtered( - lambda cline: cline.product_id == line.product_id + lambda x, line=line: x.product_id == line.product_id ) self.assertTrue( all(comp_line[key] == val for key, val in expected_vals.items()) ) if final: decl_line = declaration.declaration_line_ids.filtered( - lambda dline: comp_line in dline.computation_line_ids + lambda x, comp_line=comp_line: comp_line in x.computation_line_ids ) self.assertTrue( all(decl_line[key] == val for key, val in expected_vals.items())