Skip to content

Commit

Permalink
[MIG] crm_lead_code: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
peluko00 committed Nov 23, 2023
1 parent b1cb957 commit 8c9ba75
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 38 deletions.
33 changes: 18 additions & 15 deletions crm_lead_code/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Sequential Code for Leads / Opportunities
: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/16.0/crm_lead_code
:target: https://github.com/OCA/crm/tree/17.0/crm_lead_code
:alt: OCA/crm
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/crm-16-0/crm-16-0-crm_lead_code
:target: https://translation.odoo-community.org/projects/crm-17-0/crm-17-0-crm_lead_code
: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=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/crm&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -41,32 +41,35 @@ 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_lead_code%0Aversion:%2016.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_lead_code%0Aversion:%2017.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.

Credits
=======

Authors
~~~~~~~
-------

* Tecnativa
* AvanzOSC

Contributors
~~~~~~~~~~~~
------------

* Oihane Crucelaegui <[email protected]>
* Pedro M. Baeza <[email protected]>
* Ana Juaristi <[email protected]>
* Nicol??s Ramos <[email protected]>
* Mathias Markl <[email protected]>
* Serpent Consulting Services Pvt. Ltd. <[email protected]>
* Tharathip Chaweewongphan <[email protected]>
- Oihane Crucelaegui <[email protected]>
- Pedro M. Baeza <[email protected]>
- Ana Juaristi <[email protected]>
- Nicol??s Ramos <[email protected]>
- Mathias Markl <[email protected]>
- Serpent Consulting Services Pvt. Ltd. <[email protected]>
- Tharathip Chaweewongphan <[email protected]>
- `APSL <https://apsl.tech>`__:

- Antoni Marroig

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -78,6 +81,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/16.0/crm_lead_code>`_ project on GitHub.
This module is part of the `OCA/crm <https://github.com/OCA/crm/tree/17.0/crm_lead_code>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
11 changes: 5 additions & 6 deletions crm_lead_code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
from odoo import api, SUPERUSER_ID


def create_code_equal_to_id(cr):
cr.execute("ALTER TABLE crm_lead ADD COLUMN code character varying;")
cr.execute("UPDATE crm_lead SET code = id;")
def create_code_equal_to_id(env):
env.cr.execute("ALTER TABLE crm_lead ADD COLUMN code character varying;")
env.cr.execute("UPDATE crm_lead SET code = id;")


def assign_old_sequences(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, dict())
def assign_old_sequences(env):
lead_obj = env["crm.lead"]
sequence_obj = env["ir.sequence"]
leads = lead_obj.search([], order="id")
for lead_id in leads.ids:
cr.execute(
env.cr.execute(
"UPDATE crm_lead SET code = %s WHERE id = %s;",
(
sequence_obj.next_by_code("crm.lead"),
Expand Down
2 changes: 1 addition & 1 deletion crm_lead_code/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

{
"name": "Sequential Code for Leads / Opportunities",
"version": "16.0.1.0.1",
"version": "17.0.1.0.1",
"category": "Customer Relationship Management",
"author": "Tecnativa, AvanzOSC, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/crm",
Expand Down
3 changes: 3 additions & 0 deletions crm_lead_code/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
9 changes: 9 additions & 0 deletions crm_lead_code/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- Oihane Crucelaegui \<<[email protected]>\>
- Pedro M. Baeza \<<[email protected]>\>
- Ana Juaristi \<<[email protected]>\>
- Nicol??s Ramos \<<[email protected]>\>
- Mathias Markl \<<[email protected]>\>
- Serpent Consulting Services Pvt. Ltd. \<<[email protected]>\>
- Tharathip Chaweewongphan \<<[email protected]>\>
- [APSL](https://apsl.tech):
- Antoni Marroig
7 changes: 0 additions & 7 deletions crm_lead_code/readme/CONTRIBUTORS.rst

This file was deleted.

File renamed without changes.
10 changes: 7 additions & 3 deletions crm_lead_code/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Sequential Code for Leads / Opportunities</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6b1831d70969cde994b6ee3974356be5904b671bc7e3b1be703ca116aa8ee1a7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/16.0/crm_lead_code"><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-16-0/crm-16-0-crm_lead_code"><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=16.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/17.0/crm_lead_code"><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_lead_code"><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>This module adds a sequential code for leads / opportunities.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -388,7 +388,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">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_lead_code%0Aversion:%2016.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_lead_code%0Aversion:%2017.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 All @@ -410,6 +410,10 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li>Mathias Markl &lt;<a class="reference external" href="mailto:mathias.markl&#64;mukit.at">mathias.markl&#64;mukit.at</a>&gt;</li>
<li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:support&#64;serpentcs.com">support&#64;serpentcs.com</a>&gt;</li>
<li>Tharathip Chaweewongphan &lt;<a class="reference external" href="mailto:tharathipc&#64;ecosoft.co.th">tharathipc&#64;ecosoft.co.th</a>&gt;</li>
<li><a class="reference external" href="https://apsl.tech">APSL</a>:<ul>
<li>Antoni Marroig</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -419,7 +423,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">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/16.0/crm_lead_code">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/17.0/crm_lead_code">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
13 changes: 7 additions & 6 deletions crm_lead_code/tests/test_crm_lead_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@


class TestCrmLeadCode(TransactionCase):
def setUp(self):
super(TestCrmLeadCode, self).setUp()
self.crm_lead_model = self.env["crm.lead"]
self.ir_sequence_model = self.env["ir.sequence"]
self.crm_sequence = self.env.ref("crm_lead_code.sequence_lead")
self.crm_lead = self.env.ref("crm.crm_case_1")
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.crm_lead_model = cls.env["crm.lead"]
cls.ir_sequence_model = cls.env["ir.sequence"]
cls.crm_sequence = cls.env.ref("crm_lead_code.sequence_lead")
cls.crm_lead = cls.env.ref("crm.crm_case_1")

def test_old_lead_code_assign(self):
crm_leads = self.crm_lead_model.search([])
Expand Down

0 comments on commit 8c9ba75

Please sign in to comment.