-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
23 changed files
with
1,011 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
=================== | ||
Membership Activity | ||
=================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:6891f99197610e0eca1d1728218ce6b197ae75351c4ef2bd0e50de2745a0dbd9 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fvertical--association-lightgray.png?logo=github | ||
:target: https://github.com/OCA/vertical-association/tree/16.0/membership_activity | ||
:alt: OCA/vertical-association | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/vertical-association-16-0/vertical-association-16-0-membership_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/vertical-association&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to track activities of members.This is a base module that allows to define some basic membership activities | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
#. Go to *Members > Configuration > Activity Types*. | ||
#. Create different activity types as you want for Membership Activity model. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Create Activity Types as needed. | ||
#. Create Membership Activities defining the project, activity type, date of activity and url(possibly defining url for commits,PRs etc). | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/vertical-association/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/vertical-association/issues/new?body=module:%20membership_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. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Onestein | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Onestein <http://www.onestein.eu>`_ | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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/vertical-association <https://github.com/OCA/vertical-association/tree/16.0/membership_activity>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "Membership Activity", | ||
"summary": "Track activity of members", | ||
"category": "Membership", | ||
"version": "16.0.1.0.0", | ||
"author": "Onestein, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/vertical-association", | ||
"license": "AGPL-3", | ||
"depends": ["membership", "project"], | ||
"data": [ | ||
"data/reconcile_partner_cron.xml", | ||
"security/ir_model_access.xml", | ||
"views/res_partner_view.xml", | ||
"views/membership_activity_view.xml", | ||
"views/membership_activity_type_view.xml", | ||
"menuitems.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
Copyright 2024 Onestein | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
--> | ||
<odoo noupdate="1"> | ||
<record id="reconcile_partner_cron" model="ir.cron"> | ||
<field name="name">Set partner on membership activities</field> | ||
<field name="active" eval="True" /> | ||
<field name="model_id" ref="model_membership_activity" /> | ||
<field name="state">code</field> | ||
<field name="code">model.reconcile_partner()</field> | ||
<field name="interval_number">1</field> | ||
<field name="interval_type">days</field> | ||
<field name="numbercall">-1</field> | ||
<field name="user_id" ref="base.user_root" /> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<menuitem | ||
id="membership_activities_menu" | ||
parent="membership.menu_association" | ||
action="membership_activity_action" | ||
sequence="90" | ||
name="Activities" | ||
/> | ||
|
||
<menuitem | ||
id="membership_activity_type_menu" | ||
parent="membership.menu_marketing_config_association" | ||
action="membership_activity_type_action" | ||
name="Activity Types" | ||
/> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from . import membership_activity | ||
from . import membership_activity_type | ||
from . import res_partner | ||
from . import project_project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class MembershipActivity(models.Model): | ||
_name = "membership.activity" | ||
_description = "Member Activity" | ||
|
||
partner_id = fields.Many2one( | ||
comodel_name="res.partner", | ||
string="Member", | ||
ondelete="cascade", | ||
store=True, | ||
compute="_compute_partner_id", | ||
) | ||
project_id = fields.Many2one( | ||
comodel_name="project.project", string="Related Project", ondelete="cascade" | ||
) | ||
date = fields.Datetime(required=True) | ||
url = fields.Char() | ||
type_id = fields.Many2one( | ||
comodel_name="membership.activity.type", string="Activity Type" | ||
) | ||
|
||
def name_get(self): | ||
res = [] | ||
for activity in self: | ||
res.append((activity.id, activity.partner_id.display_name)) | ||
return res | ||
|
||
def _compute_partner_id(self): | ||
# To be implemented by other modules | ||
# For example for CDE activity, the activity can be created before the member | ||
# is created in the system | ||
pass | ||
|
||
def reconcile_partner(self): | ||
self.search([("partner_id", "=", False)])._compute_partner_id() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class MembershipActivityType(models.Model): | ||
_name = "membership.activity.type" | ||
_description = "Member Activity Type" | ||
_parent_store = True | ||
_parent_name = "parent_id" | ||
|
||
name = fields.Char() | ||
parent_id = fields.Many2one( | ||
comodel_name="membership.activity.type", | ||
string="Parent Activity Type", | ||
index=True, | ||
) | ||
child_ids = fields.One2many( | ||
comodel_name="membership.activity.type", | ||
inverse_name="parent_id", | ||
string="Sub Activity Types", | ||
) | ||
parent_path = fields.Char(index=True, unaccent=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from datetime import datetime | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class Project(models.Model): | ||
_inherit = "project.project" | ||
|
||
membership_activity_ids = fields.One2many( | ||
comodel_name="membership.activity", | ||
inverse_name="project_id", | ||
string="Member Activities", | ||
) | ||
membership_activity_count = fields.Integer( | ||
string="# of Activities", | ||
compute="_compute_membership_activity_count", | ||
store=True, | ||
) | ||
last_membership_activity_date = fields.Date( | ||
string="Last Activity Date", | ||
compute="_compute_last_membership_activity_date", | ||
store=True, | ||
copy=False, | ||
) | ||
|
||
@api.depends("membership_activity_ids") | ||
def _compute_membership_activity_count(self): | ||
for project in self: | ||
project.membership_activity_count = len(project.membership_activity_ids) | ||
|
||
@api.depends("membership_activity_ids") | ||
def _compute_last_membership_activity_date(self): | ||
for project in self: | ||
project.last_membership_activity_date = ( | ||
project.membership_activity_ids | ||
and max(project.membership_activity_ids.mapped("date")) | ||
) | ||
|
||
def get_last_membership_activity_date_by_type(self, type_id_or_xml_id): | ||
self.ensure_one() | ||
activity_type_id = type_id_or_xml_id | ||
if type(type_id_or_xml_id) == str: | ||
activity_type_id = self.env.ref(type_id_or_xml_id).id | ||
matching_activities = self.membership_activity_ids.filtered( | ||
lambda a: a.type_id.id == activity_type_id | ||
).mapped("date") | ||
if not matching_activities: | ||
return datetime.min | ||
return max(matching_activities) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class ResPartner(models.Model): | ||
_inherit = "res.partner" | ||
|
||
membership_activity_ids = fields.One2many( | ||
comodel_name="membership.activity", | ||
inverse_name="partner_id", | ||
string="Member Activities", | ||
) | ||
membership_activity_count = fields.Integer( | ||
string="# of Activities", | ||
compute="_compute_membership_activity_count", | ||
store=True, | ||
) | ||
last_membership_activity_date = fields.Date( | ||
string="Last Activity Date", | ||
compute="_compute_last_membership_activity_date", | ||
store=True, | ||
copy=False, | ||
) | ||
|
||
@api.depends("membership_activity_ids") | ||
def _compute_membership_activity_count(self): | ||
for partner in self: | ||
partner.membership_activity_count = len(partner.membership_activity_ids) | ||
|
||
@api.depends("membership_activity_ids") | ||
def _compute_last_membership_activity_date(self): | ||
for partner in self: | ||
partner.last_membership_activity_date = ( | ||
partner.membership_activity_ids | ||
and max(partner.membership_activity_ids.mapped("date")) | ||
) | ||
|
||
def open_membership_activity(self): | ||
action = self.env["ir.actions.act_window"]._for_xml_id( | ||
"membership_activity.membership_activity_action" | ||
) | ||
action["domain"] = [("partner_id", "in", self.ids)] | ||
return action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
To configure this module, you need to: | ||
|
||
#. Go to *Members > Configuration > Activity Types*. | ||
#. Create different activity types as you want for Membership Activity model. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* `Onestein <http://www.onestein.eu>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module allows to track activities of members. This is a base module that allows to define some basic membership activities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
To use this module, you need to: | ||
|
||
#. Create Activity Types as needed. | ||
#. Create Membership Activities defining the project, activity type, date of activity and url(possibly defining url for commits,PRs etc). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<record id="membership_activity_access" model="ir.model.access"> | ||
<field name="name">membership_activity_access</field> | ||
<field name="model_id" ref="model_membership_activity" /> | ||
<field name="group_id" ref="base.group_user" /> | ||
<field name="perm_read" eval="1" /> | ||
<field name="perm_create" eval="1" /> | ||
<field name="perm_write" eval="1" /> | ||
<field name="perm_unlink" eval="1" /> | ||
</record> | ||
|
||
<record id="membership_activity_type_access" model="ir.model.access"> | ||
<field name="name">membership_activity_type_access</field> | ||
<field name="model_id" ref="model_membership_activity_type" /> | ||
<field name="group_id" ref="base.group_user" /> | ||
<field name="perm_read" eval="1" /> | ||
<field name="perm_create" eval="1" /> | ||
<field name="perm_write" eval="1" /> | ||
<field name="perm_unlink" eval="1" /> | ||
</record> | ||
</odoo> |
Oops, something went wrong.