diff --git a/easy_my_coop/models/partner.py b/easy_my_coop/models/partner.py index 613b04c..f579766 100644 --- a/easy_my_coop/models/partner.py +++ b/easy_my_coop/models/partner.py @@ -52,16 +52,23 @@ class ResPartner(models.Model): account_invoice_report._apply_ir_rules(where_query, "read") from_clause, where_clause, where_clause_params = where_query.get_sql() - # price_total is in the company currency + # fixme while you're here, please fix the query + # to pass pylint sql-injection + # Note de Houssine: note que c'est la + # surcharge d'une fonction standard de la facturation Odoo. Elle + # date de la 9 voir si la v12 a été adaptée où est équivalente à la 12 + # price_total is in the company currency pylint: + # pylint: disable=sql-injection query = ( """ - SELECT SUM(price_total) as total, partner_id - FROM account_invoice_report account_invoice_report - WHERE %s - GROUP BY partner_id + SELECT SUM(price_total) as total, partner_id + FROM account_invoice_report account_invoice_report + WHERE %s + GROUP BY partner_id """ % where_clause ) + self.env.cr.execute(query, where_clause_params) price_totals = self.env.cr.dictfetchall() for partner, child_ids in all_partners_and_children.items(): diff --git a/easy_my_coop_taxshelter_report/README.rst b/easy_my_coop_taxshelter_report/README.rst index a028fec..4351a26 100644 --- a/easy_my_coop_taxshelter_report/README.rst +++ b/easy_my_coop_taxshelter_report/README.rst @@ -27,6 +27,13 @@ tax shelter declaration for each cooperator. .. contents:: :local: +Development +=========== + +Do not implement tests before fixing the direct use of self.env.cr.commit() +in models.tax_shelter_declaration + + Bug Tracker =========== diff --git a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py index c31116b..de1e921 100644 --- a/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py +++ b/easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py @@ -322,6 +322,19 @@ class TaxShelterCertificate(models.Model): certificate.state = "sent" else: certificate.state = "no_eligible" + # pylint: disable=invalid-commit + # fixme while you're here, please fix the query + # to pass pylint invalid-commit + # Use of cr.commit() directly is dangerous + # More info https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#never-commit-the-transaction # noqa + + # Note: c'est n'est pas executé par du rpc-client mais via un + # cron. En sachant que l'on ne veut pas faire de roll back de + # toute la transaction parce que justement des mails sont + # envoyés. Et on ne peut pas rollbacker des emails envoyés ici + # c'est un rollback qui rendre le processus métier inconsistant + # sachant que chaque ligne à son propre état et est indépendante + # du statut de la déclaration tax shelter dont elle dépend self.env.cr.commit() @api.multi diff --git a/easy_my_coop_taxshelter_report/readme/DEVELOP.rst b/easy_my_coop_taxshelter_report/readme/DEVELOP.rst new file mode 100644 index 0000000..6b9afd1 --- /dev/null +++ b/easy_my_coop_taxshelter_report/readme/DEVELOP.rst @@ -0,0 +1,2 @@ +Do not implement tests before fixing the direct use of self.env.cr.commit() +in models.tax_shelter_declaration diff --git a/easy_my_coop_taxshelter_report/static/description/index.html b/easy_my_coop_taxshelter_report/static/description/index.html index 9b3b9d9..44fe7ac 100644 --- a/easy_my_coop_taxshelter_report/static/description/index.html +++ b/easy_my_coop_taxshelter_report/static/description/index.html @@ -373,17 +373,23 @@ tax shelter declaration for each cooperator.

Table of contents

+
+

Development

+

Do not implement tests before fixing the direct use of self.env.cr.commit() +in models.tax_shelter_declaration

+
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed @@ -391,21 +397,21 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is part of the coopiteasy/vertical-cooperative project on GitHub.

You are welcome to contribute.

diff --git a/easy_my_coop_taxshelter_report/tests/tests.txt b/easy_my_coop_taxshelter_report/tests/tests.txt new file mode 100644 index 0000000..6b9afd1 --- /dev/null +++ b/easy_my_coop_taxshelter_report/tests/tests.txt @@ -0,0 +1,2 @@ +Do not implement tests before fixing the direct use of self.env.cr.commit() +in models.tax_shelter_declaration diff --git a/partner_age/models/partner.py b/partner_age/models/partner.py index d7ea53a..9a91a63 100644 --- a/partner_age/models/partner.py +++ b/partner_age/models/partner.py @@ -10,6 +10,9 @@ class ResPartner(models.Model): def _search_age(self, operator, value): if operator not in ("=", "!=", "<", "<=", ">", ">=", "in", "not in"): return [] + # pylint: disable=sql-injection + # fixme while you're here, please fix the query to pass + # pylint sql-injection query = """SELECT id FROM "%s" WHERE extract(year from age(CURRENT_DATE,