Skip to content

Commit

Permalink
[MIG] crm_salesperson_planner: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Dec 27, 2024
1 parent c7712e4 commit fd3731e
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 67 deletions.
35 changes: 18 additions & 17 deletions crm_salesperson_planner/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ 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/17.0/crm_salesperson_planner
:target: https://github.com/OCA/crm/tree/18.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-17-0/crm-17-0-crm_salesperson_planner
:target: https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_salesperson_planner
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -49,9 +49,8 @@ Configuration

To configure this module, you need to:

- Go to new menu **CRM > Configuration > Salesperson Planner > Close
Reasons** and create a close reason for 'Cancel' and 'Incident'
types.
- Go to new menu **CRM > Configuration > Salesperson Planner > Close
Reasons** and create a close reason for 'Cancel' and 'Incident' types.

Usage
=====
Expand All @@ -72,7 +71,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/crm/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 <https://github.com/OCA/crm/issues/new?body=module:%20crm_salesperson_planner%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/crm/issues/new?body=module:%20crm_salesperson_planner%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand All @@ -87,22 +86,24 @@ Authors
Contributors
------------

- `Sygel <https://www.sygel.es>`__:
- `Sygel <https://www.sygel.es>`__:

- Valentin Vinagre
- Manuel Regidor
- Valentin Vinagre
- Manuel Regidor

- `Pesol <https://www.pesol.es>`__:
- `Pesol <https://www.pesol.es>`__:

- Gerardo Marin Parra <[email protected]>
- Gerardo Marin Parra <[email protected]>

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

- Víctor Martínez
- Víctor Martínez

- `APSL-Nagarro <https://apsl.tech>`__:
- `APSL-Nagarro <https://apsl.tech>`__:

- Bernat Obrador <[email protected]>
- Bernat Obrador <[email protected]>

- Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>

Maintainers
-----------
Expand All @@ -117,6 +118,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 <https://github.com/OCA/crm/tree/17.0/crm_salesperson_planner>`_ project on GitHub.
This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/18.0/crm_salesperson_planner>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion crm_salesperson_planner/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
{
"name": "Crm Salesperson Planner",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"development_status": "Beta",
"category": "Customer Relationship Management",
"author": "Sygel Technology," "Odoo Community Association (OCA)",
Expand Down
2 changes: 0 additions & 2 deletions crm_salesperson_planner/data/ir_cron_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<field name="name">CRM: Create salesperson visits</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="model_id" ref="model_crm_salesperson_planner_visit_template" />
<field name="code">model._cron_create_visits(days=7)</field>
<field name="state">code</field>
Expand Down
4 changes: 2 additions & 2 deletions crm_salesperson_planner/models/calendar_event.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2021 Sygel - Manuel Regidor
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

from odoo import _, fields, models
from odoo import fields, models
from odoo.exceptions import ValidationError


Expand Down Expand Up @@ -46,7 +46,7 @@ def unlink(self):
if salesperson_visit_events:
error_msg = ""

Check warning on line 47 in crm_salesperson_planner/models/calendar_event.py

View check run for this annotation

Codecov / codecov/patch

crm_salesperson_planner/models/calendar_event.py#L47

Added line #L47 was not covered by tests
for event in salesperson_visit_events:
error_msg += _(
error_msg += self.env._(

Check warning on line 49 in crm_salesperson_planner/models/calendar_event.py

View check run for this annotation

Codecov / codecov/patch

crm_salesperson_planner/models/calendar_event.py#L49

Added line #L49 was not covered by tests
"Event %(event_name)s is related to salesperson visit "
"%(partner_name)s. Cancel it to delete this event.\n"
) % {
Expand Down
18 changes: 11 additions & 7 deletions crm_salesperson_planner/models/crm_salesperson_planner_visit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2021 Sygel - Manuel Regidor
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)

from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import ValidationError


Expand Down Expand Up @@ -102,27 +102,29 @@ def create(self, vals_list):
def action_draft(self):
if self.state not in ["cancel", "incident", "done"]:
raise ValidationError(

Check warning on line 104 in crm_salesperson_planner/models/crm_salesperson_planner_visit.py

View check run for this annotation

Codecov / codecov/patch

crm_salesperson_planner/models/crm_salesperson_planner_visit.py#L104

Added line #L104 was not covered by tests
_("The visit must be in cancelled, incident or visited state")
self.env._("The visit must be in cancelled, incident or visited state")
)
if self.calendar_event_id:
self.calendar_event_id.with_context(bypass_cancel_visit=True).unlink()
self.write({"state": "draft"})

Check warning on line 109 in crm_salesperson_planner/models/crm_salesperson_planner_visit.py

View check run for this annotation

Codecov / codecov/patch

crm_salesperson_planner/models/crm_salesperson_planner_visit.py#L108-L109

Added lines #L108 - L109 were not covered by tests

def action_confirm(self):
if self.filtered(lambda a: not a.state == "draft"):
raise ValidationError(_("The visit must be in draft state"))
raise ValidationError(self.env._("The visit must be in draft state"))

Check warning on line 113 in crm_salesperson_planner/models/crm_salesperson_planner_visit.py

View check run for this annotation

Codecov / codecov/patch

crm_salesperson_planner/models/crm_salesperson_planner_visit.py#L113

Added line #L113 was not covered by tests
events = self.create_calendar_event()
if events:
self.browse(events.mapped("res_id")).write({"state": "confirm"})

def action_done(self):
if not self.state == "confirm":
raise ValidationError(_("The visit must be in confirmed state"))
raise ValidationError(self.env._("The visit must be in confirmed state"))
self.write({"state": "done"})

def action_cancel(self, reason_id, image=None, notes=None):
if self.state not in ["draft", "confirm"]:
raise ValidationError(_("The visit must be in draft or validated state"))
raise ValidationError(

Check warning on line 125 in crm_salesperson_planner/models/crm_salesperson_planner_visit.py

View check run for this annotation

Codecov / codecov/patch

crm_salesperson_planner/models/crm_salesperson_planner_visit.py#L125

Added line #L125 was not covered by tests
self.env._("The visit must be in draft or validated state")
)
if self.calendar_event_id:
self.calendar_event_id.with_context(bypass_cancel_visit=True).unlink()
self.write(
Expand Down Expand Up @@ -165,7 +167,9 @@ def create_calendar_event(self):

def action_incident(self, reason_id, image=None, notes=None):
if self.state not in ["draft", "confirm"]:
raise ValidationError(_("The visit must be in draft or validated state"))
raise ValidationError(

Check warning on line 170 in crm_salesperson_planner/models/crm_salesperson_planner_visit.py

View check run for this annotation

Codecov / codecov/patch

crm_salesperson_planner/models/crm_salesperson_planner_visit.py#L170

Added line #L170 was not covered by tests
self.env._("The visit must be in draft or validated state")
)
self.write(
{
"state": "incident",
Expand All @@ -177,7 +181,7 @@ def action_incident(self, reason_id, image=None, notes=None):

def unlink(self):
if any(sel.state not in ["draft", "cancel"] for sel in self):
raise ValidationError(_("Visits must be in cancelled state"))
raise ValidationError(self.env._("Visits must be in cancelled state"))
return super().unlink()

def write(self, values):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from datetime import timedelta

from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import ValidationError

from odoo.addons.base.models.res_partner import _tz_get
Expand Down Expand Up @@ -228,7 +228,7 @@ def _inverse_dates(self):
def _constrains_partner_ids(self):
for item in self:
if len(item.partner_ids) > 1:
raise ValidationError(_("Only one customer is allowed"))
raise ValidationError(self.env._("Only one customer is allowed"))

@api.onchange("end_type")
def _onchange_end_type(self):
Expand Down
3 changes: 2 additions & 1 deletion crm_salesperson_planner/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- [APSL-Nagarro](<https://apsl.tech>):
- Bernat Obrador \<<[email protected]>\>
- Bernat Obrador \<<[email protected]>\>
- Heliconia Solutions Pvt. Ltd. \<<https://www.heliconia.io>\>
10 changes: 5 additions & 5 deletions crm_salesperson_planner/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Crm Salesperson Planner</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e60d63ff13f06b2c57a2250b60f9f85f8347f43ab93c67910098278f63c31858
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/crm/tree/17.0/crm_salesperson_planner"><img alt="OCA/crm" src="https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/crm-17-0/crm-17-0-crm_salesperson_planner"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/crm&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/crm/tree/18.0/crm_salesperson_planner"><img alt="OCA/crm" src="https://img.shields.io/badge/github-OCA%2Fcrm-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/crm-18-0/crm-18-0-crm_salesperson_planner"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/crm&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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,
Expand Down Expand Up @@ -399,8 +399,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ul class="simple">
<li>Go to new menu <strong>CRM &gt; Configuration &gt; Salesperson Planner &gt; Close
Reasons</strong> and create a close reason for ‘Cancel’ and ‘Incident’
types.</li>
Reasons</strong> and create a close reason for ‘Cancel’ and ‘Incident’ types.</li>
</ul>
</div>
<div class="section" id="usage">
Expand All @@ -420,7 +419,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/crm/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/crm/issues/new?body=module:%20crm_salesperson_planner%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/crm/issues/new?body=module:%20crm_salesperson_planner%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -451,6 +450,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Bernat Obrador &lt;<a class="reference external" href="mailto:bobrador&#64;apsl.net">bobrador&#64;apsl.net</a>&gt;</li>
</ul>
</li>
<li>Heliconia Solutions Pvt. Ltd. &lt;<a class="reference external" href="https://www.heliconia.io">https://www.heliconia.io</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -462,7 +462,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/crm/tree/17.0/crm_salesperson_planner">OCA/crm</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/crm/tree/18.0/crm_salesperson_planner">OCA/crm</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from dateutil.relativedelta import relativedelta

from odoo import _, fields
from odoo import fields
from odoo.exceptions import ValidationError
from odoo.tests import common
from odoo.tools import mute_logger
Expand Down Expand Up @@ -228,7 +228,7 @@ def test_action_view_salesperson_planner_visit(self):

self.assertEqual(action["domain"], [("partner_id", "child_of", partner.id)])
self.assertEqual(action["res_model"], "crm.salesperson.planner.visit")
self.assertIn("tree", action["view_mode"])
self.assertIn("list", action["view_mode"])
self.assertIn("form", action["view_mode"])
self.assertIn("pivot", action["view_mode"])

Expand Down Expand Up @@ -260,7 +260,7 @@ def test_partner_ids_constraint(self):
(0, 0, {"name": "Customer 3"}),
]

error_msg = _("Only one customer is allowed")
error_msg = self.env._("Only one customer is allowed")
self.assertEqual(str(context.exception), error_msg)

def test_action_view_salesperson_planner_visit(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def test_06_repeat_months_count_01(self):
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-12-13"})
).create({"date_to": "2025-01-13"})
create_item.create_visits()
self.assertEqual(self.visit_template_base.state, "done")
self.assertEqual(len(self.visit_template_base.visit_ids), 2)
Expand Down Expand Up @@ -271,7 +271,7 @@ def test_06_repeat_months_count_02(self):
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-12-13"})
).create({"date_to": "2025-01-13"})
create_item.create_visits()
self.assertEqual(self.visit_template_base.state, "done")
self.assertEqual(len(self.visit_template_base.visit_ids), 2)
Expand Down Expand Up @@ -300,7 +300,7 @@ def test_06_repeat_months_count_03(self):
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-12-13"})
).create({"date_to": "2025-01-13"})
create_item.create_visits()
self.assertEqual(self.visit_template_base.state, "done")
self.assertEqual(len(self.visit_template_base.visit_ids), 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<field name="name">CRM - Salesperson Planner Visit Close Reason Tree</field>
<field name="model">crm.salesperson.planner.visit.close.reason</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field name="close_type" />
<field name="require_image" />
<field name="reschedule" />
</tree>
</list>
</field>
</record>
<record
Expand Down Expand Up @@ -49,7 +49,7 @@
>
<field name="name">Close Reasons</field>
<field name="res_model">crm.salesperson.planner.visit.close.reason</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Record reason for close commercial visits.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<field name="name">CRM - Salesperson Planner Visit Template Tree</field>
<field name="model">crm.salesperson.planner.visit.template</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" readonly="1" />
<field name="partner_id" readonly="1" />
<field name="start_date" />
<field name="sequence" />
<field name="user_id" />
<field name="company_id" groups="base.group_multi_company" />
<field name="state" />
</tree>
</list>
</field>
</record>
<record model="ir.ui.view" id="crm_salesperson_planner_visit_template_form_view">
Expand Down Expand Up @@ -166,7 +166,7 @@
>
<field name="name">Visit Templates</field>
<field name="res_model">crm.salesperson.planner.visit.template</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create and plan commercial visit templates
Expand Down
Loading

0 comments on commit fd3731e

Please sign in to comment.