Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
297 changes: 297 additions & 0 deletions social_media_base/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
=================
Social Media Base
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9ef0613fac59ec66dcecfb14f4bff101e89925782f08418a3cf3b64bdf731cd0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/17.0/social_media_base
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-social_media_base
: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/social&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module provides the fundamental foundation for social media
management. It facilitates the integration of user accounts, posts,
reactions (likes), comments, and graph-based analysis. Designed to be
flexible and scalable, it allows developers and businesses to integrate
and customize social features according to their needs.

Main features:

- Integration of multiple user accounts.
- Basic methods that can be extended and adapted to suit the social
media.
- Basic business structure.
- Dashboard of published posts with video and deletion indicators.
- Scheduled synchronization of post statistics (monthly cron), plus an
initial synchronization right after an account is linked.
- Account credentials (OAuth tokens) are only visible to administrator
users.

**Table of contents**

.. contents::
:local:

Usage
=====

Posts on the dashboard.
-----------------------

- The dashboard lists the publications that exist on the social media,
together with their statistics. A scheduled publication is not online
yet and a failed one never got there, so neither of them is listed:
they are followed from the *Posts* menu, on the post they belong to,
and the scheduled ones also in the calendar.

- Posts that contain a video display a video indicator on their card,
and the posts kanban shows a *Video (N)* counter.

- Posts deleted directly on the social media are marked as *Deleted on
<media>* and kept in the dashboard as history.

- Commenting a publication from the dashboard publishes the comment on
the social media, under the account of the publication, which is what
the composer announces.

- Deleting a post deletes the publications it created. A post whose
publications are still online cannot be deleted: remove them from the
dashboard first, which deletes them on the social media as well, or
archive the post to keep its history.

|DASHBOARD|

|POSTS_KANBAN|

Charts.
-------

- Go to *Social Media* > Charts

- The view shows one chart per connected account with the statistics of
its publications. The statistics are requested to the social media
when the view is opened, so a loader is displayed until they are
available.

- The statistics can be grouped by day, by week or by month, and the
period can be narrowed with the two dates. Each connector module
offers only the granularities its own social media supports, so the
list of the filter depends on the media of the account.

- The date range has to cover at least one whole unit of the granularity
selected: the social media group their statistics by that unit and
refuse a shorter range. A range of a single day grouped by month, for
example, is rejected before the network is even called.

|CHARTS|

Archive an account.
-------------------

- The account form provides an *Archive account* button, available to
the user responsible for the account.

|ACCOUNT_FORM|

- Archiving an account also archives its dashboard publications and the
posts left without any active account. A post that still targets an
active account stays visible, and it is archived as soon as its last
account is.

- Archiving a post archives its publications too. Archived posts are
found in the *Posts* menu with the *Archived* filter, and their form
shows an *Archived* ribbon and an *Unarchive* button.

- Nothing is removed from the social media. The archived account shows
an *Archived* ribbon and an *Unarchive account* button that restores
everything.

- A scheduled post whose date passed while the account was archived
comes back as *Draft*, with the reason in its chatter: unarchiving
never hands it to the scheduled action to be published on the spot.
Reschedule it to publish it.

Delete an account permanently.
------------------------------

- The account form provides a *Delete permanently* button, available
only to the *Social Media / Administrator* group. A regular user can
only archive his accounts, he is not allowed to delete them.
- It deletes the account, its dashboard publications and the posts that
were linked only to that account, together with their metrics,
comments and attachments.
- The records of the other applications that reference the account only
lose the link, they are **not** deleted.
- Nothing is deleted from the social media: the publications stay
online.
- This cannot be undone. To keep the history, archive the account
instead.

Scheduled publishing.
---------------------

- Setting *Send post* to *Schedule* proposes a date one hour from now
and leaves the post in the *Planned* state. The date can be changed.
- The scheduled action *Social Post: Send post schedule* sends the due
posts every 5 minutes, so a post is published up to 5 minutes after
its date.
- While the post is being sent it stays in the *Publishing* state.
- The scheduled action never sends a post twice: as soon as the
publication is over, the post leaves the states it looks for. What
happens when it does not go through everywhere is described in
*Partial failures* below.

Partial failures.
-----------------

- A post is sent to each of its accounts independently: if one account
fails, the publications that already succeeded are kept, with their
reference on the social media, and only the failed one is retried.
- The reason of the failure is shown on the failed publication, inside
the *Posts* tab of the post, and is also logged in the post chatter.
- If at least one account published, the post ends in the *Partially
Published* state. A message in the chatter names the accounts that
failed and notifies the user responsible for each of them.
- A *Partially Published* post is **never** retried by the scheduled
action: solve the problem and press *Post* again to send it to the
accounts that failed. The publications already online are not sent a
second time.
- Its content is frozen from that moment on: message, accounts, images,
videos and schedule can no longer be changed, because they describe
something that already exists on a social media. To publish something
different, create a new post.
- If **every** account fails, nothing reached the social media: the post
goes back to *Draft*, where it can be corrected, and it is no longer
retried automatically. The corrected message is the one sent when
*Post* is pressed again.

Expired credentials.
--------------------

- The token of an account is renewed on its own before publishing, and
again by the scheduled action *Social: Checking social media updates*,
so a post planned days ago does not meet a token that ran out in the
meantime.
- If the social media refuses the credentials anyway, the token is
renewed and the publication is sent a second time. That answer means
nothing reached the network, so nothing can be published twice.
- When the credentials cannot be renewed at all, because the
authorization was revoked or expired for good, the account is marked
as needing an update: the warning appears on the dashboard and its
responsible user is told in the chatter of the account. The
publication is left as failed with the reason on it, and pressing
*Post* again works once the account is authorized.
- Whether the account can renew its own token depends on the social
media, and each connector module documents it.

Statistics synchronization.
---------------------------

- The scheduled action *Social: Sync posts statistics* updates the post
statistics monthly. It also downloads the medias of the publications
created outside of Odoo, so those images appear on the dashboard only
after a synchronization.
- An initial synchronization is also triggered automatically right after
an account is linked.

Account ownership.
------------------

- Every account has a *Responsible* user, set to whoever linked it. A
regular user of the *Social Media / User: Own Accounts* group only
sees and manages his own accounts, their posts and statistics.
- Linking an account that already exists in Odoo (relinking it after
archiving it, after reinstalling the connector or to renew its tokens)
is restricted to that responsible user and to the *Social Media /
Administrator* group, because it overwrites the credentials and the
access tokens stored in the account.
- Accounts are recognised by the identifier they have on the social
media, not by their name: renaming the account on the social media
keeps the history in Odoo, and a name reused by a different account
never overwrites an existing one.
- If another user completes the association of an account that is not
his, nothing is written and a notification explains that the account
belongs to somebody else. The same happens when the administrator of
the wizard tries to change the credentials of an account that is not
his.
- The *Update account*, *Archive account* and *Unarchive account*
buttons of the account form are shown to the responsible user and to
the *Social Media / Administrator* group. The credentials themselves
(client keys and tokens) stay hidden from everybody but the system
administrators, and the connectors read and write them internally, so
an administrator of the application can renew them without ever seeing
them.

.. |DASHBOARD| image:: https://raw.githubusercontent.com/OCA/social/17.0/social_media_base/static/img/readme/DASHBOARD.png
.. |POSTS_KANBAN| image:: https://raw.githubusercontent.com/OCA/social/17.0/social_media_base/static/img/readme/POSTS_KANBAN.png
.. |CHARTS| image:: https://raw.githubusercontent.com/OCA/social/17.0/social_media_base/static/img/readme/CHARTS.png
.. |ACCOUNT_FORM| image:: https://raw.githubusercontent.com/OCA/social/17.0/social_media_base/static/img/readme/ACCOUNT_FORM.png

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/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/social/issues/new?body=module:%20social_media_base%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
-------

* BinhexTeam

Contributors
------------

- [Binhex Cloud] (https://www.binhex.cloud):

- Edilio Escalona Almira e.escalona@binhex.cloud

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.

.. |maintainer-edescalona| image:: https://github.com/edescalona.png?size=40px
:target: https://github.com/edescalona
:alt: edescalona

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-edescalona|

This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/social_media_base>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
11 changes: 11 additions & 0 deletions social_media_base/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2025 Binhex <https://www.binhex.cloud>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import controllers
from . import models
from . import wizards


def remove_social_media(env, media_type):
"""Remove the data of a social media, called from a connector ``uninstall_hook``."""
env["social.account"]._remove_social_media(media_type)
47 changes: 47 additions & 0 deletions social_media_base/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2025 Binhex <https://www.binhex.cloud>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Social Media Base",
"summary": "Basic module for social media management.",
"version": "17.0.1.0.0",
"category": "Social Network",
"development_status": "Beta",
"license": "AGPL-3",
"author": "BinhexTeam,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"maintainers": ["edescalona"],
"depends": ["base", "web", "mail"],
"data": [
"security/social_media_base_groups.xml",
"security/ir.model.access.csv",
"security/social_account_security.xml",
"security/social_post_security.xml",
"security/social_post_account_security.xml",
"security/wizard_social_account_security.xml",
"data/ir_cron_data.xml",
"views/social_media_views.xml",
"views/social_account_views.xml",
"views/social_post_views.xml",
"views/social_post_account_views.xml",
"views/social_action_client_views.xml",
"wizards/wizard_social_account.xml",
"views/social_media_base_menus.xml",
],
"assets": {
"web.assets_backend": [
("include", "web.chartjs_lib"),
"social_media_base/static/src/xml/**/*.xml",
"social_media_base/static/src/scss/**/*.scss",
"social_media_base/static/src/js/app/**/*.js",
"social_media_base/static/src/js/services/**/*.js",
"social_media_base/static/src/components/**/*.xml",
"social_media_base/static/src/components/**/*.js",
"social_media_base/static/src/components/**/*.scss",
"social_media_base/static/src/js/views/**/*.xml",
"social_media_base/static/src/js/views/**/*.scss",
"social_media_base/static/src/js/views/**/*.js",
],
},
"exclude": ["social"],
"installable": True,
}
4 changes: 4 additions & 0 deletions social_media_base/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2025 Binhex <https://www.binhex.cloud>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import thread
Loading
Loading