Commit Graph
131679 Commits
Author SHA1 Message Date
svs-odoo 4d71fe100d [FIX] product_expiry: expiration date on receipt
How to reproduce:
    - Create a tracked product using expiration dates and don't set the
      `expiration_time` field;
    - Create a receipt for this product (using "Create New Lots/Serial
      Numbers") and confirm it;
    - Create a move line for this product and define an expiration date;
    - Valid the picking -> Traceback.

The issue was as `expiration_time` isn't set on product, the production
lot created on the receipt's validation don't have an `expiration_date`.
So, if the `expiration_date` is set on the receipt move line, the
production lot will try to get a time delta with its unset
`expiration_date`, causing the traceback.

task-2119330

closes odoo/odoo#39795

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-11-05 12:06:37 +00:00
jbm-odoo 2560c332ae [IMP] hr_holidays: Show unusual working days on leave calendar
closes odoo/odoo#35458

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-06 10:49:00 +00:00
jbm-odoo 3fbd67f265 [IMP] web: Add support to display unusual days in green
Purpose
=======

Allow to add an attribute ``show_unusual_days="True"`` to display
some days in green, according to a linked method ``get_unusual_days``
that should be defined on the related model to return all the
concerned days for a given period.
2019-11-06 10:48:52 +00:00
Parth Choksi 6b67174063 [IMP] hr_timesheet: records creation in batches
*: hr_timesheet
   project_timesheet_holidays
   account

Creation of analytic lines will be done in batches instead of creating single
record by iteration. This optimization is done in order to speed up the creation.

task-1971460

closes odoo/odoo#34481

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-06 10:24:25 +00:00
Xavier MorelandPrakash Prajapati ab6d0c3851 [FIX] hr, purchase: update import templates
* the employees file apparently never worked as the marital status was
  updated before template files were added (respectively
  0eb58775c9 and
  b60de0db41)
* the purchase template was never updated to reflect the Big Demo Data Changes
  (58fc4e4409).

Fixes #39074

Employees file update split off of task 2059779.

closes odoo/odoo#39823

X-original-commit: 80a2f6877378a87638c04061ceaf69965c1707c0
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Co-authored-by: Prakash Prajapati <ppr@odoo.com>
2019-11-05 18:37:00 +00:00
fw-botandLucas Lefèvre 205ed1d320 [FIX] hr_fleet: count distinct vehicle_id per driver
closes odoo/odoo#39681

X-original-commit: c98a5041cdad149e14d84e6289a53fd42f617e16
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Lucas Lefèvre <lul@odoo.com>
2019-10-31 18:26:34 +00:00
Victor Feyens 7c4441073d [FIX] website_sale: pricelist item multi company access.
Forgotten in
https://github.com/odoo/odoo/commit/7b3d87b905dff1212f88cc381a125590f5cb0bfe

closes odoo/odoo#39830

X-original-commit: 0dd48299502c5e6f843ae32612c81a71bbfc46c4
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-11-05 22:07:01 +00:00
Victor Feyens ea4f8c2591 [FIX] doc: sphinx warning
Followup of #38948

X-original-commit: 2d61a4d08d007db1d62e2d0bf58701b659621b20
2019-11-05 22:07:00 +00:00
jvm-odoo 55e2138a4e [FIX] account: fix cash bank statement import button
Go on the accounting module, you'll find a kanban view with a few
cards including "Bank" and "Cash". Click on the Cash card.

The default import button doesn't appears because it is hidden.
The reason of this hiding is that the bank statements of type "Bank"
have a custom import method and the users where confuse. They
didn't know which is the right button for the special import so
we hid the default import button for the whole model.

But there is also a "Cash" type bank statement who doesn't have that
special import and his default import button is hidden too.

This commit checks the type of the bank statement and hide the default
import button only if the type is not "Cash".

OPW-2090477

closes odoo/odoo#39829

X-original-commit: ee45228a8532b676729bc2be686814d616e5cbb5
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-11-05 20:41:11 +00:00
Adrian Torres 7affe69117 [FIX] base: avoid triggering recomputation when deleted selection
In 6b048a8b8 most issue with trigger causing error when uninstalling a
module were solved.

But there was a particular case if the current uninstallation of modules
there was an update of `ir.model.fields.selection` to be removed. The
unlink of `ir.model.fields.selection` would cause a `setup_models` call
that would add all removed triggers back and possibly down the line
cause an trigger recomputation error.

With this changeset, we do as is already done for ir.model.fields and do
not re-initialize the registry during module uninstallation.

opw-2098915
closes #39796

closes odoo/odoo#39824

X-original-commit: 0ccf2ab8e7f3edabb2d3d4c17a20829de21cca49
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
2019-11-05 18:43:26 +00:00
Christophe Monniez 7ce07a7a1a [FIX] packaging: compute winpython path with package.py args
When building the MS Windows package, the PYTHON_VERSION variable is not
used and the WinPython path is hard coded in the Makefile and NSI file.
This prevent the usage of a newer version of Python.

With this commit, the PYTHON_VERSION is used to compute the WinPython
Python directory. That way, this directory can be derived from
package.py command line argument --vm-winxp-python-version.

Also the less windows binaries are not packaged anymore.

closes odoo/odoo#39821

X-original-commit: ac90d8584f99e24aed931eb5186c360f9dfbf399
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-11-05 17:29:31 +00:00
Victor Feyens 0a3ca7df7a [FIX] doc: fix sphinx warnings
* Since 
https://github.com/odoo/odoo/commit/8d5da6e4be05428f3243f92c0464d3c1f6a43873#diff-e07cbcffb9fb7b2eafd1ace3c4b1626a, 
post_install and at_install test tags have been removed.

* minor warnings in javascript reference.

closes odoo/odoo#39817

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-11-05 15:17:42 +00:00
Odoo's Mergebot 9e8d52ebaa [MERGE] gamification: track karma changes on users
PURPOSE

Allow karma gain tracking enabling notably display of top users based on
weekly / monthly gain in website profile.

SPECIFICATIONS

Each time a user gains karma a record is created in the gamification karma
tracking model. Scheduled activity runs to consolidate the records into
monthly gain records to avoid having crowdy table and unnecessary noise
in karma gain.

This model is made private and only accessible through some dedicated
compute methods / controllers used in website profile.

In website profile module buttons are added to see users ranking based
on their total karma (like before) but also by last week and last month
gains (using the newly introduced tracking model).

Some fixes are provided in this merge as well as tests.

LINKS

Task ID 2003505
PR #34594

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-05 19:22:38 +01:00
Thibault Delavallée c5b7e00065 [IMP] gamification: merge karma related tests in the same file and improve rank tests
Purpose is to have all karma related tests in the same file to ease finding
them back. Some tweaking is also done like using a savepoint case and ensuring
tests can always be re-run.

LINKS

Task ID 2003505
PR #34594
2019-11-05 15:08:34 +00:00
Thibault Delavallée 60bd39ae38 [FIX] website_profile: ensure top3 users cards have same height
Task ID 2003505
PR #34594
2019-11-05 15:08:34 +00:00
Thibault Delavallée 1d468caf94 [IMP] website_profile: handle both groupby and search in users page
Purpose is to support both search term and karma gain group by in the
URL, using keep_query.

Clean some code and move karma computation to res.users model to avoid
having sql in controllers.

Also fix some display issues.

LINKS

Task ID 2003505
PR #34594
2019-11-05 15:08:34 +00:00
Patrick Hoste bfbc7c6a18 [IMP] gamification: track karma change on users
PURPOSE

Allow karma gain tracking enabling notably display of top users based on
weekly / monthly gain in website profile.

SPECIFCIATIONS

Each time a user gains karma a record is created in the gamification karma
tracking model. Scheduled activity runs to consolidate the records into
monthly gain records to avoid having crowdy table and unnecessary noise
in karma gain.

This model is made private and only accessible through some dedicated
compute methods / controllers used in website profile.

In website profile module buttons are added to see users ranking based
on their total karma (like before) but also by last week and last month
gains (using the newly introduced tracking model).

LINKS

Task ID 2003505
PR #34594
2019-11-05 15:08:34 +00:00
jvm-odoo c27ba2af1c [FIX] project: fix multi level subtask
- Create a project
- Create 3 tasks in the project (top, middle, bottom)
- Set top as the parent of middle
- Set middle as the parent of bottom

We don't want to allow multi level subtasks. The behavior is not the
same if you set middle as the parent of bottom first. The "parent task"
field will not be displayed.

This commit remove the tasks who have a parent from the m2o field.

OPW-2087921

closes odoo/odoo#39810

X-original-commit: c7966b64c42940b606eaf3d985c49549928056bd
Signed-off-by: Jason Van Malder <jasonvanmalder@users.noreply.github.com>
2019-11-05 13:55:26 +00:00
Paul Morelle c78cda8876 [FIX] link_tracker: support any url
URLs with parameters were not correctly supported by the regular
expression.
For example, URLs with parameters were truncated before the '?'.

This patch adds support for a wider range of URLs, and checks in a test
that the parameters are correctly handled.

closes odoo/odoo#39762

X-original-commit: 616e145635eac06a0a44ab3d899f4a9e707b3ba8
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2019-11-04 15:01:50 +00:00
qni baf64e03bc [IMP] sale: reflect down payment changes in the SO
Allow users to modify a down payment invoice's properly by reflecting
the change done to the invoice (e.g. taxes, amount) on the initial
downpayment SO line when the invoice is posted. This support several
nice flows, such a allowing (partial and full) refunds of downpayments
while preserving still a meaningful 'last invoice with deducted down
payments' amount that sums up to the total of the order.

Note that this does not apply to locked orders (by definition of the
term 'locked').

closes odoo/odoo#35982

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-11-05 08:48:46 +00:00
Joseph Caburnay 455ac6b305 [IMP] point_of_sale,pos_mercury: do not save pending payments
It is by default in pos_mercury that pending payments are removed before
syncing the order to the backend. However, this is not the case for the
newly introduced API for payment terminals in pos. In this commit, we
are implementing this pos_mercury feature as default for all terminal
payment methods.

closes odoo/odoo#35579

Task-id: 1984690
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2019-10-31 12:16:29 +00:00
Joseph Caburnay 7d3dfeb473 [IMP] pos_mercury: prevent multiple electronic payments
If there is a Vantiv payment line, adding terminal payment line (e.g.
Adyen) was possible because Vantiv payment line is not recognized as
electronic payment. This commit generalizes the behavior where new
paymentline is prevented if there is a pending electronic payment.

task-id: 1984690
2019-10-31 12:16:28 +00:00
Joseph Caburnay 191dc9e6da [IMP] point_of_sale,pos_mercury: do not count invalid paymentline
With the introduction of pos_adyen, pending payments are not counted in
the total payments. We are now implementing the same behavior for
pos_mercury.

task-id: 1984690
2019-10-31 12:16:28 +00:00
Joseph Caburnay ed69f872fc [REF] point_of_sale,pos_mercury: refactor payment interface
table is currently the html element that is used to display the payment
lines in pos ui. Though it is simple to use table element, customizing it
is not trivial and it requires significant effort specially when we want to
make modifications in with borders.

This commit converts the payment table to be represented by divs of grids.
This gives us more granular control in customizing the payment table.

task-id: 1984690
2019-10-31 12:16:28 +00:00
Joseph Caburnay 7a08fe15a4 [FIX] pos_mercury: selecting vantiv payment during pending payment
When there is a pending payment from a terminal payment method, and we
attempt to add a vantiv payment, an error message is displayed but is
not actually raised in the code. As a result, the code continues with
the effect of highlighting the currently selected payment to be like a
pending vantiv payment. This commit fixes the described issue.

task-id: 1984690
2019-10-31 12:16:28 +00:00
Joseph Caburnay 56aa962414 [IMP] point_of_sale: centralize the due and change in payment interface
The previous behavior is that change is displayed at each payment
line and the remaining is displayed at the bottom. Also, total
amount is lost in the screen.

This commit addresses this issue by showing the values of
remaining amount and change at just one area of the payment
screen.

task-id: 1984690
2019-10-31 12:16:28 +00:00
Julien Castiaux 95d277966a [IMP] doc: clarify dep installation for linux
Someone new to Linux can run into problems when some system dependencies
are missing. There is a single sentence warning talking about those hard
dependencies and it does not explain how to install them.

Added two § containing the missing `apt` commands required to install
the dependencies on a fresh debian minimal install.

closes odoo/odoo#39774

X-original-commit: f7d0022f11d63777eb88bb5f808be3c5ced88fd6
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2019-11-04 17:16:02 +00:00
Cedric Snauwaert 0d6332fdbb [IMP] account: statement automatically set starting and ending balance
To prevent having holes between statements and for better usability using import and synchronization
we try to automatically set the starting and ending balance based on the previous existing
statement.
To do that, we added a new field previous_statement_id so that whenever we change the ending_balance
of the previous statement, we recompute the starting balance and ending balance of the current statement.

Also creating a new statement in between 2 others statements will automatically set the correct value
to the starting and ending balance of that statement and all the statements afterwards.

Exception: creating a statement by hand won't automatically set the balance_end_real, however if you
create one between 2 statements, the balance_end_real of next statements will be recomputed

Was Task #1880409

closes odoo/odoo#38696

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-11-04 08:50:50 +00:00
Xavier Morel badb95fbce [FIX] core: further pycompat cleanup
odoo/odoo#28519 removed large parts of pycompat, but left reraise
despite that not having much value.

Remove that helper and replace it by just a `raise` in most cases:
when raising from an except block, the old exception is automatically
chained to the new one, no need to mess around.

There is one exception: in http we have to re-raise an existing
exception explicitly (aka `raise exc` rather than just `raise).

This is less than ideal as Python *concatenates* stacks: the
previously reified stack (from the except clause) is stacked on top of
the new stack (from this raises), this leads to tracebacks "jumping
around" at the break point of the handler and is somewhat confusing.

So we want to use explicit chaining (`raise a from b`) with the
"source" providing the caught exception's original traceback and the
child providing the rest.

However since callers rely on the exception making sense, we need the
re-raised exception to be the original[0]. Copying the exception
doesn't work (see [0]), chaining an exception to itself doesn't
do anything useful, and while we could probably copy exceptions using
the pickle method[1] that's still risky.

So the most reliable option seems to be to create a new "cause"
exception, move the old traceback over to it, then re-raise the
original exception having cleared its traceback, chained to new the
cause.

[0] or a copy thereof but Odoo exceptions don't all work properly with
    copy.copy and we don't want that to fail so not really an option,
    we can't rely / bet on every new exception being cleanly copy-able
[1] create an "empty" instance using __new__ (or an instance of
    something else onto which we re-set the __class__ in case the exctype
    actually overrides __new__) then copy the __dict__

closes odoo/odoo#39709

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-11-05 08:14:10 +00:00
Lucas Lefèvre 4024f628f4 [IMP] tests: Allow msg with assertRaises
The unittest signature of `assertRaises` allows a named parameter
`msg`[1]. The message is displayed in case of assertion failure if
`assertRaises` is used as a context manager (but not when giving it a
callable).

The Odoo implementation did not implement this behavior, despite it
being expected by multiple odoo tests.

Fix Odoo version to be in line with the method we're overriding /
shadowing.

[1] https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertRaises

closes odoo/odoo#36719

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-11-05 08:25:30 +00:00
jvm-odoo 92ba000411 [FIX] event: fix email sent on duplicates
- Create an event
- Add a mail reminder for it
- Run the mail scheduler manually
- Duplicate the event

The mail reminder is sent on the duplicate too.
This commit remove the field `mail_sent` from duplicating.

OPW-2117343

closes odoo/odoo#39777

X-original-commit: 7fede2c0360f72410ac36f5d706ac5c7c18b7c7d
Signed-off-by: Jason Van Malder <jasonvanmalder@users.noreply.github.com>
2019-11-04 17:48:08 +00:00
Damien Bouvy 8c59f5d345 [FIX] sale(_timesheet): faulty computation
The 'delivered quantity' field sometime needs to trigger a search
on related objects (e.g. analytic lines) to know how much has been
delivered.

For performance reasons, this search is done using a read_group where
the results are grouped by SO line.

Unfortunately, this computation is sometimes launched during
recomputes/onchanges where the line in question has a NewId instead
of a regular id.

This means that the mapping will return something like
{240: 50.0}
indicating that (e.g.) there are 50 timesheet hours for the SO line
with id 240; unfortunately by doing
mapping.get(line.id, 0.0)
the NewId (240) is used - therefore returning a delivered quantity
of 0.0 for a line which has actual timesheets.

This commit ensures that if the line has a NewId and an original
underlying record, the id of the latter is used as the key to fetch
the value from the dict that contains the read_group result.

Note that the problem was quite tricky to reproduce as it depended
on the order of operations launched by triggers - the order of
operations was important since triggering the compute with the 'real'
record put things in order before any other piece of code could have
spotted the issue.

closes odoo/odoo#39781

X-original-commit: cf54606edb9130f2c5b351150f0e37b75f10ae66
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-11-04 20:53:34 +00:00
Adrian Torres 13ee8a0373 [FIX] stock: allow unlinking records in uninstall mode
Business cases should not prevent the unlink of module-related records
during an uninstall.

This commit allows the reinstallation of sale_stock with demo data and
also allows the proper removal of tables and records if a db has any
non-draft inventory adjustments.

closes odoo/odoo#39776

X-original-commit: cedafe00941b869d284cd511633d7da15868fc0a
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
2019-11-04 17:16:38 +00:00
qsm-odoo 02e0a31665 [FIX] web_editor: put the snippet editor UI at the correct DOM position
Commit https://github.com/odoo/odoo/commit/4f27e52cabb77b8b1a9637a11185ddf882adc9af
had to instantiate the snippet editor UI differently but the hack broke
the position of the oe_manipulator which is supposed to be at the top
left of the editable zone.

closes odoo/odoo#39775

X-original-commit: 86d12706729c256a8ea1103575db9817961a2ff2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-11-04 17:16:21 +00:00
qsm-odoo f79c37e285 [FIX] web_editor: do not reposition overlay over an hidden element
Could be the cause of flickering during multiple recomputation of the
overlay position.

X-original-commit: b8d7c69dbaaf575f7b5945bad69143adb88f81d4
2019-11-04 17:16:21 +00:00
Nicolas Lempereur 3f4f570566 [FIX] website_sale: send extra step as public user
The extra informations not on the sale.order models were sent before
13.0 with the superuser user. In 13.0 with the change of `sudo` and
`with_user` behavior, we were now in superuser mode but not with the
superuser so the mail would error (no from address) and the sale order
would error.

With this changeset, we get back to the pre-13 behavior.

opw-2116346
closes #39730

closes odoo/odoo#39748

X-original-commit: 7b1654a10f5a005677492ec71e6fa1e54df09ae2
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-11-04 13:39:25 +00:00
Nicolas Lempereur b12bcfbb1b [FIX] sale: have sender in SO confirmation email
Before 13.0 .sudo() before sending a mail would send it as superuser user
(which was the intention in this case), but since 13.0 for the same
intention we need .with_user(SUPERUSER_ID).

Without this change, the confirmation email on a sale order would have
no sender ending up in failure.

opw-2118612
closes #39737

closes odoo/odoo#39752

X-original-commit: 6aebb5231c3ed0b87cdddcd9cb463952e346ec07
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-11-04 14:18:16 +00:00
Aaron Bohy c4a339e839 [FIX] web,sale_product_matrix: allow to open matrix
Before this rev, it crashed when opening the (sale or purchase)
product matrix (e.g. on runbot, go to quotations, create, add a
line, select 'My Company tshirt').

This was due to a recent override of _applyChanges (see 4bf98b47),
which didn't return the value returned by super.

OPW 2116083

closes odoo/odoo#39747

X-original-commit: 49626acbacb87a6f5d37bea22d0b51a506121914
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-11-04 13:39:07 +00:00
Shreya Modi 945a94a152 [FIX] sale: show down payment at the end of sale order
Purpose of the commit is if sales order is very long, the down payment
gets lost in the middle of it and will be best to make it appear
systematically at the end of it.

currently the sales order line is order by the sequence and while
creating the down payment it takes the default sequence of the line
so adding sequence by +1 will show the down payment at the end.

task-2025709

closes odoo/odoo#34404

Closes: #34404
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-11-04 13:22:15 +00:00
jvm-odoo 65edd6c55e [FIX] base: fix merge partner wizard
In the contacts app, you can select 2 partners and merge them.

Before this commit:

    - If a partner was added by a SQL query and not directly on Odoo,
      the create_date will be empty. This causes a crash because the
      merge wizard try to sort the partners by date

After this commit:

    - If a partner do not have a create_date, it will be considered
      as 01/01/1970. The merge wizard will sort the partners by IDs too.

OPW-2091925

closes odoo/odoo#39523

X-original-commit: deeb769c0d579c51ab42b072ccc1c013d79fcea4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-11-04 12:28:53 +00:00
Joseph Caburnay fb85375388 [FIX] point_of_sale: uninvoiced orders' state not set to 'done'
Prior to this commit: b234e97f87,
uninvoiced orders' state is set to 'done' when the session is validated.
However, this was not taken into consideration in the said commit such
that even if the session is already validated, the uninvoiced orders'
state remains 'paid'.

Setting the orders state to 'done' is the correct behavior and is
implemented in this commit.

closes odoo/odoo#39735

X-original-commit: bb490301c22c84c86d2b1c2d27ecb96a4ff19ac5
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2019-11-04 12:07:13 +00:00
Xavier Morel 79313d8817 [FIX] core: SIGXCPU in worker processes
odoo/odoo#30688 (6ce2d6efb5) added an
indirection in prefork workers: Python-level signal handlers are
delayed until native calls have ended (e.g. accept() or
execute()). Running the actual work in a sub-thread allowed the main
thread to handle signals in all cases.

However there is apparently an issue with SIGXCPU on linux (possibly
other cases as well): SIGXCPU is delivered to the child thread (if
possible?) and Thread.join apparently stops it from redelivered to
the main thread (Thread.join is signal-interruptible since 3.2 but
possibly not Python-interruptible).

Blocking SIGXCPU on the child thread causes the OS to deliver on the
main thread and fixes the issue.

Also split set_limits so it sets the signal handler in the parent
thread but properly updates the soft limit in the child after each
request, as the goal is to put a hard limit on the CPU time per
request, not on the worker. 6ce2d6ef would set the limit once then
never update it, likely cycling workers more than desired.

While at it:

* block other signals with a handler set, they seem to work
  regardless on linux but other OS may have a different way of
  dispatching process-directed signals
* unset signals which are set by the prefork server but whose
  set behavior makes no sense in workers:

  - TERM and CHLD were already unset
  - HUP is used to restart the server, workers can just be killed
  - TTIN and TTOU configure the number of workers

closes odoo/odoo#39731

X-original-commit: 549bd199bad269e4e28efac933efac3f41495877
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-11-04 11:35:59 +00:00
Lucas Perais (lpe) 92c40caccd [FIX] account: exchange rate difference when payment in domestic
Make an invoice in Foreign
Make a refund in Foreign
reconcile the two, partially

Make a payment in domestic, partial also, but with writeoff

Before this commit,

The invoice was not fully reconciled and -0.02 was yet to pay on it
Notice the negativity of that number, which actually means that it HAS been
fully reconciled !!!! (there is too much payment compared to invoiced)

This was because, the account.payment in domestic currency is doing:
Invoice residual in foreign, converted to domestic

Then that amount minus payment's amount gives write off amount in domestic

Then, at reconciliation, the whole payment's amount, which is
the payment + the writeoff contained the expected and mathematically
correct conversion and currency rounding errors
(which should make out the exchange difference)

The exchange difference IS created, and rightfully too
that is, it records the exchange difference as debit 0.01 in the receivable !

What was tricky though, is that the partial line recorded the debit 0.01 receivable
as its CREDIT move line !

After this commit, the receivable line is recorded as the DEBIT move line of
the partial between the payment and the invoice
so the invoice, is fully paid.

We keenly admit this is hackish, but justified:
- business-wise: the rounding/exchange errors are appearing ex-post
to the choice of the amount of the reconciliation between the payment
and the invoice, because we are reconciling them on the domestic amount

- technically: our hands are tied because some key information is not present
every time, and weirdly, not symmetrically. That is, the computation of
line.amount_residual[currency] may be different if your are on a line with a currency,
or on a line that doesn't.
We should really think of systematically putting the currency on the line
whichever it is ! The same goes for partial reconciliation model !
Touching the current behavior is out of the question.

Moreover, we should take into account that comparing amounts at different
points in time should be done by actualizing those amounts to a common date
See #39117 for details

OPW 2057845

X-original-commit: 40db7a8

Note that the tests did not change in spirit, but the writing
of the exchange difference may vary from happened in v11.0
Indeed a quite big refactoring has been done in between
The tests reflect this

closes odoo/odoo#39727

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-11-04 11:41:49 +00:00
Arnold Moyaux 7e81616ae8 [FIX] stock: product quantity with force company and location
Usecase to reproduce:
- Set warehouse as 3 steps delivery
- On pack rule set the procure method as 'take from stock if enough or
trigger another rule'
- Do an inventory adjustement of a product and set 10 units in pack zone
- Do a delivery order for this product with only 1 unit.

It will create the delivery order from stock to pack even if the
quantity in pack was sufficient.

It's due to [1] that introduce a new function but if the force company
and location (with an integer) are both set in the domain it will
select the wrong ids. It will take all the location in the company + the
location in the context. However if a location is explicitly given to
the context, it should only consider the stock at this location.

[1] commit 330b99f60c

opw-2090384

closes odoo/odoo#39726

X-original-commit: e77d9fc735d845bbb0b5562c359fbf2354d72f0e
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2019-11-04 11:16:31 +00:00
Nikunj Ladava 9019645a5d [FIX] payment_stipe: fix empty card error
before this commit, when try to make payment with
empty card details, it will raise error dialog.

after this commit, error will be append to acquirer
form

task - 2089999

closes odoo/odoo#39729

X-original-commit: 01b143b971a85d6da673df6c536917ad4754b83a
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-11-04 11:17:13 +00:00
Victor Feyens ae4855fa1e [IMP] base, doc: orm page refactoring.
closes odoo/odoo#39725

X-original-commit: 7ce7c58592c7c7202a37c73767c477be5a835752
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-11-04 11:16:12 +00:00
Goffin Simon b2f3f092b7 [FIX] hr_holidays: Impossible to allocate future leaves
Steps to reproduce the bug:
- Let's consider Today = 31/10/2019
- Create a new hr.leave.type LT and set a validity from 01/01/2020 to 31/12/2020
- Set mode = Free Allocation Request and Validation = No Validation
- Try to create leave allocations for LT

Bug:

It was impossible to create a leave allocation for LT because Today < 01/01/2020
So it was impossible to allocate future leave.
We had to wait the 01/01/2020 to make the allocation of LT leaves

So now, when no default_date_from is in the context, no domain is applied

opw:2092830

closes odoo/odoo#39715

X-original-commit: 6bc9e6920c23262e13398b1b88ea7cfd3b4f1e7d
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-11-04 09:55:05 +00:00
Julien Castiaux a68be6863b [FIX] website_slides: HttpCase should be post_install
Since odoo/odoo@8d5da6e4be HttpCase should not be started at install.

closes odoo/odoo#39719

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-11-04 10:01:43 +00:00
Goffin Simon 8f04405dfa [FIX] mrp: Updating cost from Bom Structure & Cost
Steps to reproduce the bug:

- Let's consider two storable products P1 and P2
- Update the cost of P2 to 10€
- Create a BOM for P1 with P2 as component
- Click on Bom Structure & Cost
- Click on P2
- Try to update the cost

Bug:

A traceback was raised saying that "Record does not exist or has been deleted" or the cost of an other
product was displayed because the active_id was still the id of the bom.

opw:2093199

closes odoo/odoo#39710

X-original-commit: e984d8f94534373fde894e9e6ad0c932585deb46
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-11-04 08:56:05 +00:00
fw-bot 5e6e2184f5 [FIX] core: is_false has lots of false negatives over RPC
`is_false` relies on no small part on equality tests between the input
triplets and either `TRUE_LEAF` or `FALSE_LEAF`. While these are
defined as tuples, RPC domains will always be lists (as neither
XML-RPC nor JSON have tuples, and their arrays deserialize to Python
lists).

This is an issue, because tuple and list never compare equal. As a
result, while the in / not in predicates can succeed, the TRUE_LEAF /
FALSE_LEAF never will, and thus domains which contain either and might
shortcut (avoid a query entirely) will always go through the entire
process.

Fix by having domain normalization also ensure all triplets are
tuples: that's the first thing `is_false` does, it should never cause
issues and could fix / improve / shortcut other routines.

Note: Also implements TRUE_LEAF and FALSE_LEAF handling in the
      SSF's modifiers evaluator. And fixes the ValueError to work
      correctly if it breaks on a tuple / dict.

closes odoo/odoo#39706

X-original-commit: a44f008b918ee66742f7e943b00e4ee3d7fe2b78
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-11-04 08:16:40 +00:00