Commit Graph
507 Commits
Author SHA1 Message Date
mreficent 0632274451 [IMP] base: add hook to be able to hide more module categories
closes odoo/odoo#32662

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-05-10 10:21:44 +00:00
Xavier Morel 2cc7f0dd49 [IMP] core: allow auto_install restriction on a subset of dependencies
Currently, auto_install is triggered when all dependencies get
installed, but there are cases where one would want such trigger on
only a subset thereof.

e.g. we want `website_sale_dashboard` to auto-install when
`website_sale` is installed. Currently, it requires `web_dashboard` to
also be auto-installed otherwise `website_sale_dashboard` would "wait"
for both dependencies to be explicitly installed before the
auto-install triggers. That's despite `web_dashboard` not being very
useful on its own. More generally this is an issue with technical
modules which need to be marked as auto_install so as not to block
e.g. bridge modules from automatically installing.

This change allows setting `auto_install` to a subset of `depends`:

* if auto_install is set to `False`, the module does not get
automatically installed (no change in semantics)
* if auto_install is set to `True`, the module gets automatically
installed if and only if all its dependencies are installed (also no
change in semantics)
* if auto_install is set to a list of dependencies, the module will be
installed when all *these* dependencies are installed, other
dependencies (excluded from auto_install) will be installed
alongside as a consequence
* auto_install can be set to an empty list, in this case the module
will always be automatically installed regardless of its
dependencies (and will force their installation).

So after this change, `web_dashboard`'s auto_install can be set to
`False` (such that it's not installed if no module defining dashboards
is installed) and `website_sale_dashboard`'s manifest can be edited
to:

'auto_install': ['website_sale']

possibilities:

# no automatic installation
'depends': ['a', 'b'],
'auto_install': False

# automatic installation if both a and b are installed
'depends': ['a', 'b'],
'auto_install': True

# automatic installation if both a and b are installed (explicit)
'depends': ['a', 'b'],
'auto_install': ['a', 'b']

# automatic installation if b is installed, a will get forcefully
# installed if it isn't yet
'depends': ['a', 'b'],
'auto_install': ['b']

# always automatically installed, will cause the installation of
# its dependencies even if they're not marked explicitly
'depends': ['a', 'b'],
'auto_install': []

Task 1851328

closes odoo/odoo#29431

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-05-07 11:44:26 +00:00
Priyanka Kakadiya ac77a6ce8e [REF] base: handle groups for server action
Users may not do all actions bound to a model. We add the `groups_id` field
on `ir.actions.server` so that `get_bindings` can filter out unauthorized ones.

task id- 1945291
2019-05-08 09:40:11 +00:00
Raphael Collet d0dbcacfff [IMP] models: new implementation of prefetching 2019-05-06 09:44:10 +00:00
Hetal Dhanak b5b7396b84 [IMP] base: updated tooltip of implementation field in ir.sequence
-customers were misunderstanding the concept of "no gap" sequence
implementation hence updated the tooltip of the same to make it more useful and
clearer.

Task-1973967

closes odoo/odoo#33017

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-05-08 05:13:39 +00:00
Hiral Bhavsar a02d273ebc [IMP] base, mail: set CRUD on activity view as attributes
Just like other views (form, list, kanban, etc.) CRUD operations (create,
delete and edit) are now set as attributes on the activity node based on
the user access rights.

Task 1894990
2019-05-03 10:19:40 +00:00
Raphael Collet f44571f550 [IMP] base: remove mapped() where not necessary 2019-04-30 07:54:49 +00:00
Sébastien Theys 425f197f16 [IMP] tools,base,*: remove intermediary image functions
* = hr, im_livechat, mail, payment, purchase, web, web_editor, web_unsplash,
	website_profile, website_slides

Since the merge of all image tools into one function, the intermediary functions
are not needed anymore.

task-1958000
PR: #31811
2019-04-29 13:45:34 +00:00
Sébastien Theys d870877967 [IMP] tools,base,web,website_*: keep image ratio on resize
* = website_partner, website_profile, website_sale, website_slides

Before
======

Since commit: 2e3848b394

The images that are resized have additional borders if the target ratio is
different than the image ratio. Those borders are transparent if the image
format supports it, and are white otherwise.

With that current solution, if the background where the image is displayed is
another color than white, it is looking really bad.

Moreover, most images are stored resized like this, so it is not even possible
to decide if it should have borders or not depending on the context, the
original image and ratio is forever lost.

It is also inconsistent because if the image is already smaller than the target
size then it doesn't include borders. In that case it keeps the original ratio
instead of the target ratio. So it isn't even guaranteed that the target
ratio is going to be respected.

After
=====

This commit will solve all of those problems by always keeping the ratio of the
original image.

This implies the views should be taking care of adding borders when necessary.

task-1958000
PR: #31811
2019-04-29 13:45:03 +00:00
Sébastien Theys d303518841 [IMP] tools,base: remove image encoding parameter
The image tools were accepting an encoding parameter but it was never used.
Indeed the given images are always encoded in base64.

`image_colorize` was the only method not taking base64 directly, so it has been
modified for consistency. This allows to change the code in partner to not
base64 decode the image in some case just to be base64 encode it again after.

`crop_image` and `limited_image_resize` have been slightly refactored to account
for this change, but in this commit their behavior was kept.

task-1958000
PR: #31811
2019-04-29 13:45:03 +00:00
Christophe Simonis e145f2b0c8 [MERGE] forward port branch saas-12.2 up to 2694174b41 2019-04-10 15:10:24 +02:00
Christophe Simonis c9e1deb496 [MERGE] forward port branch saas-12.1 up to af313858b4 2019-04-09 20:48:01 +02:00
Christophe Simonis af313858b4 [MERGE] forward port branch 12.0 up to c1c322dd40 2019-04-09 20:43:35 +02:00
Christophe Simonis 6c8e30cae6 [MERGE] forward port branch saas-12.1 up to 6d4940675f 2019-04-09 12:16:06 +02:00
Christophe Simonis 6d4940675f [MERGE] forward port branch 12.0 up to ea1fc124ef 2019-04-09 11:11:48 +02:00
Christophe Simonis fef49061ea [MERGE] forward port branch saas-11.3 up to 4c61621efb 2019-04-08 19:52:29 +02:00
Christophe Simonis 4c61621efb [MERGE] forward port branch 11.0 up to 9a7e3c8b49 2019-04-08 17:45:00 +02:00
Christophe Simonis 3f95b074e9 [MERGE] forward port branch saas-12.2 up to f2be461f09 2019-04-05 18:46:10 +02:00
Christophe Simonis f2be461f09 [MERGE] forward port branch saas-12.1 up to f2d0995362 2019-04-05 10:50:56 +02:00
Christophe Simonis d32420397d [MERGE] forward port branch 12.0 up to 251021796c 2019-04-04 11:20:03 +02:00
Christophe Simonis 1122b62d00 [MERGE] forward port branch 11.0 up to 4df568549a 2019-04-02 16:35:17 +02:00
Xavier Morel b4ae543098 [IMP] base: batching of _compute_commercial_partner
Should correctly handle / fallback to regular code when processing
non-stored partners.

Perf difference according to cprofile on my machine:

original python:
ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     1    0.134    0.134  205.380  205.380 res_partner.py:277(_compute_commercial_partner)
SQLized
     1    0.118    0.118   67.239   67.239 res_partner.py:280(_compute_commercial_partner)

most of the time leftover seems to be in modified_draft
2019-04-02 09:57:49 +00:00
Xavier Morel 1fb20fe304 [IMP] base: try to batch update of children address & commercial fields
With profiling enabled, importing 10k partners, with all of them
having the same parent (though not with all of them having the same
is_company setting) lowers sync / post-process time from ~550s to
~330s.

Put it in an override to _load_records_create so it's only active for
imports (which is the original report & test case), use a context key
to avoid going the post-processing work in create.
2019-04-02 09:57:49 +00:00
Christophe Simonis f36175dd8f [MERGE] forward port branch saas-11.3 up to b3d4c2d178 2019-04-03 18:46:36 +02:00
Christophe Simonis 28cce6ce3a [MERGE] forward port branch saas-12.1 up to c0cf4049b2 2019-03-29 19:47:46 +01:00
Christophe Simonis 2a06f4dcf3 [MERGE] forward port branch 12.0 up to 09fb2469b4 2019-03-29 18:10:57 +01:00
Martin Geubelle 015958dc17 [IMP] web,base: put buttons in list group headers
It is now possible to put buttons in the list view group headers.
When the view is grouped by a many2one field, those buttons
appear next to the header title when the group is opened.

The buttons are specified in the views in a <groupby> tag in the
list arch, with the following structure:
    <groupby name="groupedField"> <!-- must be a many2one -->
        <button type="object" name="my_method" string="Button1"/>
    </groupby>

It is also possible to add `field`, inside the `groupby` which can
be used for modifiers. These fields thus belong on the many2one
comodel, like:
    <groupby name="partner_id">
        <field name="name"/> <!-- name of partner_id -->
        <button type="object" name="my_method" string="Button1"
		attrs="{'invisible': [('name', '=', 'Georges')]}"/>
    </groupby>

These extra fields are fetched in batch when grouping on the field.

Part of task 1915702
2019-04-02 11:55:57 +00:00
Christophe Simonis 5dbf7bf357 [MERGE] forward port branch saas-12.1 up to f00c490be8 2019-03-26 10:33:26 +01:00
Christophe Simonis f00c490be8 [MERGE] forward port branch 12.0 up to 11b1e12cde 2019-03-25 19:45:26 +01:00
Olivier Dony 6fa292cec8 [FIX] ir_mail_server, mail: catch SMTPServerDisconnected exceptions
If the smtp session was dead, it would lead the whole mail batch to fail.

opw 1949270

closes odoo/odoo#32424

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2019-04-05 14:10:41 +00:00
Christophe Simonis 11b1e12cde [MERGE] forward port branch saas-11.3 up to e9068c290b 2019-03-25 18:28:16 +01:00
Christophe Simonis e9068c290b [MERGE] forward port branch 11.0 up to 0196a6feb5 2019-03-25 16:47:05 +01:00
Nicolas Martinelli 0f971130d6 [FIX] base: inactive lang
Make sure to retrieve the lang in case it is inactive. Note that a lang
cannot be deactivated if it is set on a `res.users`, but no check if
performed on a `res.partner`.

opw-1964655

closes odoo/odoo#32457

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-04-05 13:04:04 +00:00
Martin Trigaux 489494e733 [FIX] base: upsert translations during copy_translations
When doing a copy, create the new translations directly in SQL and handle
potential conflicts.

Conflicts can occure in case of reinstallation as showed in opw-1955062 and
opw-1950117.
In case of "leftovers" of translations (e.g. remaining after the uninstallation
of a module), creating the new translations (when reinstalling the module) may
produce a conflict with (type, name, res_id, lang) and raise an error.

This is NOT a problem of reading .po file during installation (which handles
correctly conflicts) but of business code creating new records and linked
translations (e.g. website copying website.menu records).

Removing old translations during uninstall is handled in a previous commit in
ir.model.fields _drop_column method.
This commit fixes the reinstallation on instances with leftover translations
and fixes the issue without needing a manual intervention (i.e. delete the old
translations manually).

Closes odoo/odoo#32056

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-04-04 14:41:26 +00:00
Martin Trigaux 112bd835d8 [FIX] base: drop translations when dropping a column or table
Better than if ba58888ced as the records may be removed via ondelete='cascade'
(where the unlink is not called on the record).  Will be faster too.

A solution to opw-1955062 and opw-1950117 with uninstallation of website.

Closes odoo/odoo#32056
2019-04-04 14:40:20 +00:00
Christophe Simonis 4eff0af02e [MERGE] forward port branch saas-12.1 up to 6878c9f342 2019-03-21 13:58:37 +01:00
Christophe Simonis c50d7d6bc5 [MERGE] forward port branch 12.0 up to 82c4393fd0 2019-03-19 15:14:23 +01:00
Christophe Simonis 9b6e37a983 [MERGE] forward port branch 11.0 up to 7e33b54771 2019-03-18 16:51:57 +01:00
Christophe Simonis bd63913326 [MERGE] forward port branch saas-11.3 up to 4e39328a76 2019-03-18 20:03:24 +01:00
Christophe Simonis ff1bca32f3 [MERGE] forward port branch 12.0 up to a26496b6e7 2019-03-14 17:43:32 +01:00
Nans Lefebvre a26496b6e7 [FIX] mail: set message_main_attachment_id when the attachment is added via widget
Create a record.
Add an attachment, using the widget (aptly named 'add an attachment').
It is not set as message_main_attachment_id.
If you add the message through 'log note', then it is.

We add a hook to make sure that it is set as message_main_attachment_id
when added through the widget.

opw 1950403

closes odoo/odoo#31847

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-03-14 12:50:51 +00:00
Christophe Simonis bbedcdb190 [MERGE] forward port branch saas-12.1 up to ff1bca32f3 2019-03-14 19:44:55 +01:00
Christophe Simonis 71faa19af0 [MERGE] forward port branch saas-12.1 up to 2b3296bbf8 2019-03-11 14:42:34 +01:00
Christophe Simonis 2c5c9b8342 [MERGE] forward port branch 12.0 up to c023d0784f 2019-03-08 17:56:14 +01:00
Christophe Simonis 3e54704e66 [MERGE] forward port branch 11.0 up to 27081bf6f5 2019-03-05 17:26:04 +01:00
Jorge Pinna Puissant e9c7fc0d93 [FIX] base: split _get_rendering_context to allow different models
Allowing to override the _get_rendering_context and call the new
function (_get_rendreing_context_model) with a different custom model
to render the html.

opw-1946792

closes odoo/odoo#32101

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2019-03-25 14:44:27 +00:00
Martin Geubelle f1c0530515 [FIX] base: do not rename binary fields column
When renaming a binary field name (through Studio for example), an error occurs
since rev. odoo/odoo@66f0e26

As the binary (custom) field is now created with `attachment=True` by default,
it has no associated column in the database ; this latter shouldn't be renamed
then.

Task 1942181

closes odoo/odoo#31504

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-02-28 13:36:08 +00:00
Raphael Collet 8a7dc813af [FIX] base: copied views are delete too early
Install Invoicing (account) and uninstall it. It results to a an error
because some views required by `payment.acquirer` are deleted before
the acquirers.

The problem is due to the way copied views are deleted, since 1388b7f
they are removed before the module uninstallation. The related commit
faced a similar problem where copied views were deleted too late
during a module uninstallation.

The two problems are revealing that the copied views have to be removed
as part of the module uninstallation, more precisely after all records
refering to them has been deleted but before the schemas has been
cleaned.

opw-1943286

closes odoo/odoo#31443

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-02-27 10:38:50 +00:00
Christophe Simonis 0e7675847f [MERGE] forward port branch saas-12.1 up to 0f4abc5c22 2019-02-22 16:25:02 +01:00
Christophe Simonis 1d2b6f1bef [MERGE] forward port branch 12.0 up to 84143a34b3 2019-02-21 15:37:19 +01:00