From 12f57077d2a3fd2d8248983a68452f13e9b8d924 Mon Sep 17 00:00:00 2001 From: Gerardo Marin Parra Date: Wed, 24 May 2023 12:28:39 -0500 Subject: [PATCH] [MIG] crm_salesperson_planner: Migration to 16.0 --- crm_salesperson_planner/README.rst | 27 ++- crm_salesperson_planner/__manifest__.py | 2 +- .../migrations/15.0.1.0.0/pre-migration.py | 81 -------- .../crm_salesperson_planner_visit_template.py | 6 +- .../readme/CONTRIBUTORS.rst | 4 + .../static/description/index.html | 16 +- .../test_crm_salesperson_planner_visit.py | 193 +++++++++++++++++- 7 files changed, 229 insertions(+), 100 deletions(-) delete mode 100644 crm_salesperson_planner/migrations/15.0.1.0.0/pre-migration.py diff --git a/crm_salesperson_planner/README.rst b/crm_salesperson_planner/README.rst index 0c053f17de1..8c4abe6e74e 100644 --- a/crm_salesperson_planner/README.rst +++ b/crm_salesperson_planner/README.rst @@ -2,10 +2,13 @@ Crm Salesperson Planner ======================= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ece9cce90a55feea9d5e85078846e339a4c3fe95400e5a7e218f7624b81201c0 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -14,16 +17,16 @@ Crm Salesperson Planner :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github - :target: https://github.com/OCA/crm/tree/15.0/crm_salesperson_planner + :target: https://github.com/OCA/crm/tree/16.0/crm_salesperson_planner :alt: OCA/crm .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/crm-15-0/crm-15-0-crm_salesperson_planner + :target: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_salesperson_planner :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/111/15.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This application allows you to track and schedule salespeople visits to your customers, allowing you to determine which opportunities are going to be dealt on each visit. Visits create an all day event in calendar, and they can be easily rescheduled. Visits can be automatically created from a template, in which it is possible to select the frequency of visits, as well as the start and end dates. The last visit can also be calculated by selecting the total number of repetitions. @@ -56,8 +59,8 @@ 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 -`feedback `_. +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. @@ -77,6 +80,10 @@ Contributors * Valentin Vinagre * Manuel Regidor +* `Pesol `__: + + * Gerardo Marin Parra + Maintainers ~~~~~~~~~~~ @@ -90,6 +97,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/crm `_ project on GitHub. +This module is part of the `OCA/crm `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/crm_salesperson_planner/__manifest__.py b/crm_salesperson_planner/__manifest__.py index cd935d97f43..059acecb390 100644 --- a/crm_salesperson_planner/__manifest__.py +++ b/crm_salesperson_planner/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) { "name": "Crm Salesperson Planner", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "development_status": "Beta", "category": "Customer Relationship Management", "author": "Sygel Technology," "Odoo Community Association (OCA)", diff --git a/crm_salesperson_planner/migrations/15.0.1.0.0/pre-migration.py b/crm_salesperson_planner/migrations/15.0.1.0.0/pre-migration.py deleted file mode 100644 index 9d99683e282..00000000000 --- a/crm_salesperson_planner/migrations/15.0.1.0.0/pre-migration.py +++ /dev/null @@ -1,81 +0,0 @@ -from openupgradelib import openupgrade - -column_spec = { - "crm_salesperson_planner_visit_template": [ - ("start", None), - ("start_datetime", "start"), - ("stop", None), - ("stop_datetime", "stop"), - ] -} - -field_spec = [ - ( - "crm.salesperson.planner.visit.template", - "crm_salesperson_planner_visit_template", - "week_list", - "weekday", - ), - ( - "crm.salesperson.planner.visit.template", - "crm_salesperson_planner_visit_template", - "mo", - "mon", - ), - ( - "crm.salesperson.planner.visit.template", - "crm_salesperson_planner_visit_template", - "tu", - "tue", - ), - ( - "crm.salesperson.planner.visit.template", - "crm_salesperson_planner_visit_template", - "we", - "wed", - ), - ( - "crm.salesperson.planner.visit.template", - "crm_salesperson_planner_visit_template", - "th", - "thu", - ), - ( - "crm.salesperson.planner.visit.template", - "crm_salesperson_planner_visit_template", - "fr", - "fri", - ), - ( - "crm.salesperson.planner.visit.template", - "crm_salesperson_planner_visit_template", - "sa", - "sat", - ), - ( - "crm.salesperson.planner.visit.template", - "crm_salesperson_planner_visit_template", - "su", - "sun", - ), -] - - -@openupgrade.migrate() -def migrate(env, version): - openupgrade.rename_columns(env.cr, column_spec) - openupgrade.rename_fields(env, field_spec, False) - openupgrade.logged_query( - env.cr, - """ - UPDATE crm_salesperson_planner_visit_template - SET weekday = CASE WHEN weekday = 'FR' THEN 'FRI' - WHEN weekday = 'MO' THEN 'MON' - WHEN weekday = 'SA' THEN 'SAT' - WHEN weekday = 'SU' THEN 'SUN' - WHEN weekday = 'TH' THEN 'THU' - WHEN weekday = 'TU' THEN 'TUE' - WHEN weekday = 'WE' THEN 'WED' - END - WHERE weekday IN ('FR', 'MO', 'SA', 'SU', 'TH', 'TU', 'WE')""", - ) diff --git a/crm_salesperson_planner/models/crm_salesperson_planner_visit_template.py b/crm_salesperson_planner/models/crm_salesperson_planner_visit_template.py index 1c86af5c53b..e7a71783bfe 100644 --- a/crm_salesperson_planner/models/crm_salesperson_planner_visit_template.py +++ b/crm_salesperson_planner/models/crm_salesperson_planner_visit_template.py @@ -4,6 +4,8 @@ from datetime import timedelta +from dateutil.relativedelta import relativedelta + from odoo import _, api, fields, models from odoo.exceptions import ValidationError @@ -169,9 +171,9 @@ def _increase_date(self, date, value): elif self.rrule_type == "weekly": date += timedelta(weeks=value) elif self.rrule_type == "monthly": - date += timedelta(months=value) + date += relativedelta(months=value) elif self.rrule_type == "yearly": - date += timedelta(years=value) + date += relativedelta(years=value) return date def _get_recurrence_dates(self, items): diff --git a/crm_salesperson_planner/readme/CONTRIBUTORS.rst b/crm_salesperson_planner/readme/CONTRIBUTORS.rst index 35f658858eb..790c98428d1 100644 --- a/crm_salesperson_planner/readme/CONTRIBUTORS.rst +++ b/crm_salesperson_planner/readme/CONTRIBUTORS.rst @@ -2,3 +2,7 @@ * Valentin Vinagre * Manuel Regidor + +* `Pesol `__: + + * Gerardo Marin Parra diff --git a/crm_salesperson_planner/static/description/index.html b/crm_salesperson_planner/static/description/index.html index f36f851e956..d7dd93d6c32 100644 --- a/crm_salesperson_planner/static/description/index.html +++ b/crm_salesperson_planner/static/description/index.html @@ -3,7 +3,7 @@ - + Crm Salesperson Planner