From 0bcfd6ca542f3967ff1cc81cabd10d20e57ab157 Mon Sep 17 00:00:00 2001 From: bobrador Date: Mon, 22 Jul 2024 14:33:02 +0200 Subject: [PATCH] [MIG] crm_salesperson_planner: Migration to 17.0 --- crm_salesperson_planner/README.rst | 4 ++ crm_salesperson_planner/__manifest__.py | 2 +- .../models/crm_salesperson_planner_visit.py | 2 - .../crm_salesperson_planner_visit_template.py | 3 -- .../readme/CONTRIBUTORS.md | 2 + .../static/description/index.html | 4 ++ ..._crm_salesperson_planner_visit_template.py | 16 ++++--- crm_salesperson_planner/views/crm_lead.xml | 2 - ...lesperson_planner_visit_template_views.xml | 34 +++++++------- .../crm_salesperson_planner_visit_views.xml | 45 +++++++++---------- crm_salesperson_planner/views/res_partner.xml | 2 +- ...lesperson_planner_visit_close_wiz_view.xml | 12 +++-- 12 files changed, 69 insertions(+), 59 deletions(-) diff --git a/crm_salesperson_planner/README.rst b/crm_salesperson_planner/README.rst index 054ffdb1821..b7ddc5385e8 100644 --- a/crm_salesperson_planner/README.rst +++ b/crm_salesperson_planner/README.rst @@ -100,6 +100,10 @@ Contributors - Víctor Martínez +- `APSL-Nagarro `__: + + - Bernat Obrador + Maintainers ----------- diff --git a/crm_salesperson_planner/__manifest__.py b/crm_salesperson_planner/__manifest__.py index 44f146d2bc6..fa9bd94e537 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": "16.0.2.0.0", + "version": "17.0.1.0.0", "development_status": "Beta", "category": "Customer Relationship Management", "author": "Sygel Technology," "Odoo Community Association (OCA)", diff --git a/crm_salesperson_planner/models/crm_salesperson_planner_visit.py b/crm_salesperson_planner/models/crm_salesperson_planner_visit.py index 4bd850926ef..d6737a30a86 100644 --- a/crm_salesperson_planner/models/crm_salesperson_planner_visit.py +++ b/crm_salesperson_planner/models/crm_salesperson_planner_visit.py @@ -16,7 +16,6 @@ class CrmSalespersonPlannerVisit(models.Model): string="Visit Number", required=True, default="/", - readonly=True, copy=False, ) partner_id = fields.Many2one( @@ -60,7 +59,6 @@ class CrmSalespersonPlannerVisit(models.Model): state = fields.Selection( string="Status", required=True, - readonly=True, copy=False, tracking=True, selection=[ 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 9771d7e57d2..5d01c14c2e6 100644 --- a/crm_salesperson_planner/models/crm_salesperson_planner_visit_template.py +++ b/crm_salesperson_planner/models/crm_salesperson_planner_visit_template.py @@ -31,7 +31,6 @@ class CrmSalespersonPlannerVisitTemplate(models.Model): name = fields.Char( string="Visit Template Number", default="/", - readonly=True, copy=False, ) description = fields.Html() @@ -48,7 +47,6 @@ class CrmSalespersonPlannerVisitTemplate(models.Model): comodel_name="res.partner", string="Scheduled by", related="user_id.partner_id", - readonly=True, ) partner_ids = fields.Many2many( comodel_name="res.partner", @@ -107,7 +105,6 @@ class CrmSalespersonPlannerVisitTemplate(models.Model): tracking=True, default=lambda self: fields.Datetime.today() + timedelta(hours=1), compute="_compute_stop", - readonly=False, store=True, help="Stop date of an event, without time for full days events", ) diff --git a/crm_salesperson_planner/readme/CONTRIBUTORS.md b/crm_salesperson_planner/readme/CONTRIBUTORS.md index b6812b731d4..92fef5d95e7 100644 --- a/crm_salesperson_planner/readme/CONTRIBUTORS.md +++ b/crm_salesperson_planner/readme/CONTRIBUTORS.md @@ -5,3 +5,5 @@ - Gerardo Marin Parra \<\> - [Tecnativa](https://www.tecnativa.com): - Víctor Martínez +- [APSL-Nagarro](): + - Bernat Obrador \<\> \ No newline at end of file diff --git a/crm_salesperson_planner/static/description/index.html b/crm_salesperson_planner/static/description/index.html index 53e05a4d50c..32a1d894b7d 100644 --- a/crm_salesperson_planner/static/description/index.html +++ b/crm_salesperson_planner/static/description/index.html @@ -447,6 +447,10 @@

Contributors

  • Víctor Martínez
  • +
  • APSL-Nagarro: +
  • diff --git a/crm_salesperson_planner/tests/test_crm_salesperson_planner_visit_template.py b/crm_salesperson_planner/tests/test_crm_salesperson_planner_visit_template.py index 3f0d689db70..e44a50f1246 100644 --- a/crm_salesperson_planner/tests/test_crm_salesperson_planner_visit_template.py +++ b/crm_salesperson_planner/tests/test_crm_salesperson_planner_visit_template.py @@ -197,27 +197,33 @@ def test_04_cancel_visit(self): def test_05_repeat_weeks(self): self.visit_template_base.write( { - "start_date": "2024-03-08", + "start_date": fields.Date.today(), "interval": 1, "rrule_type": "weekly", "tue": True, "end_type": "end_date", - "until": "2024-07-02", + "until": fields.Date.today() + timedelta(days=90), } ) + + dates = [ + self.visit_template_base.start_date + timedelta(days=i) for i in range(91) + ] + filtered_tus_dates = [d for d in dates if d.weekday() == 1] + self.visit_template_base.action_validate() self.assertFalse(self.visit_template_base.visit_ids) create_model = self.env["crm.salesperson.planner.visit.template.create"] create_item = create_model.with_context( active_id=self.visit_template_base.id - ).create({"date_to": "2024-07-02"}) + ).create({"date_to": filtered_tus_dates[2]}) create_item.create_visits() self.assertEqual(self.visit_template_base.state, "done") visit_dates = self.visit_template_base.visit_ids.mapped("date") - self.assertIn(fields.Date.from_string("2024-03-19"), visit_dates) + self.assertIn(fields.Date.from_string(filtered_tus_dates[4]), visit_dates) self.assertEqual( self.visit_template_base.last_visit_date, - fields.Date.from_string("2024-07-02"), + fields.Date.from_string(filtered_tus_dates[len(filtered_tus_dates) - 1]), ) def test_06_repeat_months_count_01(self): diff --git a/crm_salesperson_planner/views/crm_lead.xml b/crm_salesperson_planner/views/crm_lead.xml index a0561d29551..7b3af899e8a 100644 --- a/crm_salesperson_planner/views/crm_lead.xml +++ b/crm_salesperson_planner/views/crm_lead.xml @@ -9,9 +9,7 @@ - - diff --git a/crm_salesperson_planner/views/crm_salesperson_planner_visit_template_views.xml b/crm_salesperson_planner/views/crm_salesperson_planner_visit_template_views.xml index 0fa1450ff09..7ff78d6b883 100644 --- a/crm_salesperson_planner/views/crm_salesperson_planner_visit_template_views.xml +++ b/crm_salesperson_planner/views/crm_salesperson_planner_visit_template_views.xml @@ -8,8 +8,8 @@ crm.salesperson.planner.visit.template - - + + @@ -28,25 +28,25 @@ name="action_validate" string="Validate" type="object" - attrs="{'invisible': [('state', '!=', 'draft')]}" + invisible="state != 'draft'" />