Commit Graph
140847 Commits
Author SHA1 Message Date
Rémy Voet (ryv) 03cc1e81a8 [REF] stock: remove useless name_get
In the model `stock.quant.package`, the `_compute_complete_name`
and the `name_get` mimics the default one (`_rec_name = "name"`).
Then remove clean it.

task-2373638
2021-01-05 08:32:58 +00:00
Rémy Voet (ryv) e292c3fb53 [REF] mrp: consumption of workorder become related
Avoid duplicate information in DB.

task-2373638
2021-01-05 08:32:58 +00:00
Rémy Voet (ryv) 4d57ce473b [REF] mrp: clean BoM operations
- make `bom_id` required. No sense to have a operation without BoM
- `company_id` of operation is now related
- Clean the multiple `allowed_operation_ids` into related
fields instead.

task-2373638
2021-01-05 08:32:58 +00:00
Rémy Voet (ryv) e4b0f75799 [REF] mrp: clean onchange of mrp.production
Avoid crappy try-except in `onchange_picking_type` and have a coherent
fallback instead.

task-2373638
2021-01-05 08:32:05 +00:00
Rémy Voet (ryv) 48f6b350a7 [REF] stock: clean onchange of stock.move
Clean onchange of `stock.move`: make it private and move in the
right place.
Also remove the action_assign_partner unused method

task-2373638
2021-01-05 08:32:05 +00:00
Rémy Voet (ryv) 515b9a78e6 [REF] stock,mrp: make picking_type_id compute store in stock.move
In order to have always a picking_type_id on a stock move (and
consistent with his parent model), make it compute store.
Then clean the call of picking_type_id without change the behavior
(/!\ `move.picking_id.picking_type_id != move.picking_type_id` because
of mrp). Fix some test where the location(_dest) was unset in moves.

Also:
- Clean the mess in the create of `stock.picking` about that
and add a onchange to keep location(_dest) consistent with moves.
- The move `description_picking` is set when the `picking_type_id`
change, not only at the create method.

task-2373638
2021-01-05 08:32:05 +00:00
fedegobea 56463c2a29 [FIX] point_of_sale: editing customers always asking to change name
Hi i detected an issue on POS, to reproduce just get into a customer on the POS UI, change something else than the name, then try to save changes, this trigger the if in line 47, making the user to mandatory edit the name field then save again and it works.

The only change on the file is on line 47 where I check if the name is already on the prop so that it works as intended.

Its a mild UX issue with a very easy fix. hope you can upload it soon to the repo so that users on Odoo SaaS or users with no code skills dont have this Issue anymore-

Best regards

closes odoo/odoo#64091

X-original-commit: 94a735ec6a9caa334eca6c4d7a4ca89bf3b5eaf9
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-01-05 14:16:10 +00:00
Sébastien Theys 828ea9c523 [FIX] auth_signup: properly grab user lang from context
Follow up on d0a4b20d36

The `lang` at this step is compared to the locale `code` (eg. fr_BE) so the
split is a mistake.

To reproduce the issue:
- change the language of a website to fr_BE only
- allow free signup
- register as a new user

Notice how the language of the user is set to en_US before this PR instead of
fr_BE as it should be.

closes #63616

closes odoo/odoo#64089

X-original-commit: ba21dadf17ba96ecbba917f666a3b385d9b9fd5e
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-01-05 14:04:21 +00:00
Mohammed Shekha 30f2a7f149 [FIX] web: fix optional dropdown hide behind listview table
before this commit: when you have o2m which has optional fields and optional
field dropdown is bigger and o2m does not have records and when you open
optional dropdown it hidden behind o2m table. The reason is optional dropdown
is child of table.

after this commit: put dropdown as child of listview.$el so it is no more child
of table so when it is opened it is displayed on top of listview table, here we
also have to calculate position of optional dropdown as it is no more child of
table element, so we have to set left position based on table width and if
language direction is rtl then dropdown width.

task-2370860
Closes #62681

closes odoo/odoo#64085

X-original-commit: a14c74d926b35dc499914edcbb7b93e638fe3bce
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-01-05 13:29:47 +00:00
Mohammed Shekha 7943c123ce [FIX] web: list: keep line when click in m2o dropdown
Before this commit, in editable list views with a many2one, when
the user clicked inside the many2one dropdown, in the padding above
the first item or below the last item, the dropdown closed itself
and the row was removed (if it wasn't dirty yet). This commit fixes
that issue by ignoring clicks at those specific spots.

Task 2377864

closes odoo/odoo#64084

X-original-commit: 2ddb8e07ab9fcce3427266247069de8546a87fb5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-01-05 13:29:19 +00:00
Ivàn Todorovich 3c1035a2b8 [FIX] Raise QWebException if 'last_path_node' is not set.
closes odoo/odoo#64074

X-original-commit: 91434c79dee96050a614642f494d7dae4d41703e
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-01-05 11:52:06 +00:00
Achraf (abz) 86214d9b6e [FIX] base_address_city: Duplicate complete address on contact creation
What are the steps to reproduce your issue ?

    1. Install contacts in a db with demo data
    2. Create a contact with complete address
    3. Click on Add button (edit mode)

What is currently happening ?

    The address get copied but not completely (no zip code, state, street)

What are you expecting to happen ?

    The whole address have to be copied

How to fix the bug ?

    Don't call the onchange if the record is not yet created

opw-2415891

closes odoo/odoo#64071

X-original-commit: b731afa7918d9d69132af825c414d902aa57541e
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2021-01-05 11:37:09 +00:00
Odoo's Mergebot 6642467142 [MERGE] crm: remove global lead alias configuration
PURPOSE

Remove the alias setting option because it is a weird and hackish way to
proceed. We would prefer users to configure their alias through sales teams.
Improve alias configuration on teams.

RATIONALE

"​Incoming Emails" option has many flaws

  * it creates collision when you try to set an alias that is already used
    and it is not easy to find them back;
  * it has no default value (no sales team, no type, ...) and works through the
    'owner' field. This is set with the admin on activation of the feature
    which is not correct.  The admin is potentially not a salesperson. If you
    set the field to blank, you get leads without team and without assigned
    responsible.
  * this alias is not team-bound which thus asks the question: in which team
    should the lead ever go? To the first team? Why?

All this make it seem way healthier to handle this through the Sales Team.
=> By default, we'll already have one working with an alias.

If users really want a global lead alias it can be setup manually through
alias menu in configuration. Shortcut and default alias in crm are removed
but feature is still doable if requested.

SPECIFICATIONS

Remove the s "Incoming emails" setting that allows to setup a global alias for
leads / opportunities with a default value being 'contact'. Also remove related
alias data as it has no use anymore.

When changing "use leads" from CRM settings automatically regenerate apply this
option to all sales teams using opportunities. When de-activating it no team
should have this option activated as menus and options are hidden. When
activating it we consider that all teams should be upgraded by default

LINKS

Task ID-2414079
Sort of follow-up of Task ID-2373095
COM PR #63160
UPG PR odoo/upgrade#2017

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-05 13:36:03 +01:00
Thibault Delavallée 94de6b501b [IMP] crm: always hide alias left part when domain is not configured
When alias domain is not configured always display "Configure a custom
domain" link instead of an email having only a left-part or "Inactive
alias" if left part is void. This is already the case in edit mode but
not in read mode.

New specification is
  * domain is not configured: display link in both read and edit mode;
  * domain is configured and left part is set: display alias;
  * domain is configured and left part is not set: display "Inactive alias"
    in read and display alias name for edition in edit;

LINKS

Task ID-2414079
COM PR odoo/odoo#63160
UPG PR odoo/upgrade#2017
2021-01-05 11:15:28 +00:00
Thibault Delavallée 17aa8679a0 [IMP] crm: do not set environment user as responsible of leads created through gateway
PURPOSE

Remove the alias setting option because it is a weird and hackish way to
proceed. We would prefer users to configure their alias through sales teams.
Improve alias configuration on teams.

SPECIFICATIONS

We do not want to explicitly set an user as responsible when an incoming email
creates a lead or an opportunity. We prefer that assignment is done either
automatically (scoring) or manually.

Using environment user would lead to set either root (gateway user - already
prevented) either alias owner (through alias_user_id) either user sending
email if email_from matches. Doing it also allows to exclude portal / public
users that would send an email to the mailgateway.

LINKS

Task ID-2414079
COM PR odoo/odoo#63160
UPG PR odoo/upgrade#2017
2021-01-05 11:15:28 +00:00
Thibault Delavallée ebbece6d55 [IMP] crm: synchronize teams use_lead and alias with setting
PURPOSE

Remove the alias setting option because it is a weird and hackish way to
proceed. We would prefer users to configure their alias through sales teams.
Improve alias configuration on teams.

SPECIFICATIONS

When changing "use leads" from CRM settings automatically regenerate apply this
option to all sales teams using opportunities. When de-activating it no team
should have this option activated as menus and options are hidden. When
activating it we consider that all teams should be upgraded by default.

LINKS

Task ID-2414079
COM PR odoo/odoo#63160
UPG PR odoo/upgrade#2017
2021-01-05 11:15:27 +00:00
Thibault Delavallée 1ee68e6119 [REF] crm: remove global lead alias
PURPOSE

Remove the alias setting option because it is a weird and hackish way to
proceed. We would prefer users to configure their alias through sales teams.
Improve alias configuration on teams.

RATIONALE

"​Incoming Emails" option has many flaws

  * it creates collision when you try to set an alias that is already used
    and it is not easy to find them back;
  * it has no default value (no sales team, no type, ...) and works through the
    'owner' field. This is set with the admin on activation of the feature
    which is not correct.  The admin is potentially not a salesperson. If you
    set the field to blank, you get leads without team and without assigned
    responsible.
  * this alias is not team-bound which thus asks the question: in which team
    should the lead ever go? To the first team? Why?

All this make it seem way healthier to handle this through the Sales Team.
=> By default, we'll already have one working with an alias.

If users really want a global lead alias it can be setup manually through
alias menu in configuration. Shortcut and default alias in crm are removed
but feature is still doable if requested.

SPECIFICATIONS

Remove the s "Incoming emails" setting that allows to setup a global alias for
leads / opportunities with a default value being 'contact'. Also remove related
alias data as it has no use anymore.

LINKS

Task ID-2414079
Sort of follow-up of Task ID-2373095.
COM PR odoo/odoo#63160
UPG PR odoo/upgrade#2017
2021-01-05 11:15:27 +00:00
Thibault Delavallée 2ba035ba6d [FW][FIX] calendar: synchronize email_from and author_id when sending email to attendees
When emails related to calendar events are sent email_from is set from
templates like invite template. Author of those email is however not set
and current user is used as default value.

In this commit we do as done in templates and try to set event responsible
as user, and fall back on current user if not set.

This notably solves an issue when using website_calendar. Appointments are
done using public user and mails have public user as author. This leads to
emails not being accessible or having a false email_from.

Task ID-2413792

closes odoo/odoo#64061

X-original-commit: c01d95d371e859002f09520d3a97436f3b3087b8
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-05 10:05:15 +00:00
sofiagvaladze d713b445c7 [IMP] hr: Hide menu_hr_employee for group_hr_user
Reason: In Employees app, it is confusing for the first time users to see
both 'Employees' and 'Employee Directory' folder. Also, first user
is not assigned to any departments.

Solution: If the user can see the folder 'Employees', don't show
the folder 'Employee Directory'. Assign the first user to the
'Administration' department.

Task - 2377506

closes odoo/odoo#63038

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-12-15 09:21:05 +00:00
Aaron Bohy 766c9a5d57 [FIX] web: editable list: do not discard row on m2o blur
Let's assume an editable list with a many2one field. The user types
something in the many2one and then clicks outside (mousedown, not
mouseup, and thus click, yet). A dialog opens to ask the user if he
wants to quickcreate a record.

Before this commit, the dialog and the row disappeared as soon as
he released the click, because the click was considered by the
list renderer as an "external click", and the row was discarded
(alongside the many2one it contained).

Task 2411029

closes odoo/odoo#64053

X-original-commit: 7d04ec7cca4f355295a06c1ce6f112b6cc533c87
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-01-05 09:15:47 +00:00
Ivan Yelizariev defa46715e [IMP] mass_mailing: show attachments composer mailings
This improvement allows user to review mail attachments that were sent using
composer in mass mail mode while creating a mass mailing on the fly. This is
achieved via `Action > Send email` menu and setting a mailing name.

For example, you sent different mails to different set of partners and you want
to check that you sent correct attachments and didn't miss anything. This
behavior is doable in Email Marketing apps. Before this commit you would need
to open different partners in Contacts app and check messages in the chatter.
Now attachments are displayed in composer.

STEPS:
* Install mass_mailing
* Open Contacts menu
* Select any number of records
* Click `Action > Send email`
* Set **Mass Mailing Name**
* Attach a file
* Send
* Open ``Email Marketing`` app
* Open the created mailing
* Check ``[Settings]`` tab

BEFORE: Attachments field is empty
AFTER: You can see the attachments sent to the partners

WHY: In 2014 attachments were added to mailing.mailing, but not to composer
https://github.com/odoo/odoo/commit/7e1e475d89694d09e62c33d2529fa061c7983dff

---

Task ID-2418997
opw-2410938
closes #63065
closes #63470

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-05 08:04:30 +00:00
Rémy Voet (ryv) 7256e01ad0 [FIX] stock_landed_cost: efficient validate landed cost
Update the standard_price outside the loop to avoid recompute
quantity_svl at each iteration. quantity_svl is not modify in the
process and the standard_price is not read in process.

NewPrice = OldPrice + (cost_to_add_x1) / quantity_svl + (cost_to_add_x2) / quantity_svl
Becomes
NewPrice = OldPrice + (cost_to_add_x1 + cost_to_add_x2) / quantity_svl
which is equals.

opw-2374405
odoo/odoo#64011

closes odoo/odoo#64032

Forward-port-of: odoo/odoo#63742
X-original-commit: b8d7e48f27fc4f0868c538977be8276058944e57
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-01-05 07:54:32 +00:00
Rémy Voet (ryv) 1f11d968e0 [FIX] stock_landed_cost: improve performance read
Improve performance of SQL in  `_compute_allowed_picking_ids`.
This one can be costly for a simple read of the `allowed_picking_ids`.
Grouping the result to avoid useless big thoughtput and a
add a where clause on company_id to filter out useless row.

opw-2374405
odoo/odoo#64011

Forward-port-of: odoo/odoo#63742
X-original-commit: 209f421b7360a42ab43c09d9aacec6b53ad24917
2021-01-05 07:54:32 +00:00
Sébastien Delafond 19383af210 [FIX] packaging: sync debian packaging with salsa repo
closes odoo/odoo#64007

X-original-commit: cffe65f2d8639278e5d765e063861766236510f8
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-01-04 12:21:32 +00:00
Samuel Degueldre dfcfca15d5 [FIX] web_editor: don't reoptimize already optimized image if repicked
Previously, if you double-clicked an image in the web editor with the
intention to change it, but the image had already been optimized, and
then repicked the same, already optimized image, the image would be
optimized again even though it had not changed. This commit fixes that
by making the media-dialog not trigger an image_changed event in those
cases, and by leaving the initial image untouched.

Linked to issue #57604

closes odoo/odoo#64038

X-original-commit: 4d3655304205cc9785ef696a47a17a41242d297a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-04 17:45:37 +00:00
Yannick Tivisse 07cb80cd26 [IMP] hr_work_entry: Add sql_constraint to avoid overlap
Purpose
=======

There is no way for _error_checking() to detect conflicts in work
entries that have been introduced in concurrent transactions, because of the transaction
isolation.

So if 2 transactions create work entries in parallel it is possible to create a conflict
that will not be visible by either transaction. There is no way to detect conflicts
between different records in a safe manner unless a SQL constraint is used, e.g. via
an EXCLUSION constraint [1]. This (obscure) type of constraint allows comparing 2 rows
using special operator classes and it also supports partial WHERE clauses. Similarly to
CHECK constraints, it's backed by an index.

1: https://www.postgresql.org/docs/9.6/sql-createtable.html#SQL-CREATETABLE-EXCLUDE

closes odoo/odoo#64028

Taskid: 2357844
Related: odoo/enterprise#15546
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-04 16:15:39 +00:00
Xavier BOL (xbo) baed2f0e74 [FIX] sale_timesheet: condition always False
Before this commit, we check if the bill_type in the project is equal
to 'customer_type' but this field can only be either 'customer_task' or
'customer_project'. Thus, this condition will always be False.

This commit changes the condition to check if the bill_type is equal to
'customer_project'. Then, this condition can be True if the project has
a SOL and his bill_type field is equal to 'customer_project'.

closes odoo/odoo#64012

X-original-commit: d8f7d7369f060f444bcebc0118cc5a2a650f6361
Related: odoo/enterprise#15540
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-04 13:18:45 +00:00
Julien Bertrand a1ea7d0cd3 [IMP] auth_signup: reword welcome message
closes odoo/odoo#64023

Signed-off-by: Julien B.  <jubodoo@users.noreply.github.com>
2021-01-04 14:41:35 +00:00
Thibault Delavallée 8fbed20e98 [FIX] survey: force title on duplicate only if not already specified
No need to force a new title on duplicate if something is already given.

Task ID-2265556
PR odoo/odoo#52391

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-04 15:10:11 +00:00
Dharmraj Jhala 637a68a46e [IMP] survey: allow to duplicate survey with badge
Before this commit, if a badge is set on the survey, duplicating it always
results into a traceback due to sql constraint. Indeed due to uniqueness
constraints between survey and badge having the same badge for a duplicated
survey was leading to an error.

We had two options
  * duplicate the badge itself;
  * remove sql constraint and add a required on badge in view when having
    a certification (aka, survey giving a badge);

First solution is somehow limited. It means updating badge name, checking
its goal, ensuring all parameters are ok. Moreover it is quite hidden when
duplicating survey. End users will maybe not see what to are doing.

We choose to remove copy flag on flag and badge. That way end users have to
manually re-check the flag, and create a new badge. We remove the hard
constraint and set a required in the view so that functionally behavior
is the same.

Task ID-2265556
PR odoo/odoo#52391
2021-01-04 15:10:11 +00:00
qsm-odoo dcd644a7e0 [REF] website: remove compatibility code for header mono-editable zones
In 14.0 stable version, we merged [1] with JS compatibility code to
support the change. This commit now removes that compatibility code
thanks to related migration script.

[1]: https://github.com/odoo/odoo/pull/61835

closes odoo/odoo#63934

Related: odoo/upgrade#2052
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-12-31 09:09:06 +00:00
Ivan Yelizariev 0a082d5574 [FIX] website_form: prevent adding lang prefix to form action url
STEPS:
* create fresh db with default lang fr_CH
* install website
* activate additional language, e.g. en_GB
* set for website only one available language: fr_CH
* for admin user set lang en_GB
* open website and add form

BEFORE: the form doesn't work, because action url is "/en_GB/website_form/"

AFTER: action url is not changed

WHY:

1.

``is_multilang_url`` returns ``True``, because there is no route ``/website_form/``

https://github.com/odoo/odoo/blob/0adcb9a09fe5714fe8479df9450ddcefa7ba0688/addons/http_routing/models/ir_http.py#L233-L244

2.

Model name in action is added after rendering only, this is why ``is_multilang_url`` is
called with ``/website_form/`` and not real url

https://github.com/odoo/odoo/blob/0adcb9a09fe5714fe8479df9450ddcefa7ba0688/addons/website_form/static/src/js/website_form.js#L144

3.

As result we get error on trying to make request ``/en_GB/website_form/mail.mail``

---

opw-2413960

closes odoo/odoo#64016

X-original-commit: e9e86e251b7e262c4fe9c71722c27cc69cc3b712
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-01-04 13:45:15 +00:00
Martin Trigaux bd85f0a5ea [FIX] web: translate report button
The button "Group By" and "Measures" were untranslated

opw-2421769

closes odoo/odoo#64015

X-original-commit: b4249c9125bd9b6077425636f67dec0303554da8
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-01-04 13:36:06 +00:00
Goffin Simon 85750746f6 [FIX] base: Original bills on encrypted pdf
Steps to reproduce the bug:

-Let's consider two vendor bills VB1 and VB2
-VB1 and VB2 have both a PDF in attachment P1 and P2 respectively (the original bills from the suppliers)
-Let's consider that P2 is encrypted
- In the list view of vendor bills, select VB1 and VB2 and print original bills

Bug:

An error was raised because it is not possible to merge P2 with P1 as P2 is encrypted.

opw:2389679

closes odoo/odoo#63999

X-original-commit: 0918b29ce765a159ba2b128bca9170f1230fdb78
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-01-04 11:34:13 +00:00
Raphael Collet d534a216ba [FIX] base: test failing because of environment reset
The call to reset() when simulating requests during HttpCase tests
leaves the test class into an inconsistent state.  Indeed, the test
environment is no longer into Environment._local, and this may trigger
record cache errors, because new environments use a record cache that is
different from the test's environment.

As this issue only occurs in the context of unit testing, it is not
worth fixing on a stable release, because of the involved risk.
Instead, we modify the test so that the failing operation is made in
method setUpClass(), before any environment reset.

closes odoo/odoo#63730

X-original-commit: c8604df6e3eab4090ffcb4c3f311e72c8bceac7c
Related: odoo/enterprise#15439
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-01-04 09:16:20 +00:00
Raphael Collet 664ac15b59 [FIX] account: flushing while recomputing fields is not a good idea
The Python constraint method `_check_unique_sequence_number` performs an
SQL query, and therefore needs to `flush()` the some fields before doing
so.  However, it uses a generic call to `flush()`.  In some situations,
the call to `flush()` ends up into recursive flushing, and that's the
beginning of a nightmare:
 - write on account.move.state,
 - which calls account.move._check_unique_sequence_number(),
 - which calls flush(),
 - which computes purchase.order.line.qty_invoiced,
 - which reads field purchase.order.line.invoice_lines,
 - which calls flush() for account.move.line.move_name,
 - which computes account.move.line.move_name,
 - which computes account.move.name,
 - which calls account.move._check_unique_sequence_number(),
 - which calls flush(),
 - which computes purchase.order.invoice_status,
 - which uses the not-yet-computed value of purchase.order.line.qty_invoiced,
   and computes an incorrect value.

We fix it simply by making the call to `flush()` more specific: we only
need to flush 4 fields.  This avoids the nightmare above.

X-original-commit: cf5f50a733ddfd87985a39ffe7daffc48cfb582f
2021-01-04 09:16:20 +00:00
Raphael Collet 0a098aceaf [FIX] core: marking and traversing computed fields before modification
This fixes an issue that occurs when marking fields to compute in the
following situation:
 - it occurs before the actual modification,
 - a relational field is marked to compute,
 - the same field is traversed to inverse some dependency.

When the marking occurs after the modification, the traversal of the
field should actually recompute the field.  However, if the marking
occurs before the modification, the inversion of dependencies must be
based on the current value of the field.  This is the case with method
unlink(): we call method modified() to mark the fields that currently
depend on the records to be deleted, and the fields must be computed
only after the deletion!

X-original-commit: cd19c2d93db8911fe42802640ea32e5d87aadeec
2021-01-04 09:16:20 +00:00
Nicolas Galler 3700b9b38b [FIX] mrp: update date on move when editing date after planning WO
Behavior prior to this commit:

 - normally when editing the Scheduled Date on a MO, the date on the
 related stock moves is updated.  However this does not happen once the
 MO is planned
 - if the date is edited and the MO is planned, the MO is automatically
 unplanned, but the date on the stock moves is not automatically updated

Behavior after this commit:

 - when the date is updated on the MO and it is planned, the dates on the
 stock moves will automatically update, so that the behavior is
 consistent with how it would work if you clicked Unplan first then
 updated the date.

Note:

 - this commit is forward ported from 14.0.  Only the unit test was
 ported, as the behavior had already been modified to match the
 expectation.

opw-2417108

closes odoo/odoo#64006

X-original-commit: 97f79960dbb3aa371378f576cfdce9670ca8ccce
Signed-off-by: Nicolas Galler <ngaller@users.noreply.github.com>
2021-01-04 12:20:51 +00:00
svs-odoo 603d907450 [FIX] core: avoid duplicate onchanges
When performing the onchange for the first time on a new record, if a
field has a default value, it could be two times in the `todo` field
list to compute.

closes odoo/odoo#64005

X-original-commit: cf2b0a505c117a50a91fa022bc1d6bf1eb6d9f77
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-01-04 12:16:46 +00:00
Aaron Bohy 338e276fc9 [FIX] web: SampleServer: fix randomly failing test
Commit [1] recently tweaked the way floats are generated in the
SampleServer, as they are now rounded to 2 decimals. As a
consequence it sometimes generates integers for float fields (e.g.
5 for 5.00). This is also what the real server does, so it's fine.
However, a test was asserting that float fields were floats, so
this test sometimes failed and thus needed to be adapted.

[1] https://github.com/odoo/odoo/commit/81f2bc7

closes odoo/odoo#63992

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2021-01-04 10:37:54 +00:00
Thibault Francois a85f46df96 [FIX] hr_recruitment: Past application should count archive record
Problem
-------
Recruitment pipe is design to work better if you archive the
lost/refused candidate rather than moving them in a specific column
this practice is reinforced by hr_referral.

Therefore, the other application button should take into account
archive applicant

Solution
--------

- count archived applicant
- show archived applicant

closes odoo/odoo#63982

X-original-commit: f242160eb06067ad56dec1c9acfbfe068ad1c6a1
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-04 09:30:18 +00:00
Victor Feyens bc2a8dd04d [FIX] project: fix infinite recurring tasks creation
for repeat_type = 'forever' recurrences.

Consider a recurrence creating a task every 15th day of the month.
When the cron runs, it updates the next recurrence dates of the
recurrence.

But currently, the updated "next_recurrence_date" can be set to an
earlier date than today, if the fixed day of the recurring task is
earlier than the current day.

This means that the recurring task to create every 15th of the month
will be created the 15, the 16, the 17, the 18, ... until the next month
begins (no task will be created when the cron runs before the 15th of a
month).

This commit enforces the next recurrence_date to be set after the
current cron run, to ensure a task isn't wrongly created multiple times.

This commit also includes the tests that led to the discovery of this
bug.

closes odoo/odoo#63989

X-original-commit: e4943afef0f66703bafd78780764ff6f0b039d3e
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-01-04 10:19:30 +00:00
Victor Feyens 5fc28342a2 [FIX] project: fix infinite recurring tasks creation
For recurrences of repeat_type = 'after', the daily cron would create
tasks infinitely.

* The cron creates recurring task for all recurrences for which
next_recurrence_date < today.
* next_recurrence_date was never updated.

This commit ensures that next_recurrence_date is set to False for
repeat_type = 'after' recurrences, when the last recurrence is created.

X-original-commit: e7be857bea964628b80d4d3c1314dc231e0da947
2021-01-04 10:19:28 +00:00
Samuel Degueldre 0d215ac63d [FIX] web_editor: fix shape transparency color preview handling
Previously, the transparency color for shapes was not taken into account
when handling the preview state transitions of the background shape
snippet option. This caused strange behaviours where the shape
transparency color would always get reset when it was a class color,
either when changing to a different shape (expected, all shape colors
should get reset) or when changing any other shape setting like other
shape colors or flipping the shape (not expected). On the other hand, if
the transparency color was not a class color, it would always remain
untouched, when changing other shapes settings (expected) but also when
changing shape type (eg Origins 01 -> Blocks 02, unwanted).

This commit fixes that by cloning the entire shape container during
preview, and restoring it on preview-reset.

task-2380815

closes odoo/odoo#63955

X-original-commit: 39baa6dadd8b34d4a210b6fedd1c20c5df2621f6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-12-31 17:33:20 +00:00
Siddarth Gajjar 34ce399556 [FIX] website: fix blog post / event title color
Before this commit, due to change in cover option refactoring at [1],
class 'o_record_has_cover' was removed from default configuration and
may not be saved properly.

[1]: https://github.com/odoo/odoo/commit/da32bdb88a4726a0dcee73f2c505ef5ea68c72ef

task-2387990

closes odoo/odoo#63952

X-original-commit: be5f3bdfe5f593e2f3998f93b98b9f43e1658ee6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-12-31 16:29:18 +00:00
qsm-odooandSamuel Degueldre 4612343e99 [FIX] website_theme_install: not copy fields for theme record templates
Themes define records which are used as templates for the creation of
base model records on theme installation on a website.
E.g. a "theme.ir.attachment" record's purpose is to be a template for an
"ir.attachment" record creation on theme installation on a website.

Those final records have extra fields to indicate from which theme
template they come from. If those records are ever to be duplicated,
they should not duplicate those links to the theme templates otherwise
it may cause issues when uninstalling/updating a theme (you want the
records linked to the theme to be deleted/updated but not the duplicated
ones, which do not act differently from user created ones).

Duplicate ones will be linked to the website anyway (just like "normal"
user created ones) and should only be automatically removed if that
website is deleted.

The issue is more visible from 14.0 where applying some modifications to
images via the editor (crop / filter / optimization / ...) will
duplicate the original image before modifying it.

closes odoo/odoo#63951

X-original-commit: 890935bbdf924b06b7dabd89802f6dd824159a4b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2020-12-31 16:12:59 +00:00
Jeremy Kersten 4532b67f3c [IMP] website: support old fonts that have been renamed in theme
closes odoo/odoo#63382

X-original-commit: 49f3ee8ab4912c52f5e60b9392c5805272923064
Related: odoo/design-themes#431
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-12-15 11:46:23 +00:00
Rémy Voet (ryv) e8be3acb83 [IMP] mrp: add indexes in mrp.workcenter.productivity model
We add a index on the workcenter_id and workorder_id, both
have a One2many related to  (`time_ids` of workcenter and workorder)
and both is in the some search domain in python (also in search view).
(Also change the `readonly='True'` into correct form `readonly=True`
of `production_id`, and remove duplicate fields `workcenter_id` in view)

task-2389380

closes odoo/odoo#63500

Related: odoo/upgrade#2042
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-12-22 12:43:00 +00:00
Rémy Voet (ryv) d346cd1ec2 [IMP] mrp: add index on bom_id for byproduct
The `bom_id` field has a One2many inverse `byproduct_ids`
then it should by index to avoid bottleneck if byproduct is
highly used by a lot of different BoM

Performance improvements:
When there is 20K of Byproduct line, read a BoM is x1.8 faster.

task-2389380
2020-12-22 12:43:00 +00:00
Rémy Voet (ryv) aa898c9a33 [IMP] stock: add index on product_id (stock.production.lot)
Add index on the `product_id` of `stock.production.lot` for
several reasons:
- Lot of field domains depending of `product_id`
(e.g. `lot_id` of quant, sml, ...)
- Almost every search on this model contains the field `product_id`
- `product_id` is required and the sparsity is generally high

Performance improvements:
For a DB with 6000 lots, `search_read` with product_id is
x2 times faster.

task-2389380
2020-12-22 12:43:00 +00:00