Commit Graph
142468 Commits
Author SHA1 Message Date
oco-odoo 995f6fbb86 [FIX] account: reconciliation models: fix priorities when matching amls from payments
Since the payment refactoring, the structured reference of a payment is stored in its ref field, not payment_reference like for invoices. This caused payments never to be matched with highest priorities, as payment_reference_flag was always false, and only communication_flag could match.

To reproduce:

- Have a reconcile model with match_total_amount=False.
- Create a statement line with communication a1b2c3 for 1000
- Create 3 payments:
> 500, with memo a1b2c3
> 500, with memo a1b2c3 (so, the same one)
> 500, with memo d1e2f3
- Open the reconciliation widget for your statement line

===> The 3 payments are matched, while only the two first ones should have been, as they were exact matches for the communication, and should hence have received higher priority.

closes odoo/odoo#70394

X-original-commit: b5800c9d2088df2bb9c4fbe0fed91c7ef24299c5
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-05-06 15:17:32 +00:00
oco-odoo 255c63ff26 [FIX] account: cash basis taxes: generate correct exchange difference when using the same cash basis taxes on multiple lines
To reproduce the bug:
1) Create a cash basis tax for 42%
2) Make an invoice with two lines at 100$, each using this tax
3) Post and register full payment of the invoice

==> An exchange difference has been generated, doing +100 -100. One of its two line has tax_ids set, while the other does not. This makes the base amount shown in the generic tax report wrong: 100 instead of 200.

Actually, this exchange difference entry shouldn't have existed in the first place, as there is no rounding issue to compensate for here. It happens because the grouping keys computed for the two base lines are the same, and the second line overwrites the totals of the first one instead of adding them to its own.

closes odoo/odoo#70283

X-original-commit: 60770f0b99bedd3dcb695e2191dc83c45ef0b594
Related: odoo/enterprise#18107
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-05-06 15:10:28 +00:00
Swapnesh Shah 15e66f98f5 [FIX] stock: disable links on forecasted inventory report
Disable the link on the forecasted inventory report  graph view, as it leads us to a undesired list view with traceback on opening it.

closes odoo/odoo#70488

X-original-commit: 64afb484b9785a4d739fef1207405a502d668ab8
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-05-06 14:27:55 +00:00
Swapnesh Shah ac5590c7db [FIX] mrp: compute duration when needed
Before this commit there would be trackback (TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'NoneType') when you will try to remove field Start date as we are using the field to compute duration.

With this commit, we compute duration when Both fields are present.

closes odoo/odoo#70482

X-original-commit: f29597fce37350f1c05d98341b959809bbb160b2
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-05-06 12:58:03 +00:00
Laurent Stukkens (LTU) 7ec13efc67 [FIX] sale_timesheet: prevent multicompany issue on SOL
Steps to reproduce:

        - Create an SO for a prepaid service in company A and confirm it
        - Create a project and a task in company B and select the customer linked to the SO you previously created
        - Unselect company A from the multi-company widget; only display the records from company B
        - Timesheet on the task you previously created

Observed behavior:

        - The SOL set by default belongs to company A, thus generating an access right error when trying to timesheet on the task

Expected behavior:

        - The SOL set by default should belong to the same company as the task

task-2515259

closes odoo/odoo#70451

X-original-commit: af3c0e1b273d83323a9428f5b369387993ae225f
Related: odoo/enterprise#18160
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-05-06 09:58:17 +00:00
Adrien Widart 2e95fda97d [IMP] stock_account: add hook for eligible for COGS
Let people be able to customize how to filter the condition

closes odoo/odoo#70418

Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
2021-05-06 13:22:18 +00:00
Swapnesh Shah f7e0787ae4 [FIX] mrp: set default product on unbuild order
Before this commit, Creating Unbuild order using
 Unbuild Button was resetting Bom as it was calling
`_onchange_product_id` after setting `mo_id` which was
resetting Bom on Unbuild order.

To Fix Issue, We setting `default_product_id` so It would not
reset `bom_id` when `_onchange_product_id` is called.

Fixes: #70216
Odoo Ticket: 2521788

closes odoo/odoo#70304

X-original-commit: 4de0ae434d1adc97fc1077b8d0f23c7e800ec161
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-05-04 09:23:17 +00:00
Rémy Voet (ryv) 37136f7149 [FIX] mrp: fix demo data for operation
Since df312153d4,
the `worksheet_type` default become 'text' instead of PDF. Then,
update the demo operation to show pdf instead of empty text.

task-2523601

closes odoo/odoo#70463

X-original-commit: 722fba2313bae3f2825492a3822111bbb25332b7
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-05-06 10:34:11 +00:00
nounoubensebia fa0738dd7e [FIX] mail: display default name for followers for "other address" partner
Display the default name (the one displayed in the kanban view) for followers replacing
the False value for "other address" partners, this way the user won't get
confused, furthermore, this fix won't require the name to be mandatory for this
type of contacts.

Task-2514244

closes odoo/odoo#70445

X-original-commit: 338b84bd9d2d675af30ab19c6bb262d2f68546b9
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-06 08:00:36 +00:00
William Henrotin dfb8c1b9e7 [FIX] mrp: print bom structure per variants
Commit 044c5c2c81 removed the context key
`variant` of the bom structure report. This implies to always print
every variant in case a BoM has no product_id.
This commit fix this issue to print only the variant selected in the
report. It also adds a new button to print the report with all variants
in case for some customers this behavior was "not a bug but a feature".

Task : 2504524

closes odoo/odoo#70444

X-original-commit: 8da349e785b5b461ea19874df9686f8cd26af8ad
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-05-06 07:57:05 +00:00
Romain Derie 77b00d94d2 [FIX] website: don't show advanced tree hierarchy if not debug
The page manager shows an advanced structure if the user has multi website
enabled. It will show specific pages as a child of its generic one.
It is useful to directly understand and figure which pages are 'overiden'.

But it doesn't really makes sense for an end user, which doesn't know there is
actually generic and/or specific pages.

It makes more sense to show that behavior only in debug and not in multi
websites, even more since pages are overiden even in mono website.

closes odoo/odoo#68902

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-05-05 11:56:13 +00:00
Swapnesh Shah f84d090643 [IMP] stock: limit visibility of location fields
Before this commit, Fields `location_id` and `location_dest_id` were visible on the List while they are already restricted for `stock.group_stock_multi_locations` group on other views.

In this commit, We add a group on these fields on the list view as well.

closes odoo/odoo#48467

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-03-26 18:07:39 +00:00
Benjamin Frantzen (bfr) 5c3707832c [FIX] account_edi_facturx: fix filename in pdf embedding
When embedding to pdf, the name of the attached file should be 'factur-x.xml' (official specifications, section 6.2)

closes odoo/odoo#70442

X-original-commit: 04f4633d15f0a0824bd07f56a0f99491584f1a12
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
2021-05-06 07:03:48 +00:00
Ivan Yelizariev 03a11f5cf7 [FIX] mail: allow duplicate records with alias for non-admin
ALIAS_WRITEABLE_FIELDS is used to write alias fields with sudo

Steps to reproduce:

1. Create a user
1.1. Give rights Services -> Project-> Administartor
1.2. Not given rights Administration-> administartor
2. Project app -> open any project -> Action -> duplicate -> it give validation error.

---

opw-2506566

closes odoo/odoo#70414

X-original-commit: 7ae1b4622c6743e28deca12476d6e70375c9417e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-05-05 13:49:06 +00:00
Goffin Simon 3e9f516b8a [FIX] stock: Running scheduler doesn't update
When running the scheduler, the informations in the inventory dashbord were not updated.

opw:2486591

closes odoo/odoo#68604

X-original-commit: 0d15ee3c9c5ebf98d604c331b8c97d01ced58f49
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-03-31 14:05:26 +00:00
Luis González fcfc83b66c [FIX] web: Aria attributes on buttons Export All & optional columns
Some aria attributes were missing or incorrectly set on these new
buttons:
- The button "Export All" was missing an `aria-label` attribute
- The button to show/hide optional columns was also missing an
  `aria-label` attribute, and its menu items (checkboxes to show/hide
  columns) were missing a proper role
- Ever since the debug manager was added in frontend on 73327db065,
  the `aria-label` attribute was not being rendered correctly on the
  button to open developer tools

closes odoo/odoo#70433

X-original-commit: ac3e0fcd32d66d6e0bacfabd2d224805d92dbfd1
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-05-05 16:37:04 +00:00
Joseph Caburnay fdc3b42554 [FIX] point_of_sale: restore feature that closes open pos from other tabs
After the pos owl refactoring, the feature that closes pos from other
browser tabs was removed. Having multiple open pos for the same session
in the same browser session may cause issues when syncing orders because
the tabs share the same localStorage, and the localStorage is the source
of data when syncing orders to the backend.

closes odoo/odoo#70427

X-original-commit: 51b2c7fad08354499503c5c444dd1a3ae1f26fc1
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-05-05 15:47:16 +00:00
nouraellm 43d539dc5a [FIX] stock, mrp: Fix precision overflow in forecasted report
- Fix tends to prevent precision overflow in forecasted report

Current behavior before PR:
- If there are 2 units in stock and product_uom_qty is set to 0.66 the free_stock will be equal to 1.3399999999999999

Desired behavior after PR is merged:
- If there are 2 units in stock and product_uom_qty is set to 0.66 the free_stock should be equal to 1.34

opw-2425473
opw-2459650
opw-2448443
opw-2446985
opw-2440853
opw-2464507

closes odoo/odoo#70321

X-original-commit: c69fb8ec6828676a1900c56f1e87df809b6b70c2
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-05-05 15:14:38 +00:00
Nicolas Seinlet 9a01a2953f [IMP] mail, im_livechat: inline sql instead of long id list
using inselect operator to inline sql in the search method and avoid ORM
to fetch multiple useless messages to check if there's one

closes odoo/odoo#70410

X-original-commit: 505c7b0946689d3ac1ac4dd2f59cf4d535c36cbb
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-05 12:40:29 +00:00
Adrien Widart c4f9d83c25 [FIX] account: prevent creation of JE on analytic line creation
When the user creates a new account analytic line, he should not be able
to create a new journal item.

To reproduce the error:
(Use demo data)
1. In Settings, enable "Analytic Accounting"
2. Accounting > Configuration > Analytic Accounts > Administrative >
Cost/Revenue
3. Create a new one
4. Click on "Journal Item" list

Error: the list contains the "Create and Edit..." option. Such an action
should not be possible.

OPW-2481197

closes #69881

closes odoo/odoo#70399

X-original-commit: f3ef533ed18c996f7f87c9596135e450479a8c19
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-05 11:11:38 +00:00
Romain Derie 2c8c079c05 [FIX] http_routing, website: prevent crash when using fw in url
Before this commit, the routing map generated and used would be the one from
the website the request is performed, instead of the one from the `fw` website
ID which will be the one we redirect the user to.

This issue was introduced with the routing map by website, be8fc2296b and is
restricted to a single case: a publisher using the website switcher, and it
won't happen on next page naviguation/refresh as the `fw` website id will be
the same as the current website's ID. Thus there won't be any routing map
mismatch.

Step to reproduce:
  - Create a page on website 2, set it as homepage
  - Naviguate to website 1 on '/' url
  - Naviguate to website 2 on '/' url
This will raise a werkzeug error about `EndPoint not iterable`.

----- Technical analysis ------

This is the current flow:
1. `_dispatch()` is setting `website_routing` to `get_current_website()` -> 2
2. `_dispatch()` is calling `_match()`
3. `_match()` is calling `routing_map()` with key = `website_routing`, which
   was set to 2 in step 1.
4. `routing_map()` is calling `_generate_routing_rules()` which generate the
   rules based on `website_routing`, which was set to 2 in step 1.
5. `_dispatch()` authenticate the user by calling `_authenticate()`
6. `_dispatch()` is calling `_add_dispatch_parameter()`, where URL param `fw`
   is forced in session, so `get_current_website()` now return the correct
   `website_id` -> 1

The issue: in order to handle the `fw` URL parameter (step 6.), we need to
check the rights to ensure we can allow the website switch.
To check rights, user need to be authenticated (step 5.), which is done after
generating the routing map (2. & 3. & 4.).
The routing map is generated based on the current website (step 1.)

Step 6 depends of steps 5 which depends of steps 2/3/4 which depend of step 1,
but step 1 should depend of step 6, which is an impossible cycle.

closes odoo/odoo#70397

X-original-commit: 4eb26497a774e934d7e1a6be9f505400fd9e2cdb
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-05-05 11:01:15 +00:00
Urvi Soni c3c8ee09cb [FIX] project: open the task form on clicking of task title from kanban
Currently, in the kanban view of the tasks when you click on title of
the task, it will not open the task in the form view.

so in this commit, Removed click event handlers on this widget for
kanban view to ensure that the kanban 'global click' opens the clicked
record, even if the click is done on a title of task.

closes odoo/odoo#70387

Taskid: 2510169
X-original-commit: d64b19d42ae70fa5a33a93e92cde8854ed2e0ab9
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-05-05 09:46:17 +00:00
Philémon van Helden 542618db8e [FIX] website_slides: correctly shows 0 XP on completed unpublished quiz
In 13.0 and above, when looking at a quiz that was completed while not published, it would incorrectly show 2 XP awarded, when 0 XP should be awarded.
With this commit, we show instead the correct 0 XP awarded.
opw-2480343

closes odoo/odoo#70349

X-original-commit: 26f047633b919bd8f2a260305bfd80e15bf259b6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-05-04 15:41:09 +00:00
Andrea Grazioso (agr-odoo) 61581c51d4 [FIX] *: avoid cutting 0.0 value in first row
Have in a purchase order a first row with unit price 0
Export the PO adding unit price in the list of fields to export
The unit price is not reported

This occur because the first line of the order lines is meld with the
purchase order line but in the process the 0.0 values is discarded

opw-2510917

closes odoo/odoo#70368

X-original-commit: 242bf5024ce6ae9c32176cd1a65a4f57a242dd45
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-05-04 18:55:42 +00:00
Goffin Simon de75260ba6 [FIX] hr_holidays: Leaves for partial time are wrongly counted
Steps to reproduce the bug:

- Let's consider an employee E that doesn't work on Monday morning
- Create a half day leave request LR for E on a Monday afternoon
- Save

Bug:

The duration of LR was counted as one day instead of 0.5

opw:2491784

closes odoo/odoo#70366

X-original-commit: b088abb95d9dac0a66c429f258a5e4f4e3a58501
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-05-04 20:44:52 +00:00
Jorge Pinna PuissantandSamuel Degueldre 9a76719893 [FIX] *: undeclared variables and restricted globals
closes odoo/odoo#69988

Related: odoo/enterprise#17991
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:49 +00:00
Jorge Pinna PuissantandSamuel Degueldre a8082fee7f [FIX] web, project: use the ES6 import
Remove the CommonJS require from the odoo-modules files and replace it
with the new ES6 imports.

Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:49 +00:00
Jorge Pinna PuissantandSamuel Degueldre f43a0814ae [IMP]*: configuration of ESLint for specific files
This commit will add the needed ESLint configurations on the JS files.
These configurations are added if the JS file uses a different
environment (serviceworker, node, etc) or if it uses a specific global
(google, ace, etc).

Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:49 +00:00
Jorge Pinna PuissantandSamuel Degueldre 7c032cb969 [IMP] test_lint: Add ESLint to the test suite
This commit allows using ESLint on the code JS to disallow undeclared
variables (no-undef) and disallow specific global variables
(no-restricted-globals) (error, event and self).

Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:45 +00:00
Achraf (abz) b7d9c445c0 [FIX] 10n_ca: Add PST to company
Add l10n_ca_pst field to company

opw-2499263

closes odoo/odoo#69613

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-04-28 11:11:29 +00:00
Raphael Collet a8cbe36948 [FIX] core: make registry.field_depends more robust
When a registry is loading, if a custom field cannot be set up, it will
be removed from the dependencies of the field 'display_name', which do
not exist yet on the registry.  This patch makes sure that the dict
registry.field_depends always exists, even as an empty dict.

closes odoo/odoo#70373

Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
2021-05-04 16:53:26 +00:00
Adrien Widart 9646c375d1 [FIX] repair: filter taxes with current company
When adding a product to a repair order, the module automatically adds
all product's taxes, even if some taxes belong to other companies.

To reproduce the error
(Need 2 companies C01 and C02. Let C01 be the current company)
1. Create a product P
    - Must have a tax T_C01
2. Switch to C02
3. Edit P
    - Add a tax T_C02
4. Activate C01
5. Create a Repair Order
    - Add a customer
    - Add a line with product P

Error: Both T_C01 and T_C02 are added. However, since C02 is the current
company, T_C01 should not be added.

(Similar issue possible with `repair.fee`)

OPW-2486791
closes #68079

closes odoo/odoo#70352

X-original-commit: 75a122bbae3a32bfa79da3506179fc63a8bced5d
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-04 16:02:05 +00:00
Victor FeyensandAntoine Vandevenne 0cefdf9d87 [REM] core: remove test_documentation_examples module
The only purpose of the module `test_documentation_examples` is to test
a few of the code examples shown in the developer documentation.

As d4ba3117524 removes the documentation sources from the repository,
the test module is removed as well.

DOC PR: https://github.com/odoo/documentation-user/pull/945

task-2352371

closes odoo/odoo#70256

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Co-authored-by: Victor Feyens <vfe@odoo.com>
Co-authored-by: Antoine Vandevenne <anv@odoo.com>
2021-05-04 08:25:33 +00:00
Victor FeyensandAntoine Vandevenne 609082da2f [MOV] doc: move documentation to a dedicated repository
In odoo/documentation-user#945, the developer documentation is merged
with the user documentation in a single repository and build config.

This commit then removes source files for the developer documentation
from the odoo/odoo repository.

DOC PR: https://github.com/odoo/documentation-user/pull/945

task-2351938
task-2352371
task-2205684
task-2352544

Co-authored-by: Victor Feyens <vfe@odoo.com>
Co-authored-by: Antoine Vandevenne <anv@odoo.com>
2021-05-04 08:25:12 +00:00
Achraf (abz) 40204d6575 [FIX] mail: Allow to navigate quickly among the different attachments
What are the steps to reproduce your issue ?

    1. Create a record and add two attachments
    2. Navigate quickly between these attachments

What is currently happening ?

    Traceback
    TypeError: Cannot read property 'complete' of undefined
        at AttachmentViewer._handleImageLoad (https://www.odoo.com/mail/static/src/components/attachment_viewer/attachment_viewer.js:163:20)

opw-2521901

closes odoo/odoo#70334

X-original-commit: 2b3ad9bfa9459b8e39d769afa8fa61ceef925c75
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-05-04 13:28:14 +00:00
Adrien Widart 0d32ed45ae [FIX] survey: allow to modify a completed survey
Updating a completed survey will raise an error with a traceback.

To reproduce the error:
(Use demo data)
1. Survey > Participations
2. Select a completed form
3. Change one answer, Save

Error: A traceback appears "[...] ValueError: Computing score requires a
question in arguments."

Here is an extract from the method concerned:
```python
@api.model
def _get_answer_score_values(self, vals, compute_speed_score=True):
    """
        [...]
    """
    user_input_id = vals.get('user_input_id')
    answer_type = vals.get('answer_type')
    question_id = vals.get('question_id')
    if not question_id:
        raise ValueError(_('Computing score requires a question in
arguments.'))
```
This method needs some information to work properly.

OPW-2488974

closes odoo/odoo#70328

X-original-commit: 62cd2c0be63738f0bbefd62de5d025990e63824f
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-04 12:26:35 +00:00
Philémon van HeldenandNicolas Lempereur 1d3c886b95 [FIX] web: no error on single active_ids state load
In eg. 13.0 when refreshing sales analysis action of a product, we would
get an error because we have a single active_ids which is not expected
by the code.

With this commit, we use .toString() on the jQuery BBQ parsed active_ids
as it was done before 32b8cec5 refactoring (january 2018).

The added test with the fix fails with an error:

  TypeError: state.active_ids.split is not a function
  at Class.loadState (/web/static/src/js/chrome/action_manager_act_window.js)

opw-2471982

closes odoo/odoo#70285

X-original-commit: bf9a985f4b62cc6f1eef4f9fcca2a8dfbd453004
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: pvh-odoo <SwagSamaSempai@users.noreply.github.com>
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
2021-05-03 18:01:10 +00:00
Laurent Smet b80e214780 [FIX] account: Fix price_unit rounding issue with fpos/price included tax
- Create an invoice with an empty fiscal position
- Create a line with a product having 100.0 as sale price and 21.0% price-included tax
=> price_unit equals 99.99

This is because 100 / 1.21 ~= 82.64 but 82.64 * 1.21 ~= 99.99 != 100.0.
The bug only appears when managing a fiscal position because the code is trying to adapt the product price_unit to the newly computed taxes.

closes odoo/odoo#70276

X-original-commit: 3470a3c94e06d92afcd8a8129f80e4dfea14efe4
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-05-04 08:19:17 +00:00
svs-odoo a419272f52 [FIX] stock: don't auto remove 0 quant with user
Before this commit, when quants where automatically unlinked, all empty
quants were took.
Now, quants with a defined `user_id` will not be unlinked because they
can legitimately be to 0 and we should wait inventory was processed
before empty quants were unlinked (as once the inventory is processed,
the `user_id` on quant is removed).

closes odoo/odoo#70275

X-original-commit: 7c5143e95ef1fcceafe5e331c3e8649e08666ae7
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
2021-05-03 15:39:15 +00:00
wan efc407cacd [FIX] account: same sequence in different journal clash
When the same sequence is used in different journals (i.e. BNK1 in two
different companies), a clash might happen in the grouping optimization
of the `_compute_name`

closes odoo/odoo#70152

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-05-04 07:45:03 +00:00
wan 5b5e6943eb [REF] account: move sequence tests in a separate file
There are quite some tests related to the `sequence.mixin`.
Add some dosctring too.
2021-05-04 07:45:03 +00:00
yhu-odoo 6414a4847e [FIX] stock_account: wrong account when changing cost method
Previously when changing cost method, we always add debit to Expense
account when empty svl. This results in an unneutral change for process
that should be neutral. In this commit, we change to use stock input
account to make it neutral.

Task 2481563

closes odoo/odoo#68083

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
2021-03-18 08:21:50 +00:00
Antoine Vandevenne (anv) 395b0d2e89 [FIX] payment_ogone: swap SHA-IN key with SHA-OUT in signature check
The key that should be used to check the signature of incoming (Ogone to
Odoo) communication should be `ogone_shakey_out`. For an outgoing
communication, the signature should be generated with `ogone_shakey_in`.

This commit swaps the IN key with the OUT key in signature calculations
to use the appropriate key for a given communication.

The opportunity is also taken to go back to using SHA1 for signature
computation rather than SHA256 that was introduced with 61a02a73 in
order to ease the migration of existing users. Keeping SHA256 would have
required users to make the switch on Ogone's backend.

task-2494916

closes odoo/odoo#70280

X-original-commit: 91782fa29ce597d3985221b76a0d16993facb53e
Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
2021-05-03 16:33:30 +00:00
Sébastien Theys 446e20742c [IMP] mail: add update command and use it on thread viewer
Instead of thread viewer having many dependencies, this allows models "having
the thread viewer feature" to keep their own logic for themselves.

The "create or update" part has to be done manually in this case (as opposed to
using "insert") because thread viewer has no clear identifying data, since it
would depend on which model is using it in the first place.

closes odoo/odoo#70251

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-05-03 15:11:07 +00:00
Adrien Widart 6c530f80d5 [FIX] purchase_stock: consider product unit price precision
When changing the product price precision, this can lead to incorrect
stock valuations.

To reproduce the error:
(Enable debug mode)
1. Go to Settings > Technical > Database Strucutre > Decimal Accuracy
2. Edit Product Price:
    - Digits: 4
3. Create a Product Category PC:
    - Costing Method: FIFO
4. Create a Product P:
    - Product Type: Storable Product
    - Product Category: PC
5. Create a RfQ with product P:
    - Quantity: 1000
    - Unit Price: 0.035
6. Confirm Order, Receive Products, Validate
7. Click on Valuation

Error: The total value is equal to $40 instead of $35. The calculation
was done after rounding the unit price: $0.035 becomes $0.04, then
1000*0.04=$40.

When confirming the RfQ, a stock move is created. To do so, the method
`_get_stock_move_price_unit` is called. When validating the delivery, it
recomputes the unit price thanks to method `_get_price_unit`. In both
situation, and if the line has taxes, the method `compute_all` is called
like this:
```python
price_unit = line.taxes_id.with_context(round=False).compute_all(price_unit,
	currency=line.order_id.currency_id, quantity=1.0)['total_void']
```
But here is the problem. In this method, total amount is computed with
this line:
```python
base = currency.round(price_unit * quantity)
```
However, `quantity` is equal to 1 and the multiplication is rounded
using the currency precision. As a result, `base` is equal to $0.04.
Then, all computations will use this value and will be incorrect.

This fix applies the real quantity so `base` will have the correct
value:
```
base = currency.round(price_unit * quantity)
     = currency.round(0.035 * 1000)
     = 35
```

OPW-2472192

closes odoo/odoo#70269

X-original-commit: 77b7a23c3c759b33e26bf91faf14a10f02449a91
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-03 14:55:01 +00:00
Arthur Detroux (ard) a7ee7f7cb4 [FIX] website: hide cookie bar when entering edit mode
Previously :
Once a user enabled the cookie bar, it prevented him from dropping
snippets in the main area of the page because the focus was on
the cookie bar. Dropping snippets there has a confusing behavior and
might make the user think the editor is broken.

Reason :
The cookie bar has an oe_structure class and takes over the body
if it's not hidden or dismissed. The oe_structure allows to drop
snippets.

Fix :
Hiding the cookie bar when user enters edit mode to avoid dropping
snippets in it by mistake.

task-2477430

closes odoo/odoo#70258

X-original-commit: 8c672662c80d0dfaeb06eedfc7136a68734fbdb3
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-05-03 12:43:09 +00:00
qsm-odoo 215ae8cadb [FIX] web_editor, *: remove some post new editor dead code
*: website, website_event

Remove some dead code introduced by the new editor merge at [1].

[1]: https://github.com/odoo/odoo/commit/499e8860f194a7eb09a2e224b713a362923d77ac

closes odoo/odoo#70257

X-original-commit: 0a890a353dd89a60fd156f4280d069596b199cc7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-05-03 12:36:35 +00:00
Urvi Soni 1f53e7ffd7 [FIX] project : onboarding tour message name
There are some grammatical mistakes and spelling mistakes in the tour message.

This commit fixes these mistakes.

TaskID : 2508637

closes odoo/odoo#70219

Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-05-03 04:53:05 +00:00
Odoo's Mergebot e8954596c7 [IMP] core: speed up registry setup
This proposes a new implementation of
* the "discovery" of fields on a given model;
* the setup of fields;
* the sharing of fields across registries.

This new implementation makes the registry loading faster.  Our benchmark is two registries with 296 modules (all community modules).  Both registries have the same models, so we can see how sharing across registries can save time and/or memory.  Here are time measurements for loading both registries (from scratch):

Time | before | after | difference
---|---|---|---
Loading Odoo modules | 1176ms | 1339ms | +14%
Loading registry 1 | 2042ms | 1067ms | -48%
Loading registry 2 | 990ms | 970ms | -2%

As we can see, there is some extra work done when loading Odoo modules, but this extra work is done once for all registries using those modules.  However, this price is largely compensated by the speedup when loading a registry.  Notice also that the net time to load a registry no longer depends whether other registries are present in the server.

Overall, the loading of the first registry goes from 3218ms to 2406ms, which is 25% faster.  In other words, the bootstrapping time of a server is smaller.

closes odoo/odoo#69924

Related: odoo/upgrade#2428
Related: odoo/enterprise#17963
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-05-03 17:30:22 +02:00
Raphael Collet d3a35a2f34 [IMP] core: add magic fields on the class that defines a model
This makes magic fields shareable across registries, and speeds up their
setup.  Also simplify concurrency fields (__last_update).
2021-05-03 12:33:29 +00:00