Commit Graph
124195 Commits
Author SHA1 Message Date
Jorge Pinna Puissant 93614a35eb [FIX] account: invoice outstanding credits display
Before this commit, in the customer invoice form, when the outstanding
credits have a big reference or name, the form displayed the name in a
multiple line which made difficult to read and to understand when a
credit starts, and when a credit stops. It also overlapped the name and
the amounts.

Now, when the name is too big, it's truncated, and the full name is
shown when the mouse hovers the field.

OPW-1915966

closes odoo/odoo#30518
2019-01-24 13:26:12 +00:00
Wolfgang TafernerandNicolas Martinelli c5eeae0d5a [FIX] account: negative bank statement amount
- Create a bank statement for a negative amount, e.g. -100.
- Click 'Reconcile'.
- Create a counterpart line for this bank statement, but specify
  receivable account.

The payment created has `partner_type` set as `supplier`.

Although a receivable account is used for customers.

This use case can arise in case of a credit note to a customer: the
reimbursement should create a customer payment, not a supplier payment.

Co-authored-by: Nicolas Martinelli <nim@odoo.com>

opw-1910807

closes odoo/odoo#30232
2019-01-28 10:13:31 +00:00
Raphael Collet 6bdf06d704 [FIX] stock_account: query amls only for products valued in real time
closes odoo/odoo#30151
2019-01-25 15:14:48 +00:00
Raphael Collet 1e6b35ad96 [FIX] stock_account: optimize computation of stock value on product 2019-01-25 15:14:48 +00:00
Jorge Pinna Puissant 5f77d0e77d [FIX] mrp: multi-companies default location
Before this commit, in a multi-companies when the user can manage
multiple stock locations, there is an error with the default Locations
('default location' and 'default Destination Location' in an Unbuild
Orders; and 'Raw Materials Location' and 'Finished Products Location' in
a Manufacturing Orders). The default gives the stock location of the
first company, if we are working in a different company it will generate
an access error. Also, in an Unbuild Order you could choose location
that there are not internal at the company.

Now, the default location, it's the one of the first Warehouse of the
company. And the form only propose to choose internal locations.

OPW-1919771

closes odoo/odoo#30585
2019-01-28 10:01:59 +00:00
Odoo Translation Bot ebbb5b8d37 [I18N] Update translation terms from Transifex 2019-01-27 03:14:28 +01:00
Denis Ledoux 8fb76c425d [IMP] api: improve storing performance of the api cache
This revision moves the `cache_key` to the first level
dict of the cache, instead of the last one.

Doing so, we reduce the number of times the reference
to the cache key is stored in the dict.

For instance,
for 100.000 records, 20 fields and 2 env (e.g. with and without sudo)
formerly, there were 100.000 * 20 * 2 occurences of cache key references
now, there is only 2 references.

Storing references to an object consumes memory.
Therefore, by reducing the number of object references
in the cache, we reduce the memory consumed by the cache.
Also, we reduce the time to access a value in the cache
as the cache size is smaller.

The time and memory consumption are therefore improved,
while keeping the advantages of revision
d7190a3fd0
which was about sharing the cache of fields
which do not depends on the context, but
only on the cursor and user id.

This revision relies on the fact there are less different references
to the cache key then references to fields/records.
Indeed, this is more likely to have 100.000 different records stored
in the cache rather than 100.000 different environments.

Here is the Python proof of concept that was used
to make the conclusion that setting the cache_key
in the first level dict of the cache is more efficient.
```Python
import os
import psutil
import time

from collections import defaultdict

cr = object()
uid = 1
fields = [object() for i in range(20)]
number_items = 500000

p = psutil.Process(os.getpid())
m = p.memory_info().rss
s = time.time()

cache_key = (cr, uid)
cache = defaultdict(lambda: defaultdict(dict))
for field in fields:
    for i in range(number_items):
        cache[field][i][cache_key] = 5.0
        # cache[cache_key][field][i] = 5.0

print('Memory: %s' % (p.memory_info().rss - m,))
print('Time: %s' % (time.time() - s,))

```
- Using `cache[field][i][cache_key]`:
   - Time: 3.17s
   - Memory: 3138MB
- Using `cache[cache_key][field][i]`:
   - Time: 1.43s
   - Memory: 756MB

Even worse, when the cache key tuple is instantiated inside the loop,
for the former cache structure (e.g. `cache[field][i][(cr, uid)]`),
the time goes from 3.17s to 25.63s and the memory from 3138MB to 3773MB

Here is the same proof of concept, but using the Odoo API and Cache:
```Python
import os
import psutil
import time

from odoo.api import Cache

model = env['res.users']
records = [model.new() for i in range(100000)]

p = psutil.Process(os.getpid())
m = p.memory_info().rss
s = time.time()

cache = Cache()
char_fields = [field for field in model._fields.values() if field.type == 'char']
for field in char_fields:
    for record in records:
        cache.set(record, field, 'test')

print('Memory: %s' % (p.memory_info().rss - m,))
print('Time: %s' % (time.time() - s,))
```
- Before (`cache[field][record_id][cache_key]` and cache_key tuple instantiated in the loop):
   - Time: 4.12s
   - Memory: 810MB
- After (`cache[cache_key][field][record_id]` and cache_key tuple stored in the env and re-used):
   - Time: 1.63s
   - Memory: 125MB

This can be played in an Odoo shell, for instance
by storing it in `/tmp/test.py`, and then
piping it to the Odoo shell:
`cat /tmp/test.py | ./odoo-bin shell -d 12.0`

closes odoo/odoo#29676

closes odoo/odoo#30554
2019-01-25 16:25:27 +00:00
Denis Ledoux 79416ba6c4 [IMP] api: gain some memory by not creating the cache_key tuple multiple times 2019-01-25 16:24:59 +00:00
Raphael Collet f9582bf1db [FIX] base: missing tests on record cache 2019-01-25 16:24:55 +00:00
Hetal Dhanak 1dbef66b49 [FIX] web: date filter operators less than greater than
Before this commit, in the filter, when using a custom filter with a
date field, the operators "is after" and "is before" were set to execute
"is after or equal" and "if before or equal" respectively. That means it
includes in the results, records with the same date as the filter.

Now, the operators 'is after' and 'is before' won't include the records
with the same date as the filter. And the operators 'is after or equal'
and 'is before or equal' will include the records with the same date as
the filter.

Fixes #29868
OPW-1921756

closes odoo/odoo#30560
2019-01-25 14:53:56 +00:00
jev a4a3bfd373 [FIX] mail: activity, crash when activity type is null
When activity_type_id is null on an activity
marking it as 'done and schedule schedule next' crashed

OPW-1928989

closes odoo/odoo#30522
2019-01-25 09:51:34 +00:00
Bohdan Lisnenko 5abad42e7b [FIX] website_sale_comparison: keep attributes order consistent
Backport of 9298c576f4

+ adapt for v11

closes odoo/odoo#30305
2019-01-17 10:25:38 +00:00
Florent de Labarre 1c6c504215 [FIX] l10n_fr: set correct type for account 120 000
Because in France the affectation depends on the result (gain or loss) for the selection of account and thus, we cannot arbitrary choose one.
Was PR #17775

closes odoo/odoo#30527
2019-01-24 15:59:47 +00:00
Katherine Zaoral 43b7dfed67 [FIX] website_sale: do not replace context
Add quantity key to context instead of overwrite the entire context
If another context key was present, it would be lost

Introduced at 166a9d26e3

closes odoo/odoo#30519
2019-01-24 14:42:52 +00:00
len-odoo d1490e2777 [FIX] mail: do not have _get_message_needaction crash on empty task list
Suppose that a Task is added on a task via a studio customisation.
Then the _get_message_needaction method gets called on the onchange of the
toplevel task, which triggers another call to _get_message_needaction.
During that update, we get a self with a model.newID; its ids field is empty,
so the list of tasks res itself is empty.
As a result the method crashes on a malformed query.
This can in turn prevent the completion of some higher-level operation,
e.g. a state change on the task.

opw 1909043

closes odoo/odoo#29084
2018-11-28 09:11:28 +00:00
Lucas Perais (lpe) 2e109db01b [FIX] web: context orderedBy not propagated to x2m
Have:
- Model A with a x2m to model B
- Object A with multiple objects B in x2m (that will be sorted)
- On the list view of model A, click on a column to sort by a field
- this field shall not exist in B
- open a record A (towards form view)

Before this commit, the sorting of the x2m crashed, because the key orderedBy was propagated
Due to commit e713ed2a69

After this commit, it doesn't crash

OPW 1913133

closes odoo/odoo#29094
2018-11-28 09:35:39 +00:00
Prakash Prajapati 679cf0d83f [FIX] purchase_requisition: Request Approval on exclusive requisition
Usecase to reproduce:
- Enable 'Managers must approve orders'
- Set agreement type as 'exclusive'
- Connect as purchase user
- Create a requisition and an RFQ linked to it
- Confirm the RFQ

It raises a usererror that ask to close other PO linked
to requisition.

It happens because the purchase requisition code do not take
care of double validation on PO. It will try to close the requisition
once button_confirm is called. However it will only write 'to approve'
on PO state and thus trigger the requistion error will be raise since
all linked PO are not 'done' or 'cancel'.

In order to fix it, the action_done on requisition should be call
on button_approve instead of button_confirm. (button_approve is
automatically called when double validation is not enable).

Task: #1884410
Closes #28068

closes odoo/odoo#29049
2018-11-28 04:51:02 +00:00
Christophe Simonis 476866ddab [MERGE] forward port branch saas-14 up to f5dc49da89 2018-11-27 17:09:04 +01:00
Christophe Simonis f5dc49da89 [MERGE] forward port branch 10.0 up to 6639630de1 2018-11-27 17:08:00 +01:00
Raphael Collet 42c42832b3 [FIX] base: translations lost after synchronization
Modifying a source term in an XML/HTML translated field can lose translations
if the same term is translated in several languages.

closes odoo/odoo#29078
2018-11-27 16:07:46 +00:00
Denis Roussel 6639630de1 [FIX] base: make check_credentials more consistent with alternatives
The other methods do test password length before verifying it, so even
if check_credentials() is not meant to be called directly, it's better
to keep it consistent with the alternatives.

Closes #29023
2018-11-27 10:14:43 +01:00
David Beguin 7d1c05216b [FIX] survey : apply min and max date configuration in survey page
The configuration of question of type 'Date' was not used at all.
The datetimepicker configuration was hardcoded and did not take into
account the configuration of questions of type 'Date'.

Now, for each datetimepicker, we use the corresponding configuration
for min and max date.

Task ID : 1912194
Closes PR #28966
2018-11-27 09:32:14 +01:00
len-odoo 8db7d70776 [FIX] mrp: do not lose done quantities when updating the quantity to do of a MO
Suppose you have a workorder to create n units of product P,
using raw material R (suppose we use one for one, the following can be extended
to any number of raw materials and factors in a straightforward manner).

Produce j < n units of P. Next, update the quantity to produce to j < k < n.
Since any number m of units between j and n may already have been reserved,
in particular values such that m > k, the move will unreserve the material R.
However, while doing so it will unlink the move_lines, and lose the
quantity_done (j).
The newly created move lines have a quantity_done of zero by default.

Therefore, we store in a dictionary the quantities done for each move line,
and reset these values once the unreservation/reservation of k units is done.

opw 1911969

closes odoo/odoo#28990
2018-11-26 12:56:23 +00:00
Gert Pellin 09f24de5d3 [FIX] point_of_sale: group products with pricelist
Before this fix products in a pricelist would not be grouped when there
is a decimal value in the price.

This problem was caused by a trailing rounding error, for instance a
price of 29.90 could give a pricelist price of 29.900000000002. To solve
this we check if Math.round((price - pricelist-price)/currency-rounding)
gives 0 as a result, if so, the price is equal to the pricelist price
and the product can be grouped.

solves: https://github.com/odoo/odoo/issues/28521#issuecomment-443148920

closes odoo/odoo#29185
2018-12-05 12:25:35 +00:00
Lucas Perais (lpe) da18c1a115 [FIX] web: exclude orderedBy when changing action
When activating a filter on a list view,
the environment of the action contained a context with an orderedBy key
which was then used by every controller and model in the various
parallel flows, i.e. changing actions

After this commit, we prevent it by excluding the key when executing an action

OPW 1913190, 1914019

closes odoo/odoo#29186
2018-12-05 12:19:23 +00:00
Julien (juc) Castiaux e97e41f2e3 [FIX] account: change reconciliation journal to a non-reconciliable
Changing the journal of a reconcialiation model to a journal not
reconciliable resulted to the model not accessible from any
menu.

opw-1913079

closes odoo/odoo#29249
2018-12-05 08:43:22 +00:00
Olivier Dony 3b85900faf [DOC] install: update info about wkhtmltopdf
We now support version 0.12.5(.1), which is available for all recent Debian and Ubuntu versions,
and contains quite a few bug fixes. An up-to-date version of Odoo 10 or later is required, for
pixel-perfect compatibility with the result of 0.12.1.3.
See also the wiki for more info: https://github.com/odoo/odoo/wiki/Wkhtmltopdf
2018-11-26 13:40:15 +01:00
David Beguin 06e1a46c04 [FIX] survey : fix review survey page
The prefill of the date field must be done after the initialisation,
otherwise, it would override the value. so prefill must be done inside
the .then to avoid prefill before the locale is ready.

Since the datetime are real datetime in DB, we cannot give real datetime
to JSON but string instead.

Finally, no need to keep the div class row. Otherwise, it would put everything
on same line and the jumbotorn div wouldn't be on top on the rest of the page.

Special thanks to @awa-odoo that gave me his masterpiece brain
to help me on this.

Task ID : 1911291
Closes PR #28966
2018-11-26 12:04:47 +01:00
David Beguin 318893d6ed [IMP] im_livechat, website_livechat : update website default livechat
In order to facilitiate the configuration of a livechat on the website,
the first livechat channel that was demo data from im_livechat
is now set as data. Website is now using this first livechat channel
instead of creating a new one and using it.

Task ID : 1912056
Closes PR #29020
2018-11-26 08:47:19 +00:00
David Beguin 5738a046be [FIX] survey : fix datetimepicker initialization - BS4
Since BS4, input-group is used instead of form-controll.
The initialisation was not correctly made because it didn't find
the datetimepicker.
There were several resulting issues:
- Max and Min date were not taken into account
- Clicking on the text area of date field was not opening the
    datetimepicker as config was not defined (allowInputToggle option)

Task ID : 1911291
Closes PR #28966
2018-11-23 10:00:55 +01:00
David Beguin 937db5386a [FIX] survey : Fix datetimepicker single id issue.
In survey template, the datetimepicker was created with always the same id.
So if two date fields were present on the same page, it created a
multidemensional vortex that broke an alternative reality, resulting in
not being able to fill in both date fields and other crapy stuffs.

Also, the sass file needed to work with tempusdominus library were not
loaded with the js file that comes with it. Resulting in an hugly calendar
(if it could be called calendar) widget.
As survey does not load backend nor frontend assets, it's necessary to have
both files (js and sass files) in common assets.

Task ID : 1911291
Closes PR #28966
2018-11-23 10:00:46 +01:00
Christophe Simonis b3052b690f [FIX] point_of_sale: use pycompat.izip 2018-11-23 00:35:16 +01:00
Christophe Simonis 5de8842b31 [FIX] account: correct test
Let postgres do the casting...
2018-11-22 21:38:45 +01:00
Christophe Simonis 97f3f9d118 [FIX] point_of_sale: adapt code and test to version 12
Oversight of previous forward-port.
2018-11-22 21:36:53 +01:00
Christophe Simonis 4cbcbe9ea4 [FIX] base: adapt property field optimization to native date(time) fields
See b6d32de31e
2018-11-22 20:33:22 +01:00
Christophe Simonis 70f9cb33ac [FIX] base: remove leftover print statements 2018-11-22 20:19:06 +01:00
Christophe Simonis b4e1be8ab0 [MERGE] forward port branch saas-11.3 up to b09f624f20 2018-11-22 20:06:48 +01:00
Christophe Simonis b09f624f20 [MERGE] forward port branch 11.0 up to 263b388c50 2018-11-22 17:52:57 +01:00
Christophe Simonis 263b388c50 [MERGE] forward port branch saas-15 up to e44c35f407 2018-11-22 17:06:31 +01:00
Nicolas Lempereur 1c4d49330e [FIX] mail: notif manager positions date + check
By default in the notification manager we see something like:

```
record name     {a second ago}
summary                      V
```

but if for example the record name is long or the summary empty, we can
have something like:

```
record name so very long {a s}
V
---
record name so very very lo...
                             V
```

This is because the record name was not allowed to grow, and the
positionning of the check mark based itself on the existence of the
summary container (.o_last_message_preview).

With this change the date a message was sent is shown in any case and
the check mark is on the right.

opw-1911654
closes #28960
2018-11-22 14:45:33 +00:00
Raphael Collet 9d72263717 [FIX] base: partner.user_ids only shows active users
Returning inactive users breaks many features based on the partner's user ids
(among which the company switcher).

This reverts a small part of commit 14af2c7f2fe6c14afb96d7e9f2bb02b2a022eaae
which is related to #25939.  That part was not necessary and had some
unintended side-effects.

closes odoo/odoo#28947
2018-11-22 15:03:06 +00:00
Yannick Tivisse e3a4bfa1c6 [FIX] hr_payroll: Display currency on payslip pdf report
Purpose
=======

There is typo that doesn't display the currency next to the different amounts
on the payslip report.

closes odoo/odoo#28964
2018-11-22 14:46:45 +00:00
Christophe Simonis e44c35f407 [MERGE] forward port branch saas-14 up to a9752d3ad3 2018-11-22 15:03:01 +01:00
Christophe Simonis a9752d3ad3 [MERGE] forward port branch 10.0 up to af476c6949 2018-11-22 14:39:08 +01:00
Swapnesh Shah 1b8ac11d16 [FIX] sale: Fix _compute_type_name to work in batch
Closes #28713

closes odoo/odoo#28742
2018-11-22 13:35:27 +00:00
Alexandre Saunier 1d2a4d8459 [IMP] hr_attendance: faster loading of employees kanban view 2018-11-22 12:22:36 +00:00
Alexandre Saunier e946f00801 [CLA] Add asaunier to Camptocamp CLA 2018-11-22 12:22:17 +00:00
Toufik Ben Jaa ae6ab96629 [FIX] payment: if a payment transaction processing fail, rollback.
- Before this commit when a transaction failed, the code doesn't
  rollback and continue to process the other transaction, thus creating
  record that should be rollbacked.

closes odoo/odoo#28748
2018-11-22 11:44:36 +00:00
Yannick TivisseandCas Vissers 02ce0022b2 [FIX] hr_holidays: Fix remaining leaves count on employee form
Purpose
=======

Currently the remaining leaves substract the taken leaves with
no needed allocation.

That way, sick leaves are removed from the remaining leaves for example.

Closes #28659

Co-authored-by: Cas Vissers <c.vissers@brahoo.nl>

closes odoo/odoo#28951
2018-11-22 11:35:08 +00:00
Nicolas Lempereur 10f0766b3e [FIX] mail: no link special character mention
When we mention for example `@hell'o`, the user will be added as
subscriber but he is not linked.

This is because there is two part of mentions:

- inserting the mention in the message: at this point the mention is
  not escaped (only space are replaced with non-breaking space).

- wrapping a link around the mention in a message that is being posted:
  at this time the message has been escaped ( for &<>"`' ).

Thus when wrapping the mention, we have to search the escaped content.

In the case of canned response, the system is different with defined
substitution that replaced the "shortcut" so this makes no change to
that.

Added test without fix failed with:

8. should contain a link in the message content (expected:1, result:0)
9. should have correct mention link in the message content
    (expected:"@ЅpëciãlUser<&>\"`' ツ", result: "")

opw-1909300
closes #28846
2018-11-22 11:04:47 +00:00