Skip to content

Commit

Permalink
[REF] intrastat_product: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dreispt committed Sep 12, 2024
1 parent 81ebf57 commit 4f1734a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion intrastat_product/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion intrastat_product/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (

Check warning on line 154 in intrastat_product/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

intrastat_product/models/account_move.py#L154

Added line #L154 was not covered by tests
intrastat_line.hs_code_id or rec.product_id.get_hs_code_recursively()
Expand Down
8 changes: 5 additions & 3 deletions intrastat_product/models/intrastat_product_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def _gather_invoices(self, notedict):
"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 (
Expand Down Expand Up @@ -1191,7 +1191,8 @@ def _prepare_declaration_line(self, line_number):
+ 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,
Expand Down Expand Up @@ -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",
)
Expand Down
4 changes: 2 additions & 2 deletions intrastat_product/tests/common_purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def _check_line_values(self, final=False, declaration=None, purchase=None):
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())
Expand Down
4 changes: 2 additions & 2 deletions intrastat_product/tests/common_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ def _check_line_values(self, final=False, declaration=None, sale=None):
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())
Expand Down

0 comments on commit 4f1734a

Please sign in to comment.