Commit Graph
141214 Commits
Author SHA1 Message Date
Jacky (trj) bbd5101c7d [IMP]: point_of_sale: button added to close session in pos_config form if session is active
This change allows the user to directly go to the closing session page from
the `pos_config` settings if a session is active

Task ID: 2419637
2021-02-25 09:47:50 +00:00
Jacky (trj) 5dd5fdb6d3 [IMP]: pos_restaurant: table shows ratio between taken seat and max seat
This change allows the user to see how many seats are already taken in a table.

Task ID: 2419637
2021-02-25 09:47:50 +00:00
Jacky (trj) 13843f8545 [IMP]: point_of_sale UI: NumberPopup and NumberBuffer can pre-select input which will change the value upon triggering a key
The user doesn't need to delete the current input before changing it. He can now write
hiw new value which will erase the current one.
The guest popup from the `pos_restaurant` module and the global discount popup from the
`pos_discount` module benefit from this and have their input pre-selected.

Before: when opening the guest or discount popup, the user always has to delete the curent
value before changing it. Let's say that the current value was `5`, the user needs to either
press the `Delete` or `Backspace` button/key before entering his new value.

After: the user doesn't need to press the `Delete` or `Backspace` button/key and can now directly
enter his new value

Task ID: 2419637
2021-02-25 09:47:50 +00:00
Jacky (trj) 46789fb75f [IMP]: point_of_sale: field pos_categ_id added in product list
Task ID: 2419637
2021-02-25 09:47:50 +00:00
Jacky (trj) 072c8cc6e4 [IMP]: point_of_sale: price control can be enabled without installing pos_hr in pos_config
Before: to enable price control, we first have to install the `pos_hr` module by
enabling the "Authorized Employees" option. Only then was the price control option
visible. It was then possible to enable/keep the price control option while having
the "Authorized Employees" disabled. This behavior did not make sense.

After: Price control is now visible and independent from the `pos_hr` module.
The feature was already implemented in the `point_of_sale` module but the option (in the `pos_config` view) was put in the `pos_hr` module.

Task ID: 2419637
2021-02-25 09:47:50 +00:00
Jacky (trj) e29516c1c6 [IMP]: point_of_sale: added pos_categ_id in the group_by filter of product search
Allowing user to group by the POS Product Category is more relevant

Task ID: 2419637
2021-02-25 09:47:50 +00:00
Jacky (trj) b561f0b536 [IMP]: point_of_sale: confirm and cancel texts changed in load demo data popup in the UI
The confirm and cancel text was not adapted for the load demo data popup.
Those have been respectively changed to `Yes` and `No`

Task ID: 2419637
2021-02-25 09:47:50 +00:00
jbw bda98d8418 [FIX] base: fix error message when creating new currency rate
When creating a new currency from the list view, the currency was given 1.0
as rate since this was the field's default value.
The "onchange" on rate would then trigger. If 1.0 is more than 20% different
than the latest rate, a warning was popped. This warning prevented the creation of the new rate.
Meaning one could not create a new currency rate if the latest rate > 1.25 or < 0.833.

This is fixed by setting the latest rate as default value.

closes odoo/odoo#66798

Task: 2450747
X-original-commit: 02f241a35cf3a758d7759c394eb8642375dee5df
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: jbw-odoo <jbw-odoo@users.noreply.github.com>
2021-02-25 09:35:43 +00:00
Arnaud Joset 951145dd1a [IMP] web: avoid losing selection when a new quick create dialog is opended.
Before this commit, the datetime range selection was lost when the quick create dialog was opened.

closes odoo/odoo#64948

Taskid: 2342252
Related: odoo/enterprise#15915
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-25 08:25:51 +00:00
Arnaud Joset ff865dc5c9 [IMP] hr_holidays: Link the calendar event to hr.leave record
Before this commit, the calendar.event record was not properly linked to the hr.leave record.

taskid: 2342252
2021-02-25 08:25:51 +00:00
Arnaud Joset c9003f3f4b [IMP] web: calendar improvements
This commit improves the calendar behavior.

 * Before this commit, the invisible attribute were not evaluated in the calendar popover.
 * Several alignment, label, improvements

taskid: 2342252
2021-02-25 08:25:51 +00:00
Arnaud Joset 0915ac5a0e [IMP] web: Improve alignment in FieldMany2ManyTagAvatar
Before this commit, the avatar was not properly aligned with the text.

Taskid: 2342252
2021-02-25 08:25:51 +00:00
Arnaud Joset 2f4a91c0ce [IMP] calendar,calendar_sms,crm,google_calendar: Improve calendars
This commit improves multiple small details in the calendar application.
UI, UX mostly:
  * some labels were confusing
  * the invisible attribute were not set in popover view
  * the sample data were missing
  * ...

taskid: 2342252
2021-02-25 08:25:51 +00:00
Yannick Tivisse 6b6d5931a8 [FIX] base: Fix bad call to super using the same name than a variable
closes odoo/odoo#66515

Related: odoo/enterprise#16482
Related: odoo/upgrade#2178
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-24 07:19:22 +00:00
Aurélien (avd) fc396a4d17 [IMP] fleet: improve ux + fix contracts/services archive bug
Revamp the kanban view of fleet.vehicle.log.services.

Add some ux improvements (new filters, better naming,..).

Fix bug where contracts/services of archived fleet.vehicle were
not counted in statinfo.

When a fleet.vehicle is archived, archive its related contracts/services.

closes odoo/odoo#62556

Taskid: 2389823
Related: odoo/upgrade#2063
Related: odoo/enterprise#15036
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-24 12:32:11 +00:00
Nisha patel 7e0ff027d6 [IMP] hr_holidays: Improve Time Off activity summary
Currently, Dates displaying on activities of Time Off application are
not easy to read for users and We already have dates on the form with
the right user format. So we don't need it again on the chatter

So in this commit, we improve the activity summary message by
removing the dates from summary of activity.

closes odoo/odoo#60610

Taskid: 2339411
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-21 13:13:24 +00:00
Ipsita Borisagar d524c48f2b [FIX] project: remove chatter glitches in form without sheet tag
Before this commit:

In edit mode, glitching of chatter is visible in project.project and
project.task's form view(without sheet tag).

After this commit:

Removed this glinch of chatter and displaying it with full width in the form
(without sheet tag).

LINKS

PR https://github.com/odoo/odoo/pull/66314
Task- 2411632

closes odoo/odoo#66314

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-02-17 06:29:22 +00:00
Christophe Monniez db6a130889 [FIX] tests: test support for modules without __init__.py
Now that a test exists to enforce `__init__.py` in odoo module, we must
ensure that we keep the feature.

For that reason, a white-list system is added in `test_dunderinit` and a
test is added in order to be sure that a module without `__init__.py` can
be exists.

This this is made of a fake module `test_data_module` without
 `__init__.py` and a test module which ensure the fake module was
installed.

closes odoo/odoo#66778

X-original-commit: 506755ef8ced187c0f5cd2fa600e7bb1e1fc0fe3
Related: odoo/enterprise#16653
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-02-24 17:03:26 +00:00
Christophe Monniez d1bd6acca0 [FIX] packaging: add missing __init__py files
Odoo modules without `__init__.py` are not recognized as python modules
and therefore not packaged by standard tools.

X-original-commit: 45e14adb2fbe9c61f0f529c33cc1ec3ad35114e1
2021-02-24 17:03:26 +00:00
Christophe Monniez 852aa5ae31 [FIX] tests: add a linter to check for __init__.py in modules
When a module is added, it happens that the `__init__.py` file is
forgotten. In that case, those modules are not packaged.

With this commit, a test is added to check that each Odoo module has the
file.

X-original-commit: edabed7b3ab351c76b9555378efa6258f9e76733
2021-02-24 17:03:25 +00:00
Christophe Monniez c4069b90c7 [FIX] packaging: include json files
Some json files are necessary for some modules but are not included in
packaging.

closes odoo/odoo#66779

X-original-commit: d33c05b62a9c6ac54497595397adbdaebf136584
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-02-24 17:17:13 +00:00
Géry Debongnie f4250d3dea [FIX] web: add correct information in clipboard button (error dialog)
Before this commit, the way we managed the clipboard button in an error
dialog was the following:

1. crashmanager create an error dialog and give it the error information
2. error dialog does some processing to format error traceback and
display it
3. crashmanager wait for it to be ready, then will manipulate the dom to
add the clipboard button, by using the information it knows (NOT the
processed information bye the dialot)

This is obviously a mistake, so what we simply do in this commit is add
the clipboard button in the error dialog, so it has updated information.

Note that we also fix two other small issues:

- errors coming from promise crashes (unhandled rejections) were not
decorated with correct file information
- chrome traceback was not correct because it has some native
information that does not correspond to a stackframe

closes odoo/odoo#66660

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-02-24 13:08:58 +00:00
Katherine Zaoral f4cb05e2f9 [ADD] l10n_ar: generic changes to use in QR code
AFIP give us new resolution 4291 that request to print QR code in
printed version of electronic invoices. For that we:

1) update the xml report footer style
2) add generic method to sanitze the identification number we are
sending, the sanitize method is added here in order to be re used for
other functionalities across electronic invoice and reports. If we are
not able to sanitize the number then we show an error to the user
3) update translations to add new raise message translated term

NOTE: Fix pylint errors: This ones pop up when running this PR "Check Style'
in runbot

closes odoo/odoo#65034

Related: odoo/enterprise#15949
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-02-24 13:20:22 +00:00
Adrien Widart 0f202b2222 [FIX] account: register attachment only if it exists
When printing an invoice, the server tries to register one attachment as
main one (see #65320). However, if there is not any attachment, this
will raise an error.

OPW-2465995

closes odoo/odoo#66755

X-original-commit: 03d2e457b69b07f315187cd7f7299be4c838e177
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-02-24 12:51:41 +00:00
xO-Tx 42b630bd1c [IMP] web_editor: enable click on style tab
The goal of this commit is to enable the click on Style tab
in "Edit mode".
The click on this tab with no block selected will display a
message to inform the user that he has to select a block
before editing.

task-2443297

closes odoo/odoo#65573

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-23 13:05:35 +00:00
Goffin Simon 2ad6f4e14e [FIX] mrp: Existing operations cannot be added to BOM
Steps to reproduce the bug:

- Go to an existing BOM B
- Edit B and try to add an existing operation O in operations tab

Bug:

It was impossible to add an existing operation

opw:2458974

closes odoo/odoo#66712

X-original-commit: ffab43fbf54b2f914b34c18da2391f3a18b3326c
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-02-23 15:23:44 +00:00
tivisseandsimongoffin 1e84002b8f [FIX] hr_holidays: Can not approve or validate time off
A leave manager should be able to approve a time off that already begun.

opw:2447240

closes odoo/odoo#66711

X-original-commit: 2030ebe18804edc8d3a4eeb7986df9a7eaca7255
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Co-authored-by: simongoffin <sig@odoo.com>
2021-02-23 15:15:42 +00:00
Goffin Simon 0cf682ca7e [FIX] project: Creating project via service product deletes contact's data
Steps to reproduce the bug:

- Let's consider a customer C1 with email address A1 and phone P1
- Let's consider a project PR with C1 as customer
- Let's consider a service product P with:
   - Milestones (manually set quantities on order) as Service Invoicing Policy
   - Create a new project but no task as service tracking
   - PR as project template
- Create a sale order SO with C2 as customer with A2 as email address and P2 as phone
- Confirm the SO

 Bug:

 The email address and phone of C2 were changed into A1 and P1 instead of keeping A2 and P2

 opw:2439459

closes odoo/odoo#66709

X-original-commit: 1c23eba5ab4dc4108ef6209ebc529ab363c3cc6b
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-02-23 14:59:13 +00:00
qsm-odooandRomain Derie 1333e9bf4b [FIX] website_mass_mailing: correctly load newsletter snippet
Since [1], the `website_mass_mailing` module would not auto install
itself if the `mass_mailing` module would be installed since a new
dependency was added: `google_recaptcha`.

[1]: https://github.com/odoo/odoo/commit/d4984b81e6b244297e192f2be2768ed11da170aa

task-2455069

closes odoo/odoo#66727

X-original-commit: 2db46129f3749435f2dbff904a5b73168526480a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Romain Derie <rde@odoo.com>
2021-02-23 18:46:26 +00:00
Olivier Dony 3b383f41f7 [IMP] website_event_exhibitor: speed up sponsors retrieval
The filters for sponsor countries works by adding a domain term on
`partner_id.country_id`. Currently this is evaluated by the ORM by first
searching for all partners in those countries, and then substituting the
IDs in the final query (`partner_id in <ids>`).

On large databases with many partners, this makes the filtering really
slow (e.g. 3 seconds with 1M partners), even though only a few sponsors
actually match.

From a security standpoint, most of the data on the linked partner is
already available on the sponsor through related fields, and those
partners are only visible when they are already published anyway.
Besides, the calls in `_event_exhibitors_get_values` are performed
in `sudo` mode.

It should be noted that `res.partner.country_id` is not currently
indexed, and doing so helps marginally: the query goes from 3000ms to
800ms. It is still much slower than with `auto_join`, which makes it
go down to about 1-2 ms on the same dataset.

Indexing `country_id` does not help make the `auto_join` version faster,
as it only requires the primary key index to find the records.

closes odoo/odoo#66692

X-original-commit: b5246315875dfad151fcb23936499750e0f1f42a
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-02-23 13:14:12 +00:00
Goffin Simon b4ac583f85 [FIX] point_of_sale: Multicompany tax
Steps to reproduce the bug:

- Create a multi-company environment with two companies A & B
- Create two sales taxes TA & TB, one for company A & one for company B
- Created a shared product P and assign both TA & TB
- Create a fiscal position FP that maps TA and TB to other taxes
- Login with user having access of both companies
- Enable a POS session S with fiscal position and select FP
- Open S and select P as product

Bug:

A traceback was raised

PS: Only the taxes of company's user are loaded in taxes_by_id
So when trying to fetch taxes from a product with function get_taxes,
the taxes from other companies than company's user must be ignored.

opw:2448785

closes odoo/odoo#66724

X-original-commit: 5dcfdcb265a7217fd52ab5b7e3e51cc5c2430761
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-02-23 17:36:21 +00:00
Rémy Voet (ryv) 795ce6760c [FIX] stock_account: fix rounding adjustment
This fix (odoo/odoo#46850) was too permissive and fix too much
stock valuation issues (other than rounding error) under the hood.
The problem of the "too permissive" is will hide some errors
without get any feedback about them. Also, it changes the SVL value
without any explanation.

To avoid the first issue, apply a threshold on the rounding adjustment.
This threshold is '(quantity_out * smallest_value_of_the_currency) / 2'
(`smallest_value_of_the_currency` = `rounding` field of the related
currency).
Also to improve debugging, add a line in the description
about the rounding adjustment done in a SVL

task-2452786

closes odoo/odoo#66725

X-original-commit: a169d62e8999e90743401fcfe85200450ac6c628
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com>
2021-02-23 17:56:36 +00:00
Joseph Caburnay d52ec21cb6 [FIX] point_of_sale: broken view of the NumberPopup
To reproduce:

1. Activate pos_hr feature.
2. Authorize an employee with pin.
3. Open a pos session and login with that employee.
4. [BUG] The popup to input pin is broken.

This is because of the 'minus' button. In this commit, we make sure
to hide the 'minus' button when the popup is used to ask for pin.

closes odoo/odoo#66716

X-original-commit: 67dc3b2a1f1a1ca938682706bf1fc20c511d4ab0
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-02-23 16:08:09 +00:00
Nasreddin (bon) d4342d733b [FIX] stock_account: display datetime with user timezone
Issue

	- Install Inventory module
	- Go to Inventory -> Reporting -> Inventory Valuation
	- Click on "Inventory At Date" button
	- Select any date

	The datetime in breadcrumb is displayed in UTC.

Solution

	Display datetime in current user timezone.

opw-2464744

closes odoo/odoo#66721

X-original-commit: 235386e4e6c8a4b55e9bee5dd901c611cd7950da
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-02-23 16:48:19 +00:00
Nicolas LempereurandJoseph Caburnay 3bbec520e9 [FIX] point_of_sale: select employee with pin by barcode
When switching employee on point of sale, we may have a PIN to enter.

If we enter the barcode and there is a PIN, we get an "Invalid Password"
error.

Why:
====

When we switch with a barcode 12, the barcode system will catch events
and prevent their propagation:

- {'type': 'keypress', 'key': 49}
- {'type': 'keypress', 'key': 50}
- {'type': 'keypress', 'key': 13}

For respectively '1', '2', 'Newline'.

If it match an employee, the PIN number modal is opened which will
listen to KEYUP events => it receives very shortly:

- {'type': 'KEYUP', 'key': 13}

which is the newline character which follows the KEYPRESS.

With a "Return" key received, the PIN modale closes with empty value
and an error "Invalid Password" is shown.

Solution:
=========

Ignore the newline character if no number has been selected.

opw-2448585

closes odoo/odoo#66466

X-original-commit: d056feb4ac885acc6c829c57531b985027d94daf
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Co-authored-by: Joseph Caburnay <jcb@odoo.com>
2021-02-23 17:18:56 +00:00
Julien Giannone c8c91f8c73 [FIX] im_livechat: Unpin livechat channel for admin when no message sent
This commit unpins a livechat channel initiated by an admin when
it's closed and no message has been sent

closes odoo/odoo#66703

Task-id: 2276571
X-original-commit: becb242a43ed559bc7729b979f03743b729ce16c
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-02-23 14:25:07 +00:00
Lucas Lefèvre 4ab5728d01 [FIX] mail: Don't log unhandled notification
The `mail` module logs bus notifications it does not handle. However, some
notifications are not meant to be handled by `mail` and it's perfectly fine.

This commit removes the log to avoid useless noise in the console.

closes odoo/odoo#66683

X-original-commit: e0ae3c6270467985a4d56c902ef109ffc5513b13
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-02-23 12:20:21 +00:00
Denis Roussel d80d79efa3 [FIX] stock: Don't take into account canceled moves to check for backorder
Do a transfer in two steps with several move lines (e.g.: Vendors => Input => Stock).

In the first picking, set quantity = 0 on a single line. Transfer it and say 'No backorder'.

In the second picking, set all quantities (you have two move lines confirmed and one canceled). Validate the
transfer. The backorder wizard is launched. It should not.

closes odoo/odoo#66680

X-original-commit: 79d834f2c2ec167831fe0986afb728207a467d67
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-02-23 12:16:52 +00:00
Antoine Prieels 7f72f5f7ea [IMP] pos_epson_printer: Remove ePOS library
Remove minified ePOS library and replace it with direct calls to the
web server of the printer.

closes odoo/odoo#63403

Taskid: 2417429
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-02-23 12:46:54 +00:00
Xavier Morel 2eb007074c [IMP] website: mockify test
instead of using ad-hoc weirds

closes odoo/odoo#66682

X-original-commit: 7a42cc19492ada223678b6b67fc85fb121155e2b
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-02-23 12:18:07 +00:00
Qiuyu (QHO) 099b3cde08 [FIX] mail: functions for FieldCommand should return boolean value
The executing function for FieldCommand should return boolean value
to indicate whether the value changed for triggering the re-computation.

closes odoo/odoo#66681

X-original-commit: a3f5d0b292361a4aa3af8e7662f74150c5d85254
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-02-23 12:17:13 +00:00
Nicolas Lempereur 33fc445ae2 [FIX] web_editor: can set bg position on root editor
Scenario:

- go to /slides and start editing the page
- change the position of background banner
- save

=> traceback

Why:

The code for pan tool duplicates the target element in an overlay. In
the given use case, it means a node with .o_editable class is created
that will cause an error when saving because the code expect the cloned
element to be an editor (in `RTEWidget.save()`) but it is not (and is
eg. missing `.data('options')`).

opw-2427560

closes odoo/odoo#66643

X-original-commit: 96c22e816981d72c185520750167c514c6bded5b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-22 20:07:07 +00:00
Tiffany Chang (tic) 571ebf0b13 [FIX] stock: make package level package consistent v2
Commit e5ab8cf9623bc436f43706926bc6ee596c549244 missed a use case.

Steps to reproduce:

- Activiate "Packages" setting in Inventory
- Configure an operation type to "Move Entire Packages"
- Create a "Planned Transfer" picking with that operation type and add a
  package to be moved
- Turn off "Move Entire Packages" and try set the destination
  package of the move line to nothing (False).

Expected result:
Move line has no destination package + package level is deleted as
expected.

Another bug will still exist due to the design of package_level where if
in addition to the above use case, if a different package is used instead
of deleting it and "Move Entire Packages" is reactived => final package
shown in the Detailed Operations will show all move lines as being part
of the same package even though they are not. Data appears to be correct
in the database otherwise and a reasonable fix doesn't seem feasible for
now so we leave this bug as is.

Related to Task: 2418907

closes odoo/odoo#66638

Fixes: odoo/odoo#66542
Fixes: odoo/odoo#66517
X-original-commit: a73505ddafe9ce6f4f3e9896494900d419a815bd
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-02-22 17:28:14 +00:00
nie 3e1cea4373 [FIX] event_crm: prevent access rights issues on leads
Steps:
- Login as an admin user
- On a fresh branch install event_crm
- Give a "test" user access rights of "Own Document only" in the "Sales"
  app, nothing in "Events"
- Assign any lead to "test" user
- Login as "test" user and try to access your own leads

Bug:
Error: While parsing modifiers for button: for modifier "invisible":
Unknown field registration_count in domain

Explanation:
The button `event_registration_action_from_lead` tries to access event
registrations even if the user doesn't have access to events.

opw:2462127

closes odoo/odoo#66599

X-original-commit: 29be97615554337591f0b31ba34942c2d728cbef
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-02-22 12:17:07 +00:00
Adrien Dieudonne 67272fb97b [FIX] hr_work_entry: unit of period not aligned
Before this commit, 'hours' was on the next row instead of the same line.

closes odoo/odoo#66640

X-original-commit: 6820eef1e9dfe2695560ebcf265a5d69c38e4f91
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2021-02-22 17:53:16 +00:00
nie aac9fd5b80 [FIX] payment: link to order when not connected
Steps:
- Install sales,payment
- Go to Sales
- Create a quotation
- Click Actions > Generate a Payment Link
- Browse the link in a private window
- Pay

Bug:
The transaction is not linked to the sale order in the link table
`sale_order_transaction_rel`

Explanation:
When not connected, the user doesn't have the rights to read the order.
This leads `order_id` to be set to `None`:
https://github.com/odoo/odoo/blob/d2f3c9e7975188753fa17c06db3fc5c73c773944/addons/payment/controllers/portal.py#L177-L178
When paying without `order_id`, the app is not able to make a link
with the transactions:
https://github.com/odoo/odoo/blob/d2f3c9e7975188753fa17c06db3fc5c73c773944/addons/payment/controllers/portal.py#L276-L277
This raises problems such as not being able to capture an amount as seen
here:
https://github.com/odoo/odoo/blob/d2f3c9e7975188753fa17c06db3fc5c73c773944/addons/sale/views/sale_views.xml#L254-L257

If we ensure a `partner_id` is present, using `sudo` here shouldn't be a
problem as the data is protected by the token. Everything we get from
`order_id` should already be in the URL.

opw:2451564

closes odoo/odoo#66631

X-original-commit: f1f73fd2f8efdbac18d33d4e0b866ca50a28d537
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-02-22 16:46:19 +00:00
Raphael Collet e6369c2535 [IMP] core: write x2many fields last
Writing on x2many field should be done last, because deleting x2many
lines causes pending computations and updates to be flushed.  Writing on
column fields after that inevitably adds extra update queries.

We introduce an attribute `write_sequence` on fields to order fields for
write.  The prescribed order is: all fields except monetary and x2many,
monetary fields, x2many fields.

closes odoo/odoo#65959

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-02-22 16:20:55 +00:00
Raphael ColletandVictor Feyens 840609975a [IMP] core: better way to set/update magic fields
The goal of this change is to simplify the code managing `create_date`
and `write_date` in methods `create()` and `write()`, and also to remove
weird behaviors caused by the way those fields were updated.

Assume we update a simple field on a record.  This adds pending updates
for the field and `write_date`.  However, the value of `write_date` is
not known yet: it will be updated as `NOW() AT TIME ZONE 'UTC'` in SQL.
So `write_date` is actually given a dummy value in pending updates, and
it is invalidated from cache, until its value is flushed to the database
and fetched again.

Now assume we access another field on the record, and that field is not
in cache.  The prefetching mechanism will read all column fields,
including `write_date`, and flush them first.

    # this adds pending updates foo: 42, write_uid: 1, write_date: False
    record.foo = 42

    # assume 'bar' is not in cache; this prefetches all column fields,
    # which flushes the pending updates above before reading them back
    result = record.bar

We can avoid flushing pending updates if the values read from database
do not overwrite existing values in cache.  If you assume that the value
of a pending update is in cache (in the example, `foo: 42`), you don't
need to flush the corresponding field.  Indeed, the value of `foo` will
remain 42 in cache, whatever its value in the database.  This assumption
(pending updates are in cache) is true for all fields *except* for
`write_date`: it is invalidated from cache, and given a dummy value in
pending updates.  This branch actually makes this assumption true for
all fields.  The avoidance of flushing pending updates will be done in
another commit.

In order to directly assign `write_date` its value, we use a cache for
the value `NOW() AT TIME ZONE 'UTC'` from the database.  This costs at
most one query per transaction, and potentially saves a few queries.

Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-02-22 16:20:55 +00:00
Raphael Collet 75d2f995e2 [FIX] *: query counts
Adapt some query counts to their optimal value, in order to measure the
effect of the following commits on queries.

In module test_performance, some query counts were actually not correct:
the initial flush() done by the context manager assertQueryCount() may
prefetch some data to the cache, and that prefetching is not accounted
for in the query count.  This is very true when assertQueryCount() is
preceded by a cache invalidation.  We have to move the invalidation
inside the context manager, so that the prefetching is now counted.
2021-02-22 16:15:28 +00:00
Andrea Grazioso (agr-odoo) 371ae55a19 [FIX] website: show thumbnails for img gallery in tabs snippet
- Go to the website
- Drag a "Tabs" block on the page, you will have 3 example tabs
- Click on the tab "Contact" and drag in the block "Image Gallery"
- Add multiple images to the image gallery
- Click on one of the other tabs so that the image gallery is hidden
- Save

The image gallery do not have the thumbails anymore.
This occurs because when the carousel-indicator is hidden, jquery is not
able to fetch its real length, so no icons are added.

opw-2438513

closes odoo/odoo#66608

X-original-commit: eeb6eea90b9d44a42b1cc4f6b6f6c29cc7370d26
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-22 13:49:46 +00:00