Commit Graph
4 Commits
Author SHA1 Message Date
Laurent Desausoi 7593c073d2 [IMP] core: use inert SQL based neutralization
Before this commit the neutralize system introduced in v16 was using ORM
methods in order to change appropriate records. Although flexible, this approach
could lead to call some methods with side effects while neutralizing
(eg: overloads of write).

This patch converts the neutralize system to a safer "inert" SQL based approach
by migrating the generic method _neutralize to SQL files exposed in the
data folder.

Task id: 2961687

closes odoo/odoo#102792

X-original-commit: e5dbded9bb363351feff7ca8a56c7f8a6860f492
Related: odoo/enterprise#32580
Signed-off-by: Fabien Meghazi <fme@odoo.com>
2022-10-09 22:04:00 +02:00
Christophe Monniez 4fc7b9e329 [IMP] iap, various: implement _neutralize method
An overridable model method was added in a previous commit in order to
neutralize a database.

This commit adds the implementation of this method on the `iap.account` model.
A _get_iap_config_paremeters method is also added on this model.
Each iap service must override this method to extend the list of
`ir.config_parameter` that need to be neutralized.

Part-of: odoo/odoo#67825
2022-02-01 09:54:08 +00:00
97f2957821 [IMP] partner_autocomplete: automatically enrich user companies
In order to make a wow effect right after DB install we enrich the base
company based on the given email address or company website at install.
In order to achieve that goal we use the partner_autocomplete service from
IAP. It uses free credits that are offered to new clients on saas platform.

Only the fields that are not filled yet are enriched to avoid erasing user
entered data, except logo. Indeed as partner_autocomplete is probably installed
as a core app (mail -> iap -> partner_autocomplete auto install chain) it is
unlikely that people already updated their company logo.

We consider that having a call to IAP consuming a token is ok for a standard
use case, especially that

  * if no iap service is configured call to IAP won't add much timing;
  * on Odoo SaaS free credits are given and company is enriched;
  * on custom SaaS with custom iap service, at db creation probably no
    credits are given and call will simply give no results back;

We decided to call IAP asynchronously at client web load. Session combined to
a boolean field on company model allows to do this call only once per company.
Doing this allows to avoid adding yet another post init hook. It also eases
behavior tweak through inheritance.

This call is limited to admin for obvious security reasons as well as
performance reason (limiting calls to external providers). As call will be
done once per company generally admin is the first person to log into the
its newly created Odoo.

LINKS

Task ID-2322455
PR odoo/odoo#64600
PR odoo/upgrade#2086

Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
2021-02-01 13:53:59 +00:00
Thibault DelavalléeandDavid Beguin d3c5300272 [IMP] partner_autocomplete: extract iap calls in a separate model and add a mock
In this commit we move iap functions onto a small tool model. It allows to
hide some details in a sub model. It also allows to define a mock that will
be used in tests afterwards.

LINKS

Task ID-2322455
PR #64600
PR odoo/upgrade#2086

Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
2021-02-01 13:53:59 +00:00