T3305-Tracking-UTM - #2129
Open
loris-fab wants to merge 3 commits into
Open
Conversation
Campaign analysis only covered digital interactions, while physical mailings appear to be more efficient. Communications can now carry the UTM parameters of the campaign they belong to, including the ones dispatched outside of Odoo. - Add Source, Medium and Campaign on the communication and on its type, the communication starting with the values configured on its type. - Record mailings sent by a printing house by importing the recipient list as a CSV: a communication created as done is never merged into a pending one, and nothing is generated nor sent for it. As a safety net, an import never sends anything on its own, whatever the state of the imported lines. - Move utm_campaign_id down from partner_communication_compassion, where it was declared but referenced nowhere, so the base module carries all three. - Fix a crash when opening the communication creation form: the type has a default value but no partner is selected yet, and build_inform_mode was iterating over the delivery preference of an empty partner.
Confidence Score: 4/5
What T-Rex did
|
A job set to send automatically already has its send task in the queue, with a 10 seconds eta. Merging imported values into it made that task deliver them too when it ran, which the no_send guard did not catch: it only prevented the immediate, synchronous send. Imported values now stay in their own job, which is created without auto_send.
Guarding on auto_send was not enough: the field is editable, so clearing it on a communication whose send task is already queued would let an import merge into it, and the queued task would then deliver the imported records. An import now never merges at all, which removes the whole race rather than guessing whether a send is pending. Every imported line keeps its own record.
There was a problem hiding this comment.
Greptile has paused reviews on this repository — it used its 100 free open-source review credits for this billing period. Reviews resume automatically on August 13. To continue before then, an organization admin can keep reviews running past the free credits — those bill as normal usage.
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.
Goal
Our campaign analysis only covers digital interactions, while physical mailings
(white mail, magazines) appear to be more efficient. To measure those offline
campaigns, Odoo needs to record what was sent, to whom, and when it was
dispatched even though the dispatch itself happens outside of Odoo, at a
printing house.
Communications already are the history of everything a partner receives, so they
are what gets extended, rather than adding a parallel tracking model.
Technical aspect
UTM fields.
partner.communication.joband onpartner.communication.config. Acommunication starts with the values configured on its type, through the
existing
_get_default_valsmechanism . The same one that already copiesreport_idandneed_call. That also gives the pre-filling on the type'sonchangefor free.utm_campaign_idmoved down frompartner_communication_compassion, whereit was declared but referenced by no view and no code, into the base module
alongside the two new ones. The column already exists, so no data migration.
artner_communication,partner_communication_compassion
CSV import: recording a mailing that was dispatched outside of Odoo at a
printing house, typically is done by importing the recipient list with the
standard Import records button on Contacts → Partner Communication →
Communication Jobs. No dedicated wizard was added: an import is an ordinary
creation, driven entirely by the columns of the file.
How it works
state = doneis what marks an external mailing. A communication createdin that state records something already dispatched: it is never merged into a
pending communication, its sending date is filled in when missing, and Odoo
skips attachment generation, PDF rendering, call scheduling and sending. The
convention already existed in the module .
lines. Without that safety net, importing a list against a communication type
configured to send automatically would dispatch the whole file for real.
and Campaign configured on its type(partner.communication.config), so the columns only need to be present
when a line departs from that default.
Columns
partner_idreffield), or the partner nameconfig_idstateDonefor a mailing that was already dispatchedsend_modePrint reportfor a letter (or the technical valuephysical)subjectutm_source_idutm_medium_idutm_campaign_idsent_datePitfalls
into
False, so the key is present and no default applies: the UTM fieldsstay empty instead of inheriting from the communication type. To rely on the
defaults, leave the column out of the file entirely.
_compute_email_template_idskips communications that are already done, so no template is attached and
both subject and body stay empty. This is intended (what was printed did not
come from Odoo ) but since the subject is the display name, the lines appear
blank in lists.
Bug fix. Opening the communication creation form raised
TypeError: argument of type 'bool' is not iterable. The form has a defaultcommunication type but no partner yet, and
build_inform_modewas iteratingover the delivery preference of an empty partner recordset.
create()is split into_prepare_create_valsand_merge_into_pending_job;it was over the complexity limit enforced by
ruffotherwise.Misc
utm_campaign_idchanges owningmodule: updating only
partner_communication_compassionwould leave the fielddeclared nowhere.
doneduring the import keep no subject or body, since_compute_email_template_idskips communications that are already done. Thisis intended (what was printed did not come from Odoo).