Commit Graph
122926 Commits
Author SHA1 Message Date
Aurélien Warnon dcd79a543a [FIX] survey: fix empty date in survey could not be submitted
Purpose
=======

A date field not marked as "mandatory" could not be left blank in the survey.

That was caused by the form returning "Invalid date" instead of an
empty value when submitting.

closes odoo/odoo#30788
2019-02-04 07:53:47 +00:00
Rishabh Jadia 13e058c573 [FIX] web: prevent footer linebreak.
The purpose is, prevent the linebreak in the phone when using the
document layouts 'background' in the footer.

opw-1920752

closes odoo/odoo#30812
2019-02-05 10:37:01 +00:00
Robot Odoo b13a220295 [FIX] hr_holidays: fasten creation of leaves by company
When creating a leave, we usually check/create activities for the
concerned users, this is fine when creating one leave.
However it starts to become a problem when trying to create leaves in
batch using the by company or by department holiday_type as the number
of leaves created in batch can become quite big.

Now when we create leaves in batch, we do not check for the activities,
which will fasten a lot the creation.

Another problem is that when someone defined a leave on the very day you
want to create such a request, then it will crash, this can lead to
waste of time and resources.

Now we raise an error before trying to create the leaves in case of
conflict.

NB: Tested with +- 320 records, took 20 seconds instead of more than 10 minutes.

Task: 1934383

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#30625
2019-02-05 10:36:34 +01:00
RomainLibert 9c1b932489 [IMP] hr_holidays: improve performances
going from 3X seconds for 320 leaves to 20 seconds for 320 leaves
2019-02-05 10:06:55 +01:00
RomainLibert 8ab8881167 [FIX] hr_holidays: fasten creation of leaves by company
When creating a leave, we usually check/create activities for the
concerned users, this is fine when creating one leave.
However it starts to become a problem when trying to create leaves in
batch using the by company or by department holiday_type as the number
of leaves created in batch can become quite big.

Now when we create leaves in batch, we do not check for the activities,
which will fasten a lot the creation.

Another problem is that when someone defined a leave on the very day you
want to create such a request, then it will crash, this can lead to
waste of time and resources.

Now we raise an error before trying to create the leaves in case of
conflict.

Task: 1934383
2019-02-05 10:06:55 +01:00
Julien (juc) Castiaux 262e001086 [FIX] mail: delete messages on module uninstallation
When uninstalling a module, the messages linked to the records
of that module are not deleted leading to ghost messages when
reinstalling the module.

This is due to the lack of foreign keys in the definition of the
chatter making it impossible to cascade delete.

opw-1928208

closes odoo/odoo#30798
2019-02-04 14:16:47 +00:00
Nans Lefebvre 1746112794 [FIX] purchase: fix mail templates for multi-company use
Activate multi-company, deactivate the common contact book.
Create a PO P with user U1 in company A. Switch to company B.
User U2 in company A tries to send P by email.
Rendering of the template fails, because it tries to access object.create_uid,
which breaks multi-company record rules.

We add a sudo in the template so that it works as intended.

opw 1930521

closes odoo/odoo#30789
2019-02-04 09:09:49 +00:00
Martin Trigaux c189a7c37e [FIX] base: correct case in Swedish language
Was with a lowercase S while it should be uppercase

closes odoo/odoo#30814
2019-02-04 13:34:28 +00:00
Nans Lefebvre 9d1b07f97b [FIX] project, rating: use rating last update to compute satisfaction percentage
The function _compute_parent_rating_percentage_satisfaction used the creation
date of the rating to compute the percentage.
However when a client give a new rating, it updates the old one.
As a result it doesn't give the recent satisfaction percentage,
but the satisfaction percentage of recently created tickets.
In other words recently angry clients from old projects would not appear.

Similarly this method is somewhat reimplemented directly in SQL in the rating
route, which happens to be in the project controller.

opw 1921486

closes odoo/odoo#30752
2019-02-01 09:01:27 +00:00
Pierre Paridans 220644785c [FIX] project: state, priority and title alignment
Priority's star, Kanban State's bullet and name fields should be well aligned
and take less space (specially for small devices).

Related to task 1929034

closes odoo/odoo#28965
2019-02-04 13:08:40 +00:00
eLBati 942930e11c [CLA] update eLBati email address
closes odoo/odoo#30781
2019-02-04 10:41:15 +00:00
Lucas Lefèvre dccd37d4e4 [FIX] web: fix tabs padding and min height
No padding is applied to tab content panels in Community.
Also the minimum height selector does not correctly target tabs.

Related Enterprise PR: https://github.com/odoo/enterprise/pull/3568/

closes odoo/odoo#30771
2019-02-04 09:33:42 +00:00
Sanjay Jamod 2b844a7f6c [FIX] account: add fallback value
there was a traceback, when value of amount_total is None

closes odoo/odoo#30797
2019-02-04 09:47:47 +00:00
Pierre Paridans 4687faefbf [FIX] hr_timesheet: timesheet rows in task have broken mobile layout
This commit https://github.com/odoo/odoo/commit/91fb15510ff549e7544f6858f7979b57fae875e7 hasn't been forward ported correclty.
Should use .col-6 instead of .col-xs-6 since Bootstrap 4.

Related to task 1929034

closes odoo/odoo#30787
2019-02-04 08:25:31 +00:00
Laurent Smet e56b891bbf [FIX] account: Fix amount matching in matching rules
-task: 1934494

closes odoo/odoo#30755
2019-02-04 07:32:17 +00:00
Alexandre Kühn e8f7770a13 [FIX] mail: do not open chat window twice
Revision on https://github.com/odoo/odoo/commit/0d87b1ccea07b952d9079008cfa3cddaf1ccdbee

The commit above prevents opening a chat window when we do not have
access to messages of the conversation. This may happen when
receiving a notification from a document we do not have access
rights.

However, the changes in the code above has an unintended side-effect
of opening a chat window twice when clicking on a channel preview
from the systray messaging menu.

This happens because when clicking on a preview, it detaches the
thread and opens the chat window. Meanwhile, there is a RPC to
notify that the chat window is detached, and the new window state of
the channel is received on the longpolling. Two concurrent attempts
to open a chat window occur at the same.
It was working fine before the commit above, because the registering
of a newly open chat window was synchronous.
This is however no longer the case, because it fetches messages
beforehand: it has become a requirement to open a chat window. Since
the registering of a newly open chat window is now asynchronous,
it was fetching messages and opening the chat window twice.

This commit fixes the issue by aborting attempt to open a chat
window if it's currently opening a chat window, as this process may
take some time due to the `message_fetch` RPC.

closes odoo/odoo#30741
2019-02-01 14:21:47 +00:00
Nicolas Martinelli 9ff018a2b7 [FIX] mrp: field for kit BoM
LAP was wrong.

opw-1936161

closes odoo/odoo#30786
2019-02-04 07:16:58 +00:00
Odoo Translation Bot 69dbbea09a [I18N] Update translation terms from Transifex 2019-02-03 01:38:30 +01:00
Arnold Moyaux 0336cbb50b [FIX] mrp: wrong domain in action_view_mos
Correct domain syntax

closes odoo/odoo#30767
2019-02-01 14:10:41 +00:00
Jeremy Kersten bb473003d7 [FIX] website: res_config_setting in multi company
Before this commit, if the first website in the select was not in your current
company, it raises a traceback.

Now with filter on your own company, and support empty website selected
removing required on related field and using attrs dynamic to make it required

closes odoo/odoo#30769
2019-02-01 09:34:06 +00:00
Lucas Perais (lpe) 7e06f1a8ed [FIX] account: dates can be datetime.date or strings
Open the customers followup report
on a line, click on its contextual menu (the down arrow next to invoice name)
click change expected payment date

Before this commit, there was a traceback, because the new date was a string
which has no strftime function

from 03c40e3104 we learn that it can
either be a string or a date object, as Odoo in v12.0 supports this

After this commit, there is no traceback

OPW 1933953
OPW 1933979

closes odoo/odoo#30756
2019-02-01 09:12:42 +00:00
Nicolas Lempereur 3076d7e464 [FIX] base: partner search no alnum->no VAT match
When we search a partner, there is a system that show partner who match
exactly the searched term with non-alphanumeric character removed.

But since a6e1eb9f0a there is an issue that wrong partner match if:

- they have an empty string as VAT in the database (odd but can happen)
- if the searched term only contains non-alphanumberic characters

eg. i search 'é' -> all partner with empty string vat are found since
    the empty search '' matches empty VAT ''

With this changeset, if there is no alphanumeric character we will check
depending on the operator `vat=NULL`, `vat like NULL`, `vat ilike NULL`
that all will not match any result (and in the query plan does not take
time).

opw-1929563
closes #30732
2019-02-01 08:06:16 +00:00
Nicolas Martinelli 90b6cbde09 [FIX] stock: select stockable only
When `stock_account` is not installed, the Inventory Report do not
filter out services or consumable.

opw-1925598

closes odoo/odoo#30742
2019-01-31 17:43:33 +00:00
Nicolas Martinelli 85ada6ff6d [FIX] mrp: PDF of BoM structure
- Create the following BOM for 1 Unit of A:
  B: 55 Units
- Create the following BOM for 728 Units of B:
  C: 1 Unit
- Create the following BOM for 1 Unit of C:
  D: 728 Units
- Go to 'BoM Structure & Cost' of A:
  A: 1 Unit
     B: 55 Units
        C: 0.0755 Units
           D: 58.24 Units
- Print Unfolded:
  A: 1 Unit
     B: 55 Units
        C: 0.0755 Units
           D: 40040 Units

The unfolded PDF structure is incorrect.

The reference quantity taken into account to compute the BoM subline
should be the quantity on the line, not the quantity on the parent line.

opw-1915546

closes odoo/odoo#30726
2019-01-31 12:03:44 +00:00
Christophe Simonis cb8fefa899 [FIX] web: correct tempusdominus lib patching
Oversight of previous forward-port.
2019-01-31 15:22:27 +01:00
Christophe Simonis 49cb3d8fad [MERGE] forward port branch saas-11.3 up to aeed32d4ff 2019-01-31 15:07:09 +01:00
Fabien Pinckaers c50e82c127 [FIX] account: Undistributed Profits/Losses
If no Undistributed Profits/Losses account can be found, Odoo tries to
create one with number '999999'. However, such an account number might
have been created manually by a user. In this case, the account creation
fails.

opw-1932701

closes odoo/odoo#30719
2019-01-31 09:23:54 +00:00
Nicolas Lempereur c4d222677f [FIX] web: click/studio work in colored kanban tile
When a colored kanban tile is colored, and there is a color attribute on
the tile HTML element indicating a color field (eg. when a kanban view
with color dropdown is created in studio), there was a HTML element over
the whole tile preventing to click on links or other sub element of it.

This HTML element is just a transparent used for accessibility to
contain the tile color intelligible name, so this commit just size it
over the area of the color (currently in base bootstrap ~3px at the left
of the tile).

opw-1932283
closes #30717
2019-01-31 09:01:44 +00:00
Christophe Simonis aeed32d4ff [MERGE] forward port branch 11.0 up to 1dbe4ea0d7 2019-01-30 17:10:34 +01:00
Alexandre Kühn 8897cb1feb [FIX] mail: keep activity notification counter on today's meetings
Before this commit, when a user had some meetings planned today
and open the systray activity menu, the counter would disappear.

This was caused by a weak computation of the counter that relies
on activity having always a total counter. This was not the case
for activity that are today's meetings: Counter would be computed
as `NaN`, and since `NaN` is falsy, it won't display the counter.

Today's meetings have no reason to have a counter, so this commit
fixes the issue by letting those activities not change the
computation of the counter.

closes odoo/odoo#30695
2019-01-30 13:18:18 +00:00
Martin Trigaux 6b054f2640 [FIX] web: do not select disabled element
If xlwt is not installed on the server, the option is disabled.
However, the first element was checked, even if it is disabled.

Trying to export record without xlwt was causing a traceback.

Introduced at b60de0db41 where xls is now the first choice

closes odoo/odoo#30724
2019-01-31 10:41:33 +00:00
Pierre Paridans 6ca2563155 [FIX] web: form's tabs should be scrollable on mobile
On mobile, swiping right/left switches to next/previous record.

This feature prevents the horizontal scroll of the form notebook's tabs by
overtaking the swipe gesture on those elements.

This issue had different consequences depending on the platform:
  - on iOS: the tabs cannot be scrolled at all.
  - on Android: the tabs can only be scrolled by using a two-fingers
    gesture

This commit restore the horizontal scroll on the tabs but also keep the
swipe-gesture to navigate records.

opw-1929267

closes odoo/odoo#30658
2019-01-30 15:42:41 +00:00
Olivier Dony 483b6024cd [FIX] base: restore auto report layout selection
As of 12.0 the superuser account (UID 1) is only meant to be used for
advanced debugging, and non-superuser admin accounts are used for
day-to-day administration.

Adapts the admin detection system to allow non-superuser admins to
select the report layout as well.
2019-01-30 22:31:51 +01:00
Olivier Dony e61b0cac46 [FIX] account_payment: warn when payment can't be matched
The payment reconciliation screen can't be opened if there is no partner
on a payment, and currently crashes with a traceback.
Rather than hiding the button which could cause surprises for users, we
can raise a proper error to explain why it can't work, for the cases
where a payment has no related partner.

This could happen for example when a customer paid via a direct
/website_payment/pay link.
2019-01-30 22:31:51 +01:00
Nicolas Lempereur 006002646e [FIX] survey: resend survey input=>right one
When we use "Send invitation again" on a survey.user_input, it will send
the first survey.user_input it finds corresponding to:

- the state "new" or "skip",
- the partner it must be sent to,
- the survey the user_input corresponds to,
- the email it must be sent to,

or if none found, it could be create a new one.

This is an okay behavior in most instance, but in the case of
hr_appraisal where a manager could have same survey to fill for
"employee A" and "employee B" and when you send them again, we would receive two
mails linking to the same employee.

With this changeset, the current behavior is kept but when an existing
user_input is resent, we prioritize itself before searching a matching
one.

opw-1934478
closes #30693
2019-01-30 13:43:14 +00:00
Denis Ledoux d11a2000c4 Revert "[FIX] base ir.actions.report order pdfs when attachment_use option selected"
This reverts commit 529069996c, reversing
changes made to 76e085cbb7.

PR #30690 is a cleaner solution to the problem
than PR #30402.

closes odoo/odoo#30696
2019-01-30 14:00:49 +00:00
Nicolas Martinelli 1b753b0d53 [FIX] document: PDF indexing
Since PyPDF2 gives bad results for PDF indexing, stop using it since it
raises more issues than it helps users.

opw-1928446

closes odoo/odoo#30692
2019-01-30 12:50:27 +00:00
Christophe Simonis 5ad3d599ce [MERGE] forward port branch 11.0 up to 7eec6b3643 2019-01-30 13:25:36 +01:00
Denis Ledoux 651859a337 [FIX] web: reports, fallback for external report layout.
Following revision 61eef73b52

the fallback to the standard external layout when
the external layout is not set on the company has been removed.

It therefore leaded to the raise of the exception
```
The report's template '%s' is wrong, please contact your administrator.
Can not separate file to save as attachment because the report's template
does not contains the attributes 'data-oe-model' and 'data-oe-id'
on the div with 'article' classname.") %  self.name)
```

when the external layout was not set,
which could happen quite easily in a multi-company environment,
if you do not set the company external layout after having created it.

This revision simply puts back the fallback as it was before.

opw-1931195

closes odoo/odoo#30687
2019-01-30 10:57:00 +00:00
Julien (juc) Castiaux c7b6fcb9f2 [FIX] hr_holidays: Disable emails when importing from file
When using the "test import" feature to import leaves request, odoo
fails with a 500 error and no error message.

The only difference with a real import is that the test dry-runs by
rollbacking. The issue here is that mails are sent *after* a commit
is done hense crashes because they do not exist anymore.

opw-1916913

closes odoo/odoo#30523
2019-01-30 14:29:23 +00:00
Christophe Monniez e3f54a7808 [FIX] stock: use proper font in PDF report
When printing a delivery order in waiting state under MS Windows, the
produced PDF does not use the proper font for the warning line.
This leads to an unreadable line full of small rectangles.

The problem comes from the fact that the 'fa' class is applied to a full
paragraph.

With this commit, the proper 'i' tag is used to display the exclamation
triangle.

opw-1931892

closes odoo/odoo#30680
2019-01-30 09:26:44 +00:00
wan 3eead65f07 [FIX] account: add date field in reconciliation writeoff form
purpose:
    when creating a writeoff from the manual reconciliation widget (invoices & payment matching), there's no way to specify the date of the writeoff journal entry

specs:
    in v12, add a date field in the js and set the date of the writeoff entry accordingly

Was PR #29794
Was OPW 1896593

closes odoo/odoo#30676
2019-01-30 09:28:40 +00:00
qdp-odoo 0237654113 [REF] base, account: removed useless @api.depends on name_get() 2019-01-30 09:16:26 +00:00
wan 7e9009f93a [IMP] base: choice of state/country easier in banks and partners
OPW 1891131
closes #27497

When creating a new bank account/partner address, the view displays the 'state 'field before the 'country_id'  field, which naturally leads users to select the state before selecting the country.
But there was problem: in order to select a state, one had to first select a country, which was confusing.

Done:
  - allow the user to select the state before the country (without restriction on country)
  - remove the state from the form when the country changes, if the state (name) is not in the country
  - automatically set the country when the state is set
  - always display the country code in the name_get of res.country.state, to deal with the case where different countries have a state with the same name
2019-01-30 08:55:32 +00:00
qdp-odoo 3ef3aeb640 [FIX] account: Added missing method to save template 2019-01-29 14:18:58 +00:00
Julien (juc) Castiaux e65446fe42 [FIX] mail: Force the writing of the attachment when the user can post
To reproduce:
1) Enable multi-company
2) Create two companies: c1, c2
3) Create two users: bob in c1 and alice in c2
4) Install subscription
5) Remove the ir.rule that forbid users from accessing subscriptions
   made in other companies: "Subscription multi-company"
6) Using u1, create a new subscription in c1
7) Using u2, follow the chatter of the newly created subscription
   allowing the user to post messages/log notes.
8) Using u2, send a message with an attachment. Access Error.

The problem raises only for the **first** attachment. That
attchement is written on the record as the main attachment thus
raises an error if the user doesn't have write access.

There is no problem to add attachment to any following record or
when the user has write access on the model. If the user doesn't
have access to the chatter, he is blocked before accessing the
write thus it is safe to sudo it.

opw-1915606

closes odoo/odoo#30659
2019-01-30 10:46:01 +00:00
Nicolas Martinelli 1dbe4ea0d7 [FIX] web: current date
- Set the OS in a timezone such as the current day is different from the
  day in UTC (e.g. America/Nome before 10:00 AM or Australia/Melbourne
  after 3:00 PM)
- Open any datepicker
- The 'little triangle' indicating the current day is wrongly set (one
  day before or after)

Knowing that Odoo always creates momentjs date and datetime with the
`UTC` flag set to `true`, the `bootstrap-datetimepicker` does something
which seems inconsistent.

First, it retrieves the `viewDate`, and sets it to the beginning of the
month and week in:

https://github.com/odoo/odoo/blob/1c6c504215f3ef09e6336c92c9d350e87599eaa1/addons/web/static/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js#L725

In this part, it is important to note that each `startOf` functions
called sets the hours/minutes/seconds to zero. It means that the
reference time is changed.

Then, it iterates on this newly created date, and determines `today` by
comparing it to `getMoment()` in:

https://github.com/odoo/odoo/blob/1c6c504215f3ef09e6336c92c9d350e87599eaa1/addons/web/static/lib/bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js#L748

However, `getMoment()` returns the current date and time, but with the
`UTC` flag set to `false`.

Therefore, we compare a UTC datetime on which the reference time has
been changed to a non-UTC datetime, which fails to give the appropriate
current day.

There are two approaches to solve this. The first possibility is to
change the way Odoo defines momentjs dates and datetimes, maybe by
removing the `UTC` flag at creation. This sounds like a bad idea, since
other widgets or views (such as the calendar or the pivot view) make use
of them. This is likely to introduce a bunch of new issues with TZ in
these views. The second approach is patching the library to fit our use.
Although we usually don't do such a thing, this allows to specifically
solve this use case, and in particular placing the 'small triangle' at
the appropriate date without impacting any other part of the system or
the library. It can be easily performed by comparing the dates and the
months to make it work.

opw-1915251

closes odoo/odoo#30538
2019-01-29 13:26:22 +00:00
sbbaro 7e0603785b [FIX] base.ir_actions_report print ordered pdfs
When printing multiple reports with the "Reload from Attachment" option
selected, the order of the rendered pdfs was not respected. Using an
ordered dictionary instead of a randomized one solves the problem.

opw 1915685

closes odoo/odoo#30690
2019-01-30 09:42:20 +00:00
Christophe Simonis cd5c8a02f9 [MERGE] forward port branch 11.0 up to 36d96e0150 2019-01-29 13:17:12 +01:00
Christophe Simonis 36d96e0150 [MERGE] forward port branch saas-15 up to 788684a5dd 2019-01-29 11:57:06 +01:00