Commit Graph
126133 Commits
Author SHA1 Message Date
Yannick Tivisse f29d9dfe2e [IMP] hr_payroll: Put single payslips in a batch.
When creating a payslip, if no batch is defined for it, put it
automatically in a new batch.
2018-11-30 11:08:20 +01:00
Yannick Tivisse 9bab1ed2af [IMP] hr_payroll: Improve payslip creation/validation flow
Avoid to display the buttons on each stage (compute sheet, cancel, ...).

Now the next action is clear on the payslip.
2018-11-30 11:08:20 +01:00
Yannick Tivisse 3cc823a690 [IMP] hr_payroll: Make 'contract_id' related on worked_days/input lines
No need to display this information on every worked days/input lines

It makes no sense to have a different contract on different payslip lines
too.
2018-11-30 11:08:20 +01:00
Yannick Tivisse fbfd98a779 [IMP] hr_payroll: Group payslips by batch by default 2018-11-30 11:08:20 +01:00
Yannick Tivisse 9cd7dbe22d [IMP] hr_payroll: Remove 'Details By Salary Rules Category'
This field brings nothing more than the payslip lines.

Btw the term is badly chosen, it doesn't display the lines by salary rules category,
it displays the payslip lines that have a category.

The printed report is not very useful too. The only interesting part is the
contribution register at the end of the report, and there is already a dedicated
report for that.
2018-11-30 11:08:20 +01:00
Yannick Tivisse c7bbbd41c7 [IMP] hr_payroll: Remove hr.rule.input model
There are currently 2 models:
- hr.rule.input to link some inputs to an hr.payslip.rule
- hr.payslip.input to add some additional inputs on a payslip.

The first model is actually there to automatically add inputs on the
additional inputs on the payslip. This is problematic because these
rules are always added (For example a salary reduction due to a
police fine). As these inputs are always added on the payslip, the
the related rules are always computed with an amount of 0.

We decided to remove this mechanism for the following reasons:
- If the rule is important and common, then define the needed values on
  the contract, and compute the rules from that.
- If the rule is not so important, it should be added manually when needed.
2018-11-30 11:08:19 +01:00
lul-odoo 78128760c5 [IMP] hr_payroll: Add new models hr.benefit, hr.benefit.type
Purpose
=======

For payroll purpose, we need to manage attendances.
For instance, someone is working only mondays, tuesdays and fridays, but works exceptionally an other day.
It must be recorded.

Specification
=============
The new models are used to represent attendances, extra hours and leaves (as `hr.benefit`s) in a new window called "Benefits".
The schedule of employees for the full month is visible in that view (calendar view).

First the benefits needs to be generated (via a button) based on the calendar attendances and leaves.
The manager can then check benefits, delete or add some. Only the benefit name and type can be edited (not start and end dates).
Once benefits are correct, they can be validated. Validation will fail if they are some leaves to approve or if some benefits overlap on the same day.
Benefits cannot be deleted or edited once validated.
When benefits are all validated, a button appears to generate payslips.

Closes #28261
2018-11-30 11:08:19 +01:00
lul-odoo 5a9b8a41b6 [IMP] resource: Add domain parameter to compute attendace intervals
Purpose
=======
More flexibility is useful when using the _attendance_intervals method (resource.calendar) in other modules when inheriting resource.calendar

Specification
=============
The commit adds a `domain` parameter to the _attendance_intervals method in resource.calendar, allowing
to better control attendances from which to compute intervals.

+ small refactoring: extraction of duplicated code in method
2018-11-30 11:08:19 +01:00
lul-odoo 07bec7db87 [FIX] hr_payroll_account: Remove journal_id: False in context
If the wizard to generate payslip was launched without an ´active_id´ in the context.
A ´journal_id´ entry was set to False in the context later leading to a crash at payslip creation.
The crash happens because, at creation time, the journal_id of a ´hr.payslip´ is set to the journal_id
in the context if its present. Since this context entry is False and the journal_id field is required,
creation crashes.
2018-11-30 11:08:19 +01:00
Géry Debongnie f6c104d2e5 [IMP] web: do not eval modifiers if not necessary
Before this commit, the web client evaluated all modifiers
(readonly/invisible/required) in some cases, even if it only needed one
of them.  This is clearly not optimal, and I even suppose that for large o2m,
it could even have a noticeable effect on web client perceived speed

This commit simply make sure that we evaluate only what we need in those
cases.  Note that it is not really a testable improvement, hence the
lack of tests.

closes odoo/odoo#29171
2018-11-30 08:53:31 +00:00
Kirti Choudhary ba9b5ce12b [IMP] stock: default responsible + activity responsible
Traceback when the responsible is not set on an activity
since it's a required field. In this case we will use the
odoo system responsible for the activity.

Also reintroduce the default value for the responsible as
the user that create the product. The purpose is to avoid
to log all the activity for the odoo system but to dispatch
the exception between user, if a user create the product he
will probably be responsible for it. It is always possible
to remove the responsible or to modify it.

Task ID - 1913168

closes odoo/odoo#29138
2018-11-30 06:18:27 +00:00
Arnold Moyaux 1c28ba8c47 [REF] delivery: hs code back in delivery
hs code was dropped in 12.0 however it shouldn't have been (commit 2d738f8563). commit 498dbc548b created a new module in order to avoid losing hscode for existing database during migration.

This commit set it back as before.

closes odoo/odoo#29167
2018-11-30 06:10:21 +00:00
Christophe Simonis b6e94c3e4d [FIX] web: correct test definition
Oversight of previous forward-port
2018-11-29 20:55:58 +01:00
Christophe Simonis ce4cc24621 [MERGE] forward port branch 12.0 up to 82a1e1dcc3 2018-11-29 20:06:16 +01:00
Xavier Morel 4d7aa97da3 [FIX] core: fixup of convert cleanup
_tag_delete was not properly converted when the _tag_ calling
convention was modified in 4d581e26c2,
so <delete> tags would all blow up if encountered.

closes odoo/odoo#29149
2018-11-29 13:46:14 +00:00
Hetashree Chauhan 9c793253d7 [IMP] purchase: create&edit for Payment Terms
If a user is at the same time purchase user and billing manager
he can't create a new payment terms from the PO and he has to
navigates throws multiple menus instead of just using the create
and edit function.

taskId 1868555
Closes #28280
2018-11-29 13:14:26 +00:00
Adrian Torres 758382b3a7 [REM] pycompat: remove python 2 shims and helpers
Odoo no longer supports python 2, thus some of these helpers can and
have been replaced by python 3 built-ins, therefore there is no need for
them to stay defined.

The removed helpers are:
    * izip, imap and ifilter
    * unichr, text_type
    * implements_to_string, implements_iterator
    * string_types, integer_types
    * to_native

The python 2 shims have also been removed, and only the python 3 helpers
have been kept, because they can still be usable (i.e. accepting
both bytes and str for functions that can only accept one of the two)

[REM] pyjsparser: remove PY3 shims

They're no longer necessary as Odoo doesn't officially support python 2
anymore.

closes odoo/odoo#28519
2018-11-29 09:28:17 +00:00
Adrian Torres 52f5528cfb [REF] *: replace deprecated pycompat helpers for builtins
This commit replaces calls to pycompat helpers that were intended for
python 2 <-> python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.

This includes:
    * calls to imap/izip/ifilter replaced by map/zip/filter
    * uses of text_type replaced by str
    * uses of unichr replaced by chr
    * calls to implements_to_string, implements_iterator removed
    * string_types and integer_types replaced by str, int respectively
    * calls to to_native replaced by calls to to_text

This is done in preparation to the removal of these deprecated helpers
in the following commit.
2018-11-29 09:28:17 +00:00
Adrian Torres e5c864a596 [REM] test_pylint: remove PY2/PY3 restrictions
Since Odoo no longer officially supports python 2, some of the
restrictions previously imposed by test_pylint are no longer necessary,
either because the usage of some builtin functions is legal (zip, map,
filter) or because the concerned function/module would already raise a
relevant error under python 3.
2018-11-29 09:24:26 +00:00
Antony Lesuisse 0af56a4364 [IMP] base: default name for ir.actions.act_window
Take the name of the model if no name is set for an action

closes odoo/odoo#29027
2018-11-29 09:06:33 +00:00
Mitali Patel d6abf593d7 [IMP] stock: displaying improvements
On some models, like picking, package and move, the weight was hardcoded
in 'kg', we instead use the value in the ir.config.parameter.

We also changed some field labels to give them more meaning.

Related Task ID: #1895297

closes odoo/odoo#27944
2018-11-29 08:46:13 +00:00
Jeremy Kersten c2d83973ea [FIX] mass_mailing: don't short url before rendering
Before this commit, if you generate the href with jinja/mako syntax,
the un-rendered url will be shortened.

So:
    href="https://www.odoo.com?id=${object.id}"
will become:
    href="https://www.odoo.com/r/asw"

where
   https://www.odoo.com/r/asw
redirect to
   https://www.odoo.com?id=${object.id}
instead of
   https://www.odoo.com?id=1

Adaptation of #28540 for 11.0 version.

opw-1903803
closes #29083
2018-11-28 10:21:11 +00:00
Kishan Gajjar daceeb5348 [FIX] web_editor: use default value for html fields of new records
While creating a new record, the default value of a field used with the
'html_frame' field widget was not used.

Discovered with task-1903256

closes odoo/odoo#28838
2019-01-28 14:10:03 +00:00
Nans Lefebvre 201a1664b2 [FIX] mrp: use the true level in BoM structure report
The BoM structure report is recursive, since product X might use a product X.Y,
itself built using a BoM that uses X.Y.Z, and so on.
To avoid breaking the layout in cases with too deep nestedness,
the report returned a level bounded by 6.
This is a totally arbitrary value: the layout can be broken not only
because of nestedness, but also because of the length of the product name.
So it doesn't really solve the problem.
Moreover, a presentation problem should be solved at the presentation layer,
which is CSS.

opw 1921011

closes odoo/odoo#30606
2019-01-28 10:38:35 +00:00
Moens Alexandre aecfd1a307 [FIX]mail:reply to message with no author
When a user/partner is deleted, their messages lose their author.
Replying to those may result in a failure to fetch the mails from the
incomming mail server.

without this commit, partner_ids == [(4, False)] and this value "goes
down" all the way to the orm method "write" of the Many2many field.

resulting in a SQL query like :

INSERT INTO mail_message_res_partner_rel (mail_message_id, res_partner_id)
    (SELECT a, b FROM unnest(ARRAY[149855]) AS a, unnest(ARRAY[false]) AS b)
    EXCEPT (SELECT mail_message_id, res_partner_id FROM mail_message_res_partner_rel WHERE mail_message_id IN (149855))

which fails with the ProgrammingError : EXCEPT types boolean and integer
cannot be matched

opw-1921805

closes odoo/odoo#30528
2019-01-24 15:49:45 +00:00
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