From 0449dbcbfb912f5ca04d69e95edcb53cf060d1b3 Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Tue, 27 Feb 2024 17:05:49 +0100 Subject: [PATCH] T0182 partner_communication_switzerland migration to 14.0 --- .gitignore | 3 + label/README.rst | 73 --- label/__init__.py | 9 - label/__manifest__.py | 45 -- label/data/report_paperformat.xml | 27 -- label/readme/CONTRIBUTORS.md | 2 - label/readme/DESCRIPTION.md | 3 - label/readme/INSTALL.md | 1 - label/readme/USAGE.md | 1 - label/reports/dynamic_label.xml | 25 - label/reports/one_label.xml | 46 -- label/static/description/index.html | 426 ------------------ label/static/src/css/label.css | 27 -- .../models/communication_config.py | 93 ++-- .../data/communication_config.xml | 11 +- .../data/depart_communications.xml | 31 -- .../models/contracts.py | 6 +- .../models/compassion_hold.py | 22 +- setup/label/odoo/addons/label | 1 - setup/label/setup.py | 6 - 20 files changed, 89 insertions(+), 769 deletions(-) delete mode 100644 label/README.rst delete mode 100644 label/__init__.py delete mode 100644 label/__manifest__.py delete mode 100644 label/data/report_paperformat.xml delete mode 100644 label/readme/CONTRIBUTORS.md delete mode 100644 label/readme/DESCRIPTION.md delete mode 100644 label/readme/INSTALL.md delete mode 100644 label/readme/USAGE.md delete mode 100644 label/reports/dynamic_label.xml delete mode 100644 label/reports/one_label.xml delete mode 100644 label/static/description/index.html delete mode 100644 label/static/src/css/label.css delete mode 120000 setup/label/odoo/addons/label delete mode 100644 setup/label/setup.py diff --git a/.gitignore b/.gitignore index 100dc95e1..335434320 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] +/.venv +/.pytest_cache +/.ruff_cache # C extensions *.so diff --git a/label/README.rst b/label/README.rst deleted file mode 100644 index 781497bbe..000000000 --- a/label/README.rst +++ /dev/null @@ -1,73 +0,0 @@ -==================== -Mass Label Reporting -==================== - -.. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:4dbcdf2e41f47594ef743d6cc9d584255deafc5f15167380f6ef57f58733e963 - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png - :target: https://odoo-community.org/page/development-status - :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-CompassionCH%2Fcompassion--modules-lightgray.png?logo=github - :target: https://github.com/CompassionCH/compassion-modules/tree/14.0/label - :alt: CompassionCH/compassion-modules - -|badge1| |badge2| |badge3| - -This module adds report_label and one_label report template to print a -QR code with informations of the partner and the child. The report -prints 3 columns and 11 rows of the QR + partner informations. - -**Table of contents** - -.. contents:: - :local: - -Installation -============ - - - -Usage -===== - - - -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 to smash it by providing a detailed and welcomed -`feedback `_. - -Do not contact contributors directly about support or help with technical issues. - -Credits -======= - -Authors -------- - -* Compassion CH - -Contributors ------------- - -- Emanuel Cino -- Simon Gonzalez - -Maintainers ------------ - -This module is part of the `CompassionCH/compassion-modules `_ project on GitHub. - -You are welcome to contribute. diff --git a/label/__init__.py b/label/__init__.py deleted file mode 100644 index 5eec6e217..000000000 --- a/label/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -############################################################################## -# -# Copyright (C) 2023 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Simon Gonzalez -# -# The licence is in the file __manifest__.py -# -############################################################################## diff --git a/label/__manifest__.py b/label/__manifest__.py deleted file mode 100644 index f7d83473a..000000000 --- a/label/__manifest__.py +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################## -# -# ______ Releasing children from poverty _ -# / ____/___ ____ ___ ____ ____ ___________(_)___ ____ -# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \ -# / /___/ /_/ / / / / / / /_/ / /_/ (__ |__ ) / /_/ / / / / -# \____/\____/_/ /_/ /_/ .___/\__,_/____/____/_/\____/_/ /_/ -# /_/ -# in Jesus' name -# -# Copyright (C) 2023 Compassion CH (http://www.compassion.ch) -# @author: Simon Gonzalez -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -# pylint: disable=C8101 -{ - "name": "Mass Label Reporting", - "version": "14.0.1.0.0", - "author": "Compassion CH", - "category": "Tools", - "website": "https://github.com/CompassionCH/compassion-modules", - "license": "AGPL-3", - "depends": ["base", "web", "sponsorship_compassion"], - "data": [ - "data/report_paperformat.xml", - "reports/dynamic_label.xml", - "reports/one_label.xml", - ], - "installable": True, - "auto_install": False, -} diff --git a/label/data/report_paperformat.xml b/label/data/report_paperformat.xml deleted file mode 100644 index 79bf8fe9f..000000000 --- a/label/data/report_paperformat.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - Label A4 - custom - - 297 - 210 - Portrait - 0 - 0 - 0 - 0 - - 0 - 96 - - - - diff --git a/label/readme/CONTRIBUTORS.md b/label/readme/CONTRIBUTORS.md deleted file mode 100644 index 6a5b43d7a..000000000 --- a/label/readme/CONTRIBUTORS.md +++ /dev/null @@ -1,2 +0,0 @@ -- Emanuel Cino \<\> -- Simon Gonzalez \<\> diff --git a/label/readme/DESCRIPTION.md b/label/readme/DESCRIPTION.md deleted file mode 100644 index 9a33c6ca6..000000000 --- a/label/readme/DESCRIPTION.md +++ /dev/null @@ -1,3 +0,0 @@ -This module adds report_label and one_label report template to print a -QR code with informations of the partner and the child. The report -prints 3 columns and 11 rows of the QR + partner informations. diff --git a/label/readme/INSTALL.md b/label/readme/INSTALL.md deleted file mode 100644 index 8b1378917..000000000 --- a/label/readme/INSTALL.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/label/readme/USAGE.md b/label/readme/USAGE.md deleted file mode 100644 index 8b1378917..000000000 --- a/label/readme/USAGE.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/label/reports/dynamic_label.xml b/label/reports/dynamic_label.xml deleted file mode 100644 index b77bf97be..000000000 --- a/label/reports/dynamic_label.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/label/reports/one_label.xml b/label/reports/one_label.xml deleted file mode 100644 index 49def061f..000000000 --- a/label/reports/one_label.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - diff --git a/label/static/description/index.html b/label/static/description/index.html deleted file mode 100644 index 591e72a67..000000000 --- a/label/static/description/index.html +++ /dev/null @@ -1,426 +0,0 @@ - - - - - -Mass Label Reporting - - - -
-

Mass Label Reporting

- - -

Beta License: AGPL-3 CompassionCH/compassion-modules

-

This module adds report_label and one_label report template to print a -QR code with informations of the partner and the child. The report -prints 3 columns and 11 rows of the QR + partner informations.

-

Table of contents

- - -
-

Usage

-
-
-

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 to smash it by providing a detailed and welcomed -feedback.

-

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

-
-
-

Credits

-
-

Authors

-
    -
  • Compassion CH
  • -
-
-
-

Contributors

- -
-
-

Maintainers

-

This module is part of the CompassionCH/compassion-modules project on GitHub.

-

You are welcome to contribute.

-
-
-
- - diff --git a/label/static/src/css/label.css b/label/static/src/css/label.css deleted file mode 100644 index 93ecd04a8..000000000 --- a/label/static/src/css/label.css +++ /dev/null @@ -1,27 +0,0 @@ -div.o_label_table_cell { - overflow: hidden; - width: 100%; - height: 100%; -} -div.o_label_barcode { - overflow: hidden; - width: 100%; - height: 100%; -} -div.o_label_div_cell { - overflow: hidden; - width: 100%; - height: 100%; -} -table.o_label_page_table { - width: 100%; - height: 100%; -} -table.o_label_cell_table { - width: 100%; - height: 100%; -} -table.o_label_text_table { - width: 100%; - height: 100%; -} diff --git a/partner_communication/models/communication_config.py b/partner_communication/models/communication_config.py index 8e6eabfee..251c62ac4 100644 --- a/partner_communication/models/communication_config.py +++ b/partner_communication/models/communication_config.py @@ -239,58 +239,18 @@ def build_inform_mode( :param send_mode_pref_field string :returns: send_mode (physical/digital/False), auto_mode (True/False) """ - # First key is the comm send_mode, second key is the partner send_mode - # value is the send_mode that should be selected. - send_priority = { - "physical": { - "none": "none", - "physical": "physical", - "digital": "physical", - "digital_only": "digital", - "both": "physical", - }, - "digital": { - "none": "none", - "physical": "physical" if print_if_not_email else "none", - "digital": "digital", - "digital_only": "digital", - "both": "both" if print_if_not_email else "digital", - }, - "digital_only": { - "none": "none", - "physical": "digital" if partner.email else "none", - "digital": "digital", - "digital_only": "digital", - "both": "digital", - }, - "both": { - "none": "none", - "physical": "physical", - "digital": "both", - "digital_only": "digital", - "both": "both", - }, - } - + send_priority = self._get_send_priority(partner, print_if_not_email) if communication_send_mode != "partner_preference": partner_mode = getattr( partner, send_mode_pref_field or "global_communication_delivery_preference", partner.global_communication_delivery_preference, ) + auto_mode = self._get_auto_mode(partner_mode, communication_send_mode) if communication_send_mode == partner_mode: send_mode = communication_send_mode - auto_mode = "auto" in send_mode or send_mode == "both" digital_only = "digital_only" in partner_mode else: - auto_mode = ( - "auto" in partner_mode - and "auto" in communication_send_mode - or "auto" in partner_mode - and communication_send_mode == "both" - or "auto" in communication_send_mode - and partner_mode == "both" - ) comm_mode = communication_send_mode.replace("auto_", "") partner_mode = partner_mode.replace("auto_", "") send_mode = send_priority.get(comm_mode, {}).get(partner_mode, "none") @@ -325,3 +285,52 @@ def build_inform_mode( send_mode = False return send_mode, auto_mode + + def _get_send_priority(self, partner, print_if_not_email): + # First key is the comm send_mode, second key is the partner send_mode + # value is the send_mode that should be selected. + return { + "physical": { + "none": "none", + "physical": "physical", + "digital": "physical", + "digital_only": "digital", + "both": "physical", + }, + "digital": { + "none": "none", + "physical": "physical" if print_if_not_email else "none", + "digital": "digital", + "digital_only": "digital", + "both": "both" if print_if_not_email else "digital", + }, + "digital_only": { + "none": "none", + "physical": "digital" if partner.email else "none", + "digital": "digital", + "digital_only": "digital", + "both": "digital", + }, + "both": { + "none": "none", + "physical": "physical", + "digital": "both", + "digital_only": "digital", + "both": "both", + }, + } + + def _get_auto_mode(self, partner_mode, communication_mode): + """Gets the computed auto_mode + :param partner_mode: auto_mode from the partner preference + :param communication_mode: auto_mode from the communication config.""" + return ( + "auto" in partner_mode + and "auto" in communication_mode + or "auto" in partner_mode + and communication_mode == "both" + or "auto" in communication_mode + and partner_mode == "both" + or partner_mode == "both" + and communication_mode == "both" + ) diff --git a/partner_communication_compassion/data/communication_config.xml b/partner_communication_compassion/data/communication_config.xml index d07eabdb3..22963e98d 100644 --- a/partner_communication_compassion/data/communication_config.xml +++ b/partner_communication_compassion/data/communication_config.xml @@ -408,6 +408,15 @@ digital - + + Beneficiary Hold Removal + + + digital + + diff --git a/partner_communication_compassion/data/depart_communications.xml b/partner_communication_compassion/data/depart_communications.xml index 5aabef846..3ec5797f4 100644 --- a/partner_communication_compassion/data/depart_communications.xml +++ b/partner_communication_compassion/data/depart_communications.xml @@ -201,37 +201,6 @@ ${object.user_id.signature | safe} - - - Sponsorship - Certificate - - "${object.user_id.company_id.name}" <${object.user_id.company_id.email}> - ${object.user_id.company_id.email} - - Thank you for changing one life - -

- % set partner = object.partner_id - % set sponsorships = object.get_objects() - ${partner.salutation} -

-

- We recently informed you by email about the end of the sponsorship. -

-

- From the bottom of our hearts, we would like to thank you for your valuable contribution! -

-

- Best regards -

-
-
-