Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
43de8a6
[DRAFT] Cleaning of OCA database
arnaudlayec Mar 25, 2026
78d929d
[18.0][ADD] oca_sponsor
arnaudlayec Mar 25, 2026
657a96d
[18.0][NEW] DRAFT: Start minimal oca_membership for search engine
arnaudlayec Mar 25, 2026
4988a06
[18.0][IMP] Add into oca_all and oca_search_engine the synch logics f…
arnaudlayec Mar 25, 2026
dcbf001
Move PSC to oca_vcp and comment everything (as obsolete)
arnaudlayec Mar 31, 2026
9da2bf8
[oca_membership] Simplify Roles & Working Groups mgt:
arnaudlayec Mar 31, 2026
185befe
[DRAFT] schema: replace TypedDict with StrictExtendableBaseModel
arnaudlayec Apr 1, 2026
9c9c601
[REVIEW+SMALL FIX]
arnaudlayec Apr 3, 2026
459fbe5
[IMP] Avatar: switch to image_1920, and clean old default ones
arnaudlayec Apr 3, 2026
ab77d1f
fixup! fixup! FIX: color fix
sebastienbeau Apr 6, 2026
63337f6
pyproject: Update version of VCP + pytest version
sebastienbeau Apr 6, 2026
084f7c5
[IMP] move 'publish' fields to 'oca_membership' + other small reviews…
arnaudlayec Apr 8, 2026
84aa76e
pylint / pre-commit
arnaudlayec Apr 8, 2026
c107fef
[IMP] Add Github fields on my/home portal: login & sync avatar
arnaudlayec Apr 8, 2026
0912d00
DO NOT MERGE: Add module in test_requirement
sebastienbeau Apr 9, 2026
40fd578
[FIX] Tests of 'oca_sponsor' and 'oca_search_engine'
arnaudlayec Apr 9, 2026
358af85
oca_custom: disable everything (will be replaced by 'oca_membership_g…
arnaudlayec Apr 9, 2026
37f0471
Move scripts in migrations
arnaudlayec Apr 9, 2026
a9d8fe9
Fix pre-commit
sebastienbeau Apr 12, 2026
46c74f9
fixup! oca_custom: disable everything (will be replaced by 'oca_membe…
sebastienbeau Apr 12, 2026
a698c30
fixup! pylint / pre-commit
sebastienbeau Apr 12, 2026
5f5f419
[MIG] Disable 'website_oca_sponsor' and clean 'oca_custom' too. Keep …
arnaudlayec Apr 12, 2026
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
8 changes: 7 additions & 1 deletion oca_all/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,14 @@
"web_refresher",
"web_search_with_and",
"web_widget_dropdown_dynamic",
"website_oca_integrator",
"website_sale_hide_empty_category",
# Custom
"oca_custom",
"oca_membership",
"oca_search_engine",
"oca_sponsor",
"oca_website",
"website_oca_integrator",
"website_sale_oca_apps",
],
"installable": True,
Expand Down
65 changes: 65 additions & 0 deletions oca_all/migrations/18.0.1.0.0/post-migrate-avatar-reset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2026 Akretion (https://www.akretion.com).
# @author Arnaud LAYEC <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import logging

from openupgradelib import openupgrade

from odoo.tools import SQL

_logger = logging.getLogger(__file__)

BATCH_SIZE = 1000


@openupgrade.migrate(use_env=True)
def migrate(env, version):
"""Lots of avatar are duplicated on `res.partner`, and stored 'in hard' in database
though they are default avatar"""

# 1. Get partners with similar avatar (by checksum)
res = env.execute_query(
SQL("""
SELECT res_id
FROM ir_attachment
WHERE checksum IN (
SELECT checksum -- , COUNT(id), MAX(res_id)
FROM ir_attachment
WHERE res_model = 'res.partner' AND res_field = 'image_1920'
GROUP BY checksum
HAVING COUNT(id) >= 2
ORDER BY COUNT(id) DESC
)
AND res_model = 'res.partner'
""")
)
partner_ids = [y for x in res for y in x]
partners = (
env["res.partner"]
.browse(set(partner_ids))
.exists()
.with_context(prefetch_fields=False)
)

# 2. Cleaning duplicated avatars, by batch
if not partners:
_logger.info("No partner with duplicate avatar => stop here.")
return

partners_count = len(partners)
_logger.info("Start avatar cleaning: %d partners(s)", partners_count)

for i in range(0, partners_count, BATCH_SIZE):
offset = i * BATCH_SIZE
_logger.info(
"Batch %d: partners %d to %d...",
i + 1,
offset + 1,
min(offset + BATCH_SIZE, partners_count),
)

batch = partners[i : i + BATCH_SIZE]
batch.image_1920 = False

_logger.info("Avatar cleaning ended: %d partners cleaned.", partners_count)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2026 Akretion (https://www.akretion.com).
# @author Arnaud LAYEC <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import logging

from click_odoo import odoo
from openupgradelib import openupgrade

_logger = logging.getLogger(__file__)


@openupgrade.migrate(use_env=True)
def migrate(env, version):
"""Set Membership Categories on Products, as per their name
We now need them to manage the Role in the association.
This scripts helps recomputing the history and define the last active
'Category' in the association"""

_logger.info("Membership Category init: start")

# 1. Configure product: set `membership_category_id` based on products' name
mapped_categories = {
category.name.lower().split(" ")[0]: category
for category in env["membership.membership_category"].search([])
}
products = (
env["product.product"]
.with_context(active_test=False)
.search([("membership", "=", True)])
)
for product in products:
category = None
for category_name, category in mapped_categories.items():
if category_name in product.name.lower():
product.membership_category_id = category
break

# 2. On members, set `membership_category_id` based on their last membership line
members = env["res.partner"].search([("member_lines", "!=", False)])
for member in members:
last_line = odoo.fields.first(
member.member_lines.sorted("date_to", reverse=True)
)
member.membership_category_id = last_line.category_id

_logger.info("Membership Category init: done (%d members)", len(members))
6 changes: 1 addition & 5 deletions oca_custom/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

===================
OCA Custom Settings
===================
Expand All @@ -17,7 +13,7 @@ OCA Custom Settings
.. |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/license-AGPL--3-blue.png
.. |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%2Foca--custom-lightgray.png?logo=github
Expand Down
15 changes: 1 addition & 14 deletions oca_custom/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@
"website": "https://github.com/OCA/oca-custom",
"author": "GRAP, Akretion, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
"base",
"contacts",
"github_connector",
"membership",
"mail_group",
],
"data": [
"data/ir_cron_data.xml",
"data/ir_action_server_data.xml",
"views/res_config_settings.xml",
"views/res_partner.xml",
"views/mail_group.xml",
],
"depends": ["base"],
"installable": True,
}
11 changes: 0 additions & 11 deletions oca_custom/data/ir_action_server_data.xml

This file was deleted.

13 changes: 0 additions & 13 deletions oca_custom/data/ir_cron_data.xml

This file was deleted.

2 changes: 0 additions & 2 deletions oca_custom/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from . import res_partner
from . import res_config_settings
from . import mail_group
53 changes: 0 additions & 53 deletions oca_custom/models/mail_group.py

This file was deleted.

32 changes: 0 additions & 32 deletions oca_custom/models/res_config_settings.py

This file was deleted.

Loading
Loading