Skip to content

Commit

Permalink
[MIG] project_task_recurring_activity: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PicchiSeba committed Sep 24, 2024
1 parent 0c10f2b commit 2c3597b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 46 deletions.
10 changes: 5 additions & 5 deletions project_task_recurring_activity/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Project Task Recurring Activity
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github
:target: https://github.com/OCA/project/tree/14.0/project_task_recurring_activity
:target: https://github.com/OCA/project/tree/16.0/project_task_recurring_activity
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_task_recurring_activity
:target: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_task_recurring_activity
: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/project&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -54,7 +54,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/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/project/issues/new?body=module:%20project_task_recurring_activity%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_task_recurring_activity%0Aversion:%2016.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 Down Expand Up @@ -96,6 +96,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-dessanhemrayev| |maintainer-CetmixGitDrone|

This module is part of the `OCA/project <https://github.com/OCA/project/tree/14.0/project_task_recurring_activity>`_ project on GitHub.
This module is part of the `OCA/project <https://github.com/OCA/project/tree/16.0/project_task_recurring_activity>`_ 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 project_task_recurring_activity/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Cetmix, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project",
"category": "Project Management",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"depends": ["project"],
"data": [
Expand Down
10 changes: 5 additions & 5 deletions project_task_recurring_activity/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def _forming_activity_data(self, task, custom_activity_ids):
)
return result

@api.model
def create(self, val):
result = super().create(val)
for item in result:
@api.model_create_multi
def create(self, vals_list):
results = super().create(vals_list)
for item in results:
item.create_date = item.recurrence_id.next_recurrence_date
if item.recurring_task and item.custom_activity_ids:
item.message_subscribe(
Expand All @@ -99,4 +99,4 @@ def create(self, val):
item.recurring_activity_ids = self._forming_activity_data(
item, item.custom_activity_ids
)
return result
return results
19 changes: 7 additions & 12 deletions project_task_recurring_activity/models/recurring_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ class RecurringActivity(models.Model):
index=True,
required=True,
)
summary = fields.Char(
string="Summary",
)
description = fields.Html(
string="Description",
sanitize_style=True,
)
summary = fields.Char()
description = fields.Html(sanitize_style=True)
days_after_task_creation_date = fields.Integer()
next_recurrence_date = fields.Date(
string="next_date", compute="_compute_next_recurrence_date", store=True
Expand Down Expand Up @@ -87,10 +82,10 @@ def _onchange_activity_type_id(self):
def delta_time(self, old, new):
return (new - old).days

@api.model
def create(self, val):
result = super().create(val)
for item in result:
@api.model_create_multi
def create(self, vals_list):
results = super().create(vals_list)
for item in results:
next_recurrence_date = (
item.project_task_id.recurrence_id.next_recurrence_date
)
Expand All @@ -112,4 +107,4 @@ def create(self, val):
else (next_recurrence_date - timedelta(days=delfa))
+ timedelta(days=item.days_after_task_creation_date),
)
return result
return results
18 changes: 10 additions & 8 deletions project_task_recurring_activity/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Project Task Recurring Activity</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a3bfe23bed7c7175a529bed6611a8b9f0ba5e63fb9aaaf9676341d1d8f2a2245
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/project/tree/14.0/project_task_recurring_activity"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_task_recurring_activity"><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/project&amp;target_branch=14.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/project/tree/16.0/project_task_recurring_activity"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_task_recurring_activity"><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/project&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>This module allow users to add activities to the recurring tasks and have them automatically duplicated within recurring tasks at set intervals.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -402,7 +402,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/project/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/project/issues/new?body=module:%20project_task_recurring_activity%0Aversion:%2014.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/project/issues/new?body=module:%20project_task_recurring_activity%0Aversion:%2016.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 @@ -425,13 +425,15 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<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>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/dessanhemrayev"><img alt="dessanhemrayev" src="https://github.com/dessanhemrayev.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/CetmixGitDrone"><img alt="CetmixGitDrone" src="https://github.com/CetmixGitDrone.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/14.0/project_task_recurring_activity">OCA/project</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/16.0/project_task_recurring_activity">OCA/project</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: 6 additions & 7 deletions project_task_recurring_activity/tests/test_project_recurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from odoo import _, fields
from odoo.exceptions import UserError
from odoo.tests.common import Form, SavepointCase
from odoo.tests.common import Form, TransactionCase


class TestProjectrecurrence(SavepointCase):
class TestProjectrecurrence(TransactionCase):
@classmethod
def setUpClass(cls):
super(TestProjectrecurrence, cls).setUpClass()
Expand All @@ -19,7 +19,7 @@ def setUpClass(cls):

cls.demo_user = (
cls.env["res.users"]
.with_context({"no_reset_password": True})
.with_context(no_reset_password=True)
.create(
{
"name": "demo",
Expand All @@ -37,7 +37,7 @@ def setUpClass(cls):
)
cls.demo_user2 = (
cls.env["res.users"]
.with_context({"no_reset_password": True})
.with_context(no_reset_password=True)
.create(
{
"name": "demo2",
Expand All @@ -58,7 +58,6 @@ def setUpClass(cls):
"name": "activity_a",
"default_user_id": cls.demo_user.id,
"summary": "summary",
"default_description": "description",
}
)
cls.mail_activity_b = cls.env["mail.activity.type"].create(
Expand All @@ -69,7 +68,7 @@ def setUpClass(cls):
)
cls.project_recurring = (
cls.env["project.project"]
.with_context({"mail_create_nolog": True})
.with_context(mail_create_nolog=True)
.create(
{
"name": "Recurring",
Expand All @@ -84,7 +83,7 @@ def setUpClass(cls):

cls.project_recurring2 = (
cls.env["project.project"]
.with_context({"mail_create_nolog": True})
.with_context(mail_create_nolog=True)
.create(
{
"name": "Recurring",
Expand Down
18 changes: 10 additions & 8 deletions project_task_recurring_activity/views/project_task.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
<field name="inherit_id" ref="project.view_task_form2" />
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<button
string="Create Next Recurring Task"
class="oe_highlight"
groups="base.group_no_one"
name="call_create_recurring_tasks"
type="object"
attrs="{'invisible': [('recurring_task','=',False)] }"
/>
<div groups="project.group_project_recurring_tasks">
<button
string="Create Next Recurring Task"
class="oe_highlight"
groups="base.group_no_one"
name="call_create_recurring_tasks"
type="object"
attrs="{'invisible': [('recurring_task','=',False)] }"
/>
</div>
</xpath>
<xpath expr="//notebook/page[@name='recurrence']" position="inside">
<group name="activities" string="Activities" />
Expand Down

0 comments on commit 2c3597b

Please sign in to comment.