Commit Graph
55 Commits
Author SHA1 Message Date
Krzysztof Magusiak 74a5776482 [FIX] link_tracker: Compute URL with char tracking fields
Make link tracker handle other types than many2one for tracking fields.
Currently, when a field of type char is returned, an error occurs.

odoo/addons/utm/models/utm_mixin.py already handles other types than
many2one for tracking_fields(). This aligns to that behaviour in the
link tracker.

opw-2494686

closes odoo/odoo#71780

X-original-commit: a2068f9696917d7fa4848bc09d05eced84d0cc2f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-04 18:26:09 +00:00
Romain Derie 92175d3341 [IMP] *: replace web.base.url ICP by helper method
Previous commit introduce an helper to get the most suited URL for a record
instead of always using the ICP, which is not correct in a website context.

This commit replaces calls to ICP by the helper method.

Community: https://github.com/odoo/odoo/pull/68201
Enterprise: https://github.com/odoo/enterprise/pull/17538
Upgrade: https://github.com/odoo/upgrade/pull/2372

task-2476101
2021-06-02 10:04:29 +00:00
Luis González e852a10aa6 [FIX] link_tracker: Filter by tracked URL code is not working
When trying to filter links by a tracked URL code, the following warning
is shown:

    WARNING dbname odoo.models: Cannot execute name_search, no _rec_name
	defined on link.tracker.code

and the applied filter gives all records.

closes odoo/odoo#71398

X-original-commit: 3687dabbc373e57e24ca4596c18ef1dacfde8273
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-05-28 11:30:45 +00:00
std-odoo b7e5eb639a [FIX] link_tracker: clean code and fix add a constraint
Purpose
=======
Add a unicity constraint (on the url, UTM campaign, medium and source).
As we must care about null values, we can not implement it in SQL
(possible in pure SQL, but we will need to create an index on the
columns, which is not possible in Odoo if we want to customize the
error message).

Clean the code, before the "search or create" behavior was implemented
in the create, causing strange behavior (creating a link tracker with
the same values as an existing one didn't raise an error, but open
the form view of the existing link tracker).

Task-2090344

closes odoo/odoo#48845

Related: odoo/enterprise#9608
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-17 13:28:43 +00:00
Xavier Morel 303c895a86 [FIX] link_tracker: markuping in link shortening
`href` is `href="...`, so if the input is a Markup object it will get
escaped on `html.replace`, which means it will not actually match the
text we're looking for.

Therefore mark it as `Markup`, because that's essentially what it
is. This should have no effect if `html` is an `str`.
2021-04-29 05:34:20 +00:00
Ivan Yelizariev 3ccea22116 [FIX] link_tracker: prevent downloading big or non-html files
link tracker tries to get title from HTML, but the url may be not an html page
or too big html to process. It's a waste of bandwidth, but may also lead to a
Server Memory Limit error.

As a solution, make HEAD request and don't proceed to GET request if it's not an
html page or it's too big. Also, limit page downloading to 50KB.

STEPS:

- Have a standard database with link_tracker and mass_mailing.
- Create a new mass mail MM
- Add a link to a large file in MM Mail Body
- Click "SEND"
- Go to Settings / Technical / Automation / Scheduled Actions
- Open the "Process Mass Mailing Queue" or "Email Marketing: Process queue"
- Click "RUN MANUALLY"

---

opw-2457640

closes odoo/odoo#67948

X-original-commit: bdec63cf97e6904604e9f1e0bf3b6f453b6add60
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-03-16 13:21:14 +00:00
Martin Trigaux d5c1649239 [IMP] base,web: _for_xml_id as a safe access point
/web/action/load is the public controller that Should be used by the
webclient to fetch actions
_for_xml_id is the default access method on actions that implements
fields filtering to avoid leaking server action code or other
information not needed by the webclient

Implementing whitelist of fields that can be access per model
2020-08-17 09:08:23 +00:00
Thibault Delavallée fd62fa16ad [FIX] link_tracker, mass_mailing: make convert_link work in batch
In this commit we correctly use mailing variable inside a loop
on self to enable multi-mode on convert_links method.

We also update link_tracker shortening methods docstrings. We
add some explanation, notably about parameters. A variable is
fixed to better indicate parameter content (html -> content).

closes odoo/odoo#55452

X-original-commit: 3e1633d5b3590ec5657b851c21cbae059944d964
Related: odoo/enterprise#12218
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-08-05 10:39:09 +00:00
std-odoo b16843230d [IMP] mass_mailing: send a statistics email to the mailing responsible
Purpose
=======
Provide a follow-up/overview of the Mailing 24 hours after its been sent.

Specifications
==============
Send an email to the responsible of the mailing 24 hours the last email
of the mass mailing.

During the link trackers creation, extract the button label if exists
(so we can display them in the statistics email).

Technical remarks
=================
The statistics email is sent to the responsible of each mailing in the
CRON of mass mailing.

Task-2227411

closes odoo/odoo#49836

Related: odoo/upgrade#1094
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-06-12 11:49:45 +00:00
Sébastien Mottet (oms) fd87ff4843 [IMP] mass_mailing(_sms): "Click" stat button now redirects to link trackers
PURPOSE

Clarify the use case in which a specified email address is set as replies may
not be traceable. Make the %Click KPIs visible for Emails as well. Allow users
to report on the links that have (or not) been clicked from their
mailing.

SPECIFICATIONS

Display list of link trackers linked to the mailing on 'click' stat button
click.

Task ID: 2202495
PR #48339

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-27 11:00:29 +00:00
Victor FeyensandThibault Delavallee 3f6625ef13 [IMP] link_tracker, mass_mailing: uuse read_group instead of computing len of one2many fields
PURPOSE

Several counter fields are performed inefficiently. They use compute methods
using length of 2many fields instead of making use of more efficient ORM
methods like read_group.

SPECIFICATIONS

There may be a lot of clicks linked to a given link tracker. Compute the count
of clicks in batch with a read_group to improve performance.

Same for utm campaign mailing count performances.

Some missing indexes are added to speedup queries.

LINKS

Task ID 2196182
PR #44662

Co-Authored-By: Victor Feyens <vfe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
2020-04-21 12:28:52 +00:00
Thibault Delavallée aaefa35e29 [MOV] link_tracker, various: more link shortening tools to mail.render.mixin
PURPOSE

Move links shortening tools on mail.render.mixin to have rendering and
post procesing tools available on that mixin.

SPECIFICATIONS

Move html and text links shortening methods on mail.render.mixin class.
That way rendering and post processing is done in that mixin instead of
being specific to link.tracker model. Indeed those methods are tools and
not really business related methods.

Future commits will improve the way mail and sms composer use the render
mixin. This commit is therefore both a cleaning and preparing commit.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:25:04 +00:00
Paul Morelle c78cda8876 [FIX] link_tracker: support any url
URLs with parameters were not correctly supported by the regular
expression.
For example, URLs with parameters were truncated before the '?'.

This patch adds support for a wider range of URLs, and checks in a test
that the parameters are correctly handled.

closes odoo/odoo#39762

X-original-commit: 616e145635eac06a0a44ab3d899f4a9e707b3ba8
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2019-11-04 15:01:50 +00:00
ryv-odoo e0ba61d9fb [REM] website_links: remove favicon, icon_src for performance
The link tracker model (link.tracker) contained favicon (store)
and icon_src computed fields. Computing favicon took
{3-6.5%} of installing odoo (with demo data) due to syncronous http
call to a external link (google).
Moreover, these fields had no sense to be store in odoo
and only used in one template. This template was modified to
display the same information (icon) as before but without storing fields
and with a lazy loading of icons.

TASK_ID: 2083715

closes odoo/odoo#38405

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-10-10 15:19:43 +00:00
qmo-odoo 79bfdbf30c [MOV] mass_mailing_sms,link_tracker: Move convert_links_text to link_tracker
This method being needed in the new social app, it made sense to move it to
the link_tracker module to make it available for mass_mailing_sms and social
to avoid unnecessary duplicated code.

LINKS:

closes odoo/odoo#34973

Taskid: 2045210
Pr: 37143
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-09-20 14:44:57 +00:00
qmo-odoo af601da9be [IMP] utm, mass_mailing: clean utm.campaign model, form view and stat buttons
This commit cleans up the utm.campaign form view:

  * Don't display mailing related things if no mailings on the campaign or
    if the campaigns were not activated in mass_mailing settings;
  * Stat button for the mass mailings was wrong, it was displaying the number
    of mails instead of the number of mailings;
  * Remove unused global click ratio field all other fields/methods related
    to its computation;
  * Remove ab testing cta on campaign form;
  * Add groups on mailing related fields to avoid access errors;

LINKS

Task ID 2074813 (FP request UTM refactor)
PR: #37185
2019-09-20 14:21:25 +00:00
qmo-odoo ecd93e6639 [IMP] link_tracker: add global click count on campaign
Having a global click ratio on the campaign was pointless considering the
nature of the social.app and its posts. Therefore, we decided to have a
global click count which gives a better idea of the popularity of the campaign
itself.

Task ID 2074813 (FP request UTM refactor)
PR: #37185
2019-09-20 14:19:36 +00:00
Raphael Collet 9920f20e4c [IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-20 12:43:59 +00:00
qmo-odoo a661b00015 [REF] utm,mass_mailing: replace mass mailing campaign by utm campaign
PURPOSE

This commit removes the mass_mailing.campaign model. Instead of having a fully
fledged model, we will simply inherit utm.campaign. We will also add relevant
statistics on utm campaign model in order to use it in various applications.

SPECIFICATIONS

This commit removes the mass_mailing.campaign model. Instead of having a fully
fledged model, we will simply inherit utm.campaign. This change implies that
mass_mailing.tag and mass_mailing.stage have to move to the utm model along
their associated views/data.

These changes were made so that campaigns could be used in the future
by social, mass_mailing and mass_sms and available in the same view

This commit also removes the source_id and the medium_id
fields on the campaign.

This commit also moves the unique_ab_testing field from the mass_mailing_campaign
to the mass_mailing model

Task ID: 2002029
PR: #34015
2019-08-02 12:32:35 +00:00
Prakash Prajapati 1a33056557 [IMP] various: Clean stat buttons across all modules.
Purpose
=======

Make them consistent.
Make sure context is correctly set.
Prevent creation when necessary.

Specification
=============

See https://www.odoo.com/web#id=2024467&action=333&active_id=1251&model=project.task&view_type=form&menu_id=4720
for the detailed list of all the requested improvements.

TaskID: 2024467

closes odoo/odoo#34561

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-08-01 11:39:51 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00
Adrian Torres 9e71d57d11 [REM] *: remove calls to api.one and adapt code
Adapt all code that was using `api.one` to recordset-style method and
remove any and all calls to `api.one` in preparation for its removal.
2019-07-05 09:04:45 +00:00
Christophe Simonis 4eff0af02e [MERGE] forward port branch saas-12.1 up to 6878c9f342 2019-03-21 13:58:37 +01:00
Romain Derie a09236848c [FIX] link_tracker: prevent undeterministic order on new/recent filter
Before this commit, ordering by `create_date DESC` and `write_date DESC` could
lead to undeterministic order if multiple records had the exact same date.
This is the case during tests as `crate_date` is set to transaction start time.
(That's what NOW() in PSQL does)

Now, we enforce that order to avoid randomness.

Related to #31829

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-03-18 13:54:23 +00:00
Thibault Delavallée 6842d5cbd8 [IMP] link_tracker: make code field required on link.tracker.code model
Indeed it makes no sense to have void codes.

This commit is linked to task ID 1904277 and PR #28242.
2019-01-14 10:34:47 +00:00
Thibault Delavallée 7222f0ab53 [CLN] link_tracker: clean some code
Purpose of this commit is to remove some unnecessary code in link tracker.

 * remove unnecessary code / parameters:
 * remove unused field click_date on click as create_date is already used for
   that purpose;

This commit is linked to task ID 1904277 and PR #28242.
2019-01-14 10:34:27 +00:00
Thibault Delavallée b670911a92 [REF] link_tracker, mass_mailing: simplify add_click method and add tests
In this commit we rewrite a bit add_click in order to remove the inlined sudo
and ease inheritance and parameter management inside the method.

Access through controllers is sudo-ed as the main API method is now done
with current user access rights.

This commit is linked to task ID 1904277 and PR #28242.
2019-01-14 10:34:26 +00:00
Andrea 59289eda05 [FIX] link_tracker: _sql_constraints not applied
The unicity was not applied

closes odoo/odoo#29793
2018-12-31 09:16:39 +00:00
Thibault Delavallée 510bad0df3 [REF] link_tracker: clean module views
Purpose is
 * to clean a bit views;
 * to improve link.tracker form view to have information better displayed;
 * to remove unused views;

This commit is linked to task ID 1896681 and PR #27975.
2018-10-26 12:42:49 +00:00
Thibault Delavallée 37fcb1e6ff [REF] link_tracker: reorganize python according to guidelines
This was not correctly done when splitting the module at fd5361c0f7.
Future commits will clean a bit the code in order to better understand how
this module works.

This commit is linked to task ID 1896681 and PR #27975. No functional change
should occur with this commit as it contains only renaming / move.
2018-10-26 12:42:49 +00:00
Thibault Delavallée ae2866a11e [MOV] link_tracker: organize module structure according to guidelines
This module still holds old code and deserves some love. This commit cleans a
bit the init and manifest files as well as renaming view file according to
guidelines.

This commit is linked to task ID 1896681 and PR #27975. No functional change
should occur with this commit as it contains only renaming / move.
2018-10-26 12:42:49 +00:00
Thibault Delavallée dcec209805 [FIX] mass_mailing: fix tracking link creation in mass mailing
When using only mass mailing two issues arise when trying to send mass
mailings containing links

 * a link.tracker is created for each link to shorten; however rights are
   given currently only in website_links for website designers and not to
   marketing users that use mass mailing. This commit adds the rights for
   link.tracker model to those people;
 * a link.tracker.code is created to hold the shortened versions of the
   links. As it is a technical model it is now done as superuser as rights
   on link.tracked model has already been granted and adding rights on such
   a technical model is not necessary;

A test is added that checks what is done with links when sending mass
mailings. It helped spotting the hereabove issue.

This commit is linked to task ID 1889703 and PR #27526.
2018-10-18 13:57:02 +00:00
Nimesh Jethva d2ca8a1053 [IMP]marketing: Improvement in model description
Purpose of this commit is to give description more "business oriented"
because those descriptions appears in Odoo Studio which is supposed to be used by end users, not only by developers.

Related Task ID : 37311
2018-09-21 11:45:15 +02:00
rde 47b376e66d [FIX] link_tracker: python3 can't concat bytes to str 2017-10-12 16:20:42 +02:00
Prakash Prajapati 497ea3199f [FIX] link_tracker: Use the correct method name
Issue introduced by https://github.com/odoo/odoo/commit/7accd77999ebcd4ce16388f2a23ee296093fecbc
2017-09-22 15:24:59 +02:00
Thibault Delavallée 7accd77999 [REF][FIX] link_tracker, mass_mailing: factorize method creating link tracker click values
This commit factorizes the link.tracker.click values computation out of
the add_click method. This method is called when customers click on links
in email that are tracked in Odoo.

Purpose of this commit is

 * to effectively put mass mailing related code into mass mailing.
   Currently link_tracker holds code related to mass mailing which is
   not in its dependency tree. Let us therefore try to be a bit modular
   and add a proper inheritance in mass mailing;
 * allow addons to inherit from the click values prepare method to add
   specific values depending on their behavior like mass mailing adding
   links to a mass mailing and a mass mailing campaign;
2017-09-15 15:56:23 +02:00
xmo-odoo 02fe548000 [FIX] link_tracker: no string.letters in Python 3 2017-09-15 15:51:37 +02:00
Christophe Simonis 877e709871 [MERGE] forward port branch saas-16 up to db0810dc6e 2017-08-23 18:20:46 +02:00
Christophe Simonis db0810dc6e [MERGE] forward port branch saas-15 up to 0cfbc7581f 2017-08-23 18:15:56 +02:00
Christophe Simonis f8bf335aea [MERGE] forward port branch 10.0 up to 420e433fa3 2017-08-23 18:12:24 +02:00
Nicolas Martinelli 3b232b9eff [FIX] link_tracker: do not track 'tel:' or 'sms:' links
- Create a mass mailing including a 'tel' or 'sms' link, e.g.
  `<a href="tel:555-000-0000">555-000-0000</a>`
- When sent, the link is converted to a tracked linked (`http://...`)

We do not want to convert these links, they should be handled by the
browser directly.

opw-765885
2017-08-23 11:08:19 +02:00
Olivier Dony 695716efb0 [FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.

All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.

Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.

Also removed some dead code or improved the API to remove unnecessary
conversions.
2017-08-20 23:25:54 +02:00
Xavier Morel 3824b5dcc1 [FIX] P3: fix base64 and StringIO uses
* StringIO removed from stdlib, replace with io
* try to correctly handle BytesIO/StringIO (one is for bytes the other
  is for text)
* fix base64: Python 3 removed bytes-encoding and bytes-bytes
  codecs (via #encode) so replace all calls to str.encode('base64'),
  also b64encode is a bytes->bytes conversion so attempt to properly
  handle that

issue #8530
2017-08-20 23:25:54 +02:00
Xavier Morel 01e3514147 [FIX] P3: urllib, urllib2 and urlparse
In Python 3, all of these were "consolidated" under urllib(.request,
.parse, .errors) which is inconvenient.

Since we already have hard dependencies on requests and
werkzeug(.urls, which is a backport of Python 3's unicode-aware
urllib.parse) migrate *everything* to that.

A sticking point is urllib2.URLError, those were (mostly) replaced by
the slightly more general IOError which URLError extends.
2017-05-15 12:26:30 +02:00
xmo-odoo fffaf735f5 [FIX] P3: list -> iterable builtins (#16811)
In Python 3:

* various builtins and dict methods were changed to return
  view/iterable objects rather than lists
* and the separate Python 2 view/iterable builtins and methods were
  removed altogether

This is problematic when using these items as list (which the happens
repeatedly in Odoo), but more viciously when iterating *multiple times*
over them (which also happens, which I've messed up multiple times while
writing this, and which is a pain to debug even when you've just created
the issue).

Convert all code using these to semantics-matching cross-version
helper functions to get the LCD behaviour between P2 and P3, and
forbid the builtins via lint.

issue #8530
2017-05-10 09:39:55 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Christophe Simonis 85368d7f86 [MERGE] forward port branch 10.0 up to 387b2acfcb 2017-02-23 20:15:38 +01:00
Christophe Simonis 387b2acfcb [MERGE] forward port branch saas-11 up to 1730dca101 2017-02-23 19:40:03 +01:00
Denis Ledoux b7dffb59ff [FIX] link_tracker: convert link with ampersand
Links containing HTML escaped characters,
such as the ampersand
`&` escaped `&amp;`
were not shortened correctly:
Their redirecting URL contained the escaped value
(e.g. `&amp;`) instead of the actual character,
leading to the wrong redirected URL.

e.g. creating a mass-mailing with a link
contains as query string
?test1=1&test2=2 were shortened
with as redirect link
?test1=1&amp;test2=2

opw-708272
2017-02-21 12:26:02 +01:00
Raphael Collet d0ca2d115e [REF] ir_config_parameter: remove group_ids and simplify
Add `sudo()` to call `get_param` where necessary, and make the web client use a
controller instead of directly accessing parameters.
2017-01-03 16:52:49 +01:00