From a6e331019e7a7c36ee6f33074132d4ac1cdc799e Mon Sep 17 00:00:00 2001 From: Anjeel Haria Date: Mon, 16 Dec 2024 18:53:12 +0530 Subject: [PATCH] pre-commit changes and test script fixes --- .../models/account_move_line.py | 4 ++-- .../models/res_currency_rate_provider_CoinGecko.py | 6 +++--- .../tests/test_currency_rate_update_coingecko.py | 8 +++----- .../models/res_currency_rate_provider_mapping.py | 4 +++- .../tests/test_l10n_nl_rgs_mis_report.py | 2 +- membership_activity/models/project_project.py | 2 +- membership_activity_github/README.md | 4 ++-- membership_activity_gitlab/README.md | 4 ++-- sale_recurring_payment_mollie/models/mollie_payment.py | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/account_partner_default_account/models/account_move_line.py b/account_partner_default_account/models/account_move_line.py index 630a373..f827c0d 100644 --- a/account_partner_default_account/models/account_move_line.py +++ b/account_partner_default_account/models/account_move_line.py @@ -11,8 +11,8 @@ class AccountMoveLine(models.Model): def _compute_account_id(self): res = super()._compute_account_id() for line in self.filtered( - lambda l: l.display_type not in ("line_section", "line_note") - and l.move_id.is_invoice() + lambda ml: ml.display_type not in ("line_section", "line_note") + and ml.move_id.is_invoice() ): partner = line.move_id.partner_id if partner and partner.partner_default_account_id: diff --git a/currency_rate_update_coingecko/models/res_currency_rate_provider_CoinGecko.py b/currency_rate_update_coingecko/models/res_currency_rate_provider_CoinGecko.py index 3733951..e14ca04 100644 --- a/currency_rate_update_coingecko/models/res_currency_rate_provider_CoinGecko.py +++ b/currency_rate_update_coingecko/models/res_currency_rate_provider_CoinGecko.py @@ -1,7 +1,7 @@ # Copyright 2024 Onestein # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import logging -from datetime import date, timedelta +from datetime import timedelta from pycgapi import CoinGeckoAPI @@ -36,7 +36,7 @@ def _obtain_rates(self, base_currency, currencies, date_from, date_to): return super()._obtain_rates(base_currency, currencies, date_from, date_to) return self._get_historical_rate_from_coingecko( date_from, date_to, base_currency - ) + ) def _get_historical_rate_from_coingecko(self, date_from, date_to, base_currency): """Get all the exchange rates from 'date_from' to 'date_to'""" @@ -48,7 +48,7 @@ def _get_historical_rate_from_coingecko(self, date_from, date_to, base_currency) for ( currency ) in self.currency_ids.res_currency_rate_provider_mapping_ids.filtered( - lambda l: l.provider_service == self.service + lambda rpm: rpm.provider_service == self.service ): try: coin_data = api.coin_historical_on_date( diff --git a/currency_rate_update_coingecko/tests/test_currency_rate_update_coingecko.py b/currency_rate_update_coingecko/tests/test_currency_rate_update_coingecko.py index 6735157..0cbf37a 100644 --- a/currency_rate_update_coingecko/tests/test_currency_rate_update_coingecko.py +++ b/currency_rate_update_coingecko/tests/test_currency_rate_update_coingecko.py @@ -30,10 +30,6 @@ def setUpClass(cls): } ) cls.lnk_currency = cls.Currency.create({"name": "LINK", "symbol": "LNK"}) - cls.coingecko_provider = cls.CurrencyRateProvider.search( - [("service", "=", "CoinGecko")], limit=1 - ) - cls.coingecko_provider.company_id = cls.company.id cls.coingecko_provider_mapping = cls.CurrencyRateProviderMapping.create( { "currency_id": cls.lnk_currency.id, @@ -41,8 +37,10 @@ def setUpClass(cls): "provider_reference": "chainlink", } ) - cls.coingecko_provider.write( + cls.coingecko_provider = cls.CurrencyRateProvider.create( { + "service": "CoinGecko", + "company_id": cls.company.id, "currency_ids": [ (4, cls.lnk_currency.id), ], diff --git a/currency_rate_update_mapping/models/res_currency_rate_provider_mapping.py b/currency_rate_update_mapping/models/res_currency_rate_provider_mapping.py index afbf5d6..44023b8 100644 --- a/currency_rate_update_mapping/models/res_currency_rate_provider_mapping.py +++ b/currency_rate_update_mapping/models/res_currency_rate_provider_mapping.py @@ -12,7 +12,9 @@ class ResCurrencyRateProviderMapping(models.Model): comodel_name="res.currency", ) provider_service = fields.Selection( - selection=lambda r: r.env["res.currency.rate.provider"]._fields["service"].selection, + selection=lambda r: r.env["res.currency.rate.provider"] + ._fields["service"] + .selection, string="Provider", required=True, ) diff --git a/l10n_nl_rgs_mis_report/tests/test_l10n_nl_rgs_mis_report.py b/l10n_nl_rgs_mis_report/tests/test_l10n_nl_rgs_mis_report.py index 5d27499..074bb70 100644 --- a/l10n_nl_rgs_mis_report/tests/test_l10n_nl_rgs_mis_report.py +++ b/l10n_nl_rgs_mis_report/tests/test_l10n_nl_rgs_mis_report.py @@ -17,7 +17,7 @@ def test_01_rgs_balance_sheet(self): def test_02_rgs_profit_loss(self): """""" - report = "l10n_nl_rgs_mis_report.mis_report_l10n_nl_rgs_profit_loss" + report = "l10n_nl_rgs_mis_report.mis_report_l10n_nl_rgs_pl" instance = self.env["mis.report.instance"].create( { "name": "Profit Loss", diff --git a/membership_activity/models/project_project.py b/membership_activity/models/project_project.py index 17f6307..99acc4e 100644 --- a/membership_activity/models/project_project.py +++ b/membership_activity/models/project_project.py @@ -39,7 +39,7 @@ def _compute_last_membership_activity_date(self): def get_last_membership_activity_date_by_type(self, type_id_or_xml_id): self.ensure_one() activity_type_id = type_id_or_xml_id - if type(type_id_or_xml_id) == str: + if isinstance(type_id_or_xml_id, str): activity_type_id = self.env.ref(type_id_or_xml_id).id matching_activities = self.membership_activity_ids.filtered( lambda a: a.type_id.id == activity_type_id diff --git a/membership_activity_github/README.md b/membership_activity_github/README.md index 1443a4c..30449ef 100644 --- a/membership_activity_github/README.md +++ b/membership_activity_github/README.md @@ -1,8 +1,8 @@ # Installation -``` +````````````````````````````` pip3 install PyGithub==1.59.0 -``` +````````````````````````````` # Configure diff --git a/membership_activity_gitlab/README.md b/membership_activity_gitlab/README.md index 14be753..7620286 100644 --- a/membership_activity_gitlab/README.md +++ b/membership_activity_gitlab/README.md @@ -1,8 +1,8 @@ # Installation -``` +`````````````````````````` pip3 install python-gitlab -``` +`````````````````````````` # Configure diff --git a/sale_recurring_payment_mollie/models/mollie_payment.py b/sale_recurring_payment_mollie/models/mollie_payment.py index 4e077cc..280391a 100644 --- a/sale_recurring_payment_mollie/models/mollie_payment.py +++ b/sale_recurring_payment_mollie/models/mollie_payment.py @@ -104,7 +104,7 @@ def auto_update_payments(self): payment_objs = self.sudo()._get_payment_obj(payment["id"]) if payment_objs: payment_obj = payment_objs.filtered( - lambda l: l.status + lambda po: po.status not in ["paid", "expired", "canceled", "failed"] ) if payment_obj and payment_obj.status != payment["status"]: