Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] project_task_code: Migration to 17.0 #1355

Open
wants to merge 68 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
3aea8a9
[MOD] changing from odoomrp to avanzosc
oihane Oct 30, 2014
3d95b9b
[FIX] Code error when copying a task
oihane Dec 2, 2014
3fcb280
[IMP] <project_task_code> adapted to OCA
oihane Jul 30, 2015
e25ec21
[IMP] <project_task_code> Added docstring to pre and post init-hooks
oihane Aug 3, 2015
4646b44
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
2078811
[MIG] Make modules uninstallable
pedrobaeza Oct 14, 2015
598bbee
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
97a3d6a
project_task_code module
cubells Dec 17, 2016
e31a72c
[MIG] project_task_code: Migrate to 10.0
Dec 17, 2016
08c022a
Requested README changes
Jan 12, 2017
acbbd63
Requested XML change
Jan 12, 2017
c03a69f
OCA Transbot updated translations from Transifex
oca-transbot Sep 1, 2015
626ebd1
[MIG] project_task_code: Migration to 11.0
rodrigets Feb 16, 2018
d8deb94
[IMP] Implements name_get() in 'project.task'
rodrigets Apr 16, 2018
dac5159
remove obsolete .pot files [ci skip]
sbidoul Jun 15, 2018
49378a3
[UPD] Update project_task_code.pot
oca-travis Jun 18, 2018
51524a4
[MIG] project_task_code: Migration to 12.0
bouvyd Oct 29, 2018
ab5f6cc
[MIG] project_task_code: Migration to 12.0 (fix)
alexey-pelykh Nov 21, 2018
6917936
[UPD] Update project_task_code.pot
oca-travis Nov 27, 2018
249b818
Update translation files
oca-transbot Dec 9, 2018
97b2de4
[FIX] project_task_code: invalid variable
alexey-pelykh Feb 11, 2019
a9b1e57
Translated using Weblate (Galician)
mvrodriguez Feb 11, 2019
107d1c2
[ADD] icon.png
OCA-git-bot Apr 3, 2019
d0ea98b
[FIX][12.0] project_task_code missing api.multi
tbaden Apr 30, 2019
e833b29
[UPD] README.rst
OCA-git-bot Jul 29, 2019
9ece6e6
[13.0][MIG] project_task_code
Saran440 Oct 24, 2019
4c8647c
[UPD] Update project_task_code.pot
oca-travis Oct 28, 2019
9797233
Update translation files
oca-transbot Dec 25, 2019
f0f72b2
pre-commit update
OCA-git-bot Mar 14, 2020
e3f4dd3
[UPD] Brainbean Apps => CorporateHub
alexey-pelykh Nov 8, 2020
0dd9d38
[UPD] README.rst
OCA-git-bot Nov 8, 2020
68169cc
[14.0][MIG]project_task_code
Yoshiro009 Jan 27, 2021
f4fde64
[UPD] Update project_task_code.pot
oca-travis Mar 3, 2021
521c6e4
[UPD] README.rst
OCA-git-bot Mar 3, 2021
6ad7bf7
Added translation using Weblate (Spanish (Argentina))
ibuioli Apr 1, 2021
bb79e25
Translated using Weblate (Spanish (Argentina))
ibuioli Apr 1, 2021
98e3212
Added translation using Weblate (French (France))
Yvesldff Apr 11, 2021
3c5287e
Translated using Weblate (French (France))
Yvesldff Apr 11, 2021
6734f9a
Translated using Weblate (Spanish (Mexico))
alan196 Sep 29, 2021
f68cc56
Translated using Weblate (Swedish)
simonstromb Nov 16, 2021
037d2d2
[MIG] project_task_code : Migrate project_task_code.
bizzappdev Feb 9, 2022
6c15de2
[UPD] Update project_task_code.pot
Apr 5, 2022
cadf070
[UPD] README.rst
OCA-git-bot Apr 5, 2022
e796e64
Translated using Weblate (Catalan)
Noel000 Apr 13, 2022
e4c541f
[FIX] project_task_code: in place argument modification
gurneyalex Oct 10, 2022
31b88b8
project_task_code 15.0.1.0.2
OCA-git-bot Oct 10, 2022
baf5708
[15.0][FIX] project_task_code: Fix null value in column code, that vi…
yankinmax Nov 22, 2022
60a1f1e
project_task_code 15.0.1.0.3
OCA-git-bot Dec 1, 2022
9a7f482
[IMP] update dotfiles [ci skip]
OCA-git-bot Dec 11, 2022
df701df
[FIX] project_task_code: Make sequence avalaible for all companies
rolandojduartem Jan 13, 2023
2312263
project_task_code 15.0.1.0.4
OCA-git-bot Jan 24, 2023
bb88d1a
[MIG] project_task_code: Migration to 16.0
kg-ucs Nov 2, 2022
d274f00
[FIX] project_task_code: unique code in company
robinkeunen Jan 11, 2024
e2ef06e
[UPD] Update project_task_code.pot
Jan 13, 2024
86e7bbd
[BOT] post-merge updates
OCA-git-bot Jan 13, 2024
a501aaa
Update translation files
weblate Jan 14, 2024
eda7fbc
Translated using Weblate (Italian)
mymage Jan 15, 2024
c5ec7c3
Translated using Weblate (Spanish)
Ivorra78 Jan 15, 2024
2e0bafb
Translated using Weblate (Spanish (Argentina))
ibuioli Jan 17, 2024
a2546ec
[16.0][FIX]project_task_code: fix view kanban
DemchukM Jan 19, 2024
cef941d
Translated using Weblate (Italian)
mymage Jan 20, 2024
decf975
[BOT] post-merge updates
OCA-git-bot Jan 24, 2024
0870475
Translated using Weblate (Portuguese (Brazil))
May 22, 2024
e4475f3
[IMP] project_task_code Search by code in x2m
ivs-cetmix Aug 7, 2024
2cb60eb
[BOT] post-merge updates
OCA-git-bot Aug 18, 2024
f2723dc
[IMP] project_task_code: pre-commit auto fixes
Oct 22, 2024
680712a
[MIG] project_task_code: Migration to 17.0
Oct 22, 2024
0b3e71f
[IMP] project_task_code: pre-commit auto fixes
Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions project_task_code/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Contributors
- Saran Lim. <[email protected]>
- Tharathip Chaweewongphan <[email protected]>
- Ruchir Shukla <[email protected]>
- Nedas Žilinskas <[email protected]>

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion project_task_code/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Sequential Code for Tasks",
"version": "16.0.1.1.0",
"version": "17.0.1.0.0",
"category": "Project Management",
"author": "OdooMRP team, "
"AvanzOSC, "
Expand Down
13 changes: 5 additions & 8 deletions project_task_code/hooks.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
# Copyright 2016 Tecnativa <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import SUPERUSER_ID, api


def pre_init_hook(cr):
def pre_init_hook(env):
"""
With this pre-init-hook we want to avoid error when creating the UNIQUE
code constraint when the module is installed and before the post-init-hook
is launched.
"""
cr.execute("ALTER TABLE project_task ADD COLUMN code character varying;")
cr.execute("UPDATE project_task SET code = id;")
env.cr.execute("ALTER TABLE project_task ADD COLUMN code character varying;")
env.cr.execute("UPDATE project_task SET code = id;")


def post_init_hook(cr, registry):
def post_init_hook(env):
"""
This post-init-hook will update all existing task assigning them the
corresponding sequence code.
"""
env = api.Environment(cr, SUPERUSER_ID, dict())
task_obj = env["project.task"]
sequence_obj = env["ir.sequence"]
tasks = task_obj.search([], order="id")
for task_id in tasks.ids:
cr.execute(
env.cr.execute(
"UPDATE project_task SET code = %s WHERE id = %s;",
(
sequence_obj.next_by_code("project.task"),
Expand Down
24 changes: 14 additions & 10 deletions project_task_code/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

from odoo import _, api, fields, models

PROJECT_TASK_WRITABLE_FIELDS = {
"code",
}


class ProjectTask(models.Model):
_inherit = "project.task"
Expand All @@ -24,21 +28,21 @@
),
]

@property
def SELF_WRITABLE_FIELDS(self):
return super().SELF_WRITABLE_FIELDS | PROJECT_TASK_WRITABLE_FIELDS

Check warning on line 33 in project_task_code/models/project_task.py

View check run for this annotation

Codecov / codecov/patch

project_task_code/models/project_task.py#L33

Added line #L33 was not covered by tests

@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get("code", "/") == "/":
vals["code"] = (
self.env["ir.sequence"].next_by_code("project.task") or "/"
# `sudo()` for portal users
self.env["ir.sequence"].sudo().next_by_code("project.task") or "/"
)
return super().create(vals_list)

def name_get(self):
result = super().name_get()
new_result = []

for task in result:
rec = self.browse(task[0])
name = f"[{rec.code}] {task[1]}"
new_result.append((rec.id, name))
return new_result
@api.depends("name", "code")
def _compute_display_name(self):
for task in self:
task.display_name = f"[{task.code}] {task.name}" if task.code else task.name
1 change: 1 addition & 0 deletions project_task_code/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
- Saran Lim. \<<[email protected]>\>
- Tharathip Chaweewongphan \<<[email protected]>\>
- Ruchir Shukla \<<[email protected]>\>
- Nedas Žilinskas \<<[email protected]>\>
1 change: 1 addition & 0 deletions project_task_code/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Saran Lim. &lt;<a class="reference external" href="mailto:saranl&#64;ecosoft.co.th">saranl&#64;ecosoft.co.th</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>Ruchir Shukla &lt;<a class="reference external" href="mailto:ruchir&#64;bizzappdev.com">ruchir&#64;bizzappdev.com</a>&gt;</li>
<li>Nedas Žilinskas &lt;<a class="reference external" href="mailto:nedas.zilinskas&#64;avoin.systems">nedas.zilinskas&#64;avoin.systems</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
4 changes: 2 additions & 2 deletions project_task_code/tests/test_project_task_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def test_name_get(self):
"name": "Task Testing Get Name",
}
)
result = project_task.name_get()
self.assertEqual(result[0][1], "[%s] Task Testing Get Name" % code)
result = project_task.display_name
self.assertEqual(result, "[%s] Task Testing Get Name" % code)

def test_name_search(self):
project_task = self.env["project.task"].create(
Expand Down
15 changes: 3 additions & 12 deletions project_task_code/views/project_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,9 @@
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_kanban" />
<field name="arch" type="xml">
<xpath
expr="//strong[hasclass('o_kanban_record_title')]/t/field[@name='name']"
position="before"
>
<span>[<field name="code" />] </span>
</xpath>
<xpath
expr="//strong[hasclass('o_kanban_record_title')]/s/field[@name='name']"
position="before"
>
<span>[<field name="code" />] </span>
</xpath>
<field name="name" position="before">
<field name="code" />
</field>
Copy link

@coleste coleste Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This revert is weird. I don't think it works.
16.0 has a t-if= / t-else=, same as 17.0

</field>
</record>
<record id="project_task_code_search_view" model="ir.ui.view">
Expand Down
Loading