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.
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.
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
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
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.
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.
closesodoo/odoo#29171
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
closesodoo/odoo#29138
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.
closesodoo/odoo#29167
_tag_delete was not properly converted when the _tag_ calling
convention was modified in 4d581e26c2,
so <delete> tags would all blow up if encountered.
closesodoo/odoo#29149
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
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.
closesodoo/odoo#28519
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.
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.
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: #1895297closesodoo/odoo#27944
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
closesodoo/odoo#28838
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
closesodoo/odoo#30606
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
closesodoo/odoo#30528
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
closesodoo/odoo#30518
- 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
closesodoo/odoo#30232
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
closesodoo/odoo#30585
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`
closesodoo/odoo#29676closesodoo/odoo#30554
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
closesodoo/odoo#30560
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 #17775closesodoo/odoo#30527
Add quantity key to context instead of overwrite the entire context
If another context key was present, it would be lost
Introduced at 166a9d26e3closesodoo/odoo#30519
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
closesodoo/odoo#29084
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
closesodoo/odoo#29094
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: #1884410Closes#28068closesodoo/odoo#29049
Modifying a source term in an XML/HTML translated field can lose translations
if the same term is translated in several languages.
closesodoo/odoo#29078
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
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
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
closesodoo/odoo#28990
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-443148920closesodoo/odoo#29185
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
closesodoo/odoo#29186