[REF] intrastat_product: fix lint

This commit is contained in:
Daniel Reis
2024-09-12 07:17:11 +01:00
parent 81ebf571e4
commit 4f1734aa04
5 changed files with 12 additions and 9 deletions

View File

@@ -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",

View File

@@ -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()

View File

@@ -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",
)

View File

@@ -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())

View File

@@ -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())