Repository navigation
Conversation
…ships from their origin The fundraising detail of a sponsorship moves from the analytic account of its origin to its UTM campaign, which reporting reads through the contract of each journal item. - recurring.contract.origin gets a campaign, given to its sponsorships that have none (on creation, on change of origin, on change of the campaign of the origin); a sponsorship with its own campaign keeps it - each event gets a campaign named after it when it has none, given to its origins; a copied event gets its own campaign - migration: the origins of an event take its campaign, then their sponsorships without campaign Assisted-by: claude-opus-5-5, high, claude-code
A campaign groups several occasions (events, mailings, publications), each of them a source. An event is therefore a source, named after it, and its campaign is optional. A peer-to-peer fundraising event (crowdfunding, sport) is a campaign instead, each fundraiser being a source. The origin also gets a source, given to its sponsorships that have none, like its campaign. Assisted-by: claude-opus-5-5, medium, claude-code
…paign Lets other modules turn an event into a peer-to-peer one after its creation. Assisted-by: claude-opus-5-5, medium, claude-code
…and campaign of its parent It comes from the same fundraising; the source and campaign "Sub sponsorship" hid it in the reporting. Assisted-by: claude-opus-5-5, medium, claude-code
- utm.source gets a category (event, fundraiser, ambassador, existing sponsor, media, advertising, mailing, web, transfer, other, unknown): the high level fundraising axis of the reports - a sponsorship always has a source: Unknown when neither it nor its origin has one; an Unknown source follows the origin like an empty one - the sources of the events and of the communications get their category - a sub sponsorship also keeps the medium of its parent Assisted-by: claude-opus-5-5, medium, claude-code
A sponsorship created without medium gets the one of its source (by name, then by category: event -> Event, fundraiser and web -> Website, ambassador -> Personal contact, media and advertising -> Print), else Other. Assisted-by: claude-opus-5-5, medium, claude-code
… from the UTM, fewer analytic accounts - the event of a journal item comes from the origin of its sponsorship, then from the source or campaign of its invoice, then from its analytic accounts (history) - the analytic account of a new event goes to a configurable plan, only for configurable types (system parameters crm_compassion.analytic_event_plan_id and crm_compassion.analytic_event_types; default: every event in Events) - no analytic account per portal user nor per partner origin anymore: the ambassador is the source of the sponsorships Assisted-by: claude-opus-5-5, medium, claude-code
…mpaigns, sources and events The income of a campaign, a source or an event is followed by the UTM; its expenses by an analytic account created on demand (button Track expenses), in the plan of the system parameter sponsorship_compassion.cost_analytic_plan_id. The account points to its campaign and / or source, so a report can put the funds raised next to the expenses. Assisted-by: claude-opus-5-5, medium, claude-code
…sts with the default settings The account of an event migrated in another plan moves to the plan given by the settings for its type (crm_compassion.analytic_event_plan_id, default Events), not only to Events. The tests of the event analytic plan start from the default settings, so they pass on a database with other ones. Assisted-by: claude-opus-5-5, medium, claude-code
[High impact] The PR appears safe to merge; no new blocking issues were found. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Opportunity[Opportunity campaign] --> Event[Event]
Event --> Origin[Origin campaign and source]
Origin --> Contract[Sponsorship tracking]
Contract --> Journal[Journal item event]
Invoice[Invoice tracking] --> Journal
Journal --> Income[Paid donation income]
Event --> Account[Optional analytic account]
Account --> Expenses[Event expenses]
Reviews (4) · Last reviewed commit: "[FIX] crm_compassion: event income searc..." · Reviewed by Greptile |
…bution - A new sponsorship takes the UTM defaults (context, website cookies of utm.mixin) before the ones of its origin and the Unknown source. - On the form, changing the origin replaces the campaign / source of the origin selected before, and keeps the ones chosen apart. - The event of a journal item is computed again when the source or campaign of its invoice changes. - Editing an event no longer fails when Odoo refuses to move its analytic account to the plan of its type (a line already holds another account of that plan): the account stays in its plan, as in the migration. - Changing the type of an event sets up its UTM (campaign of a peer-to-peer event, source of another one) and gives it to its origins. Assisted-by: claude-opus-5-5, medium, claude-code
…paign An action of several events (e.g. a speaker tour) is one campaign; each event created from its opportunities gets that campaign, and its own source. Assisted-by: claude-opus-5-5, medium, claude-code
The invoice lines of a sponsorship now get the event of its origin, so each invoice of the monthly invoicing recomputed the income of its event by loading all the event's invoice lines (thousands for some events): +15% on the invoicing time on a copy of the production database. The income lines and total are now searched / summed in the database (same rule: paid customer invoice lines without sponsorship), and the income lines depend on the invoice lines, so they follow their payment. Assisted-by: claude-opus-5-5, medium, claude-code
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In v14 every event, ambassador, partner origin... had its own analytic account, so the analytic plans grew to thousands of accounts and mixed two questions: where does the money come from and how is it allocated. After the v18 migration we keep the analytic plans for allocation and funds only, and the fundraising detail moves to the standard UTM fields (campaign / source / medium) of the sponsorships and invoices. The reporting reads the UTM of each journal item through its contract (else through its invoice).
UTM model:
Changes
sponsorship_compassion / crm_compassion
recurring.contract.origingets a campaign and a source, given to its sponsorships that have none (on creation, on change of origin, on change of the origin's UTM). A sponsorship with its own UTM keeps it._ensure_campaign), given to its origins. A copied event gets its own.utm.source.category; sources of events and communications get theirs.crm_compassion.analytic_event_types, in the plancrm_compassion.analytic_event_plan_id(system parameters; default: every event, plan Events, i.e. unchanged behaviour);sponsorship_compassion.cost_analytic_plan_id, pointing to its campaign / source, so a report can put funds raised next to expenses.sponsorship_sub_management
Migration
crm_compassion18.0.1.1.0 post-migration: the origins of an event take its campaign (when they have none), then their sponsorships without campaign take it. Sources are set by the clean-up script below.crm_compassion18.0.1.1.0,sponsorship_compassion18.0.1.1.0,sponsorship_sub_management18.0.1.0.1.Impact on other offices (Nordic)
Tested on a copy of a recent Nordic database (
odoo-nordic.conf): upgrade OK, no data changed by the upgrade.crm_compassionis not installed at Nordic: the event, analytic plan and portal changes don't apply.Tests
crm_compassion/tests/test_event_campaign.py,sponsorship_compassion/tests/test_origin_campaign.py;test_event_analytic.py(T3491/T3511) adapted to start from the default settings.base.res_partner_address_*, andrandintgiven a float intest_project_compassion).Companion PR: CompassionCH/compassion-website
18.0-utm-from-origin-v2(fundraisers as sources, crowdfunding campaigns), which depends on this one.🤖 Generated with Claude Code