Commit Graph
140479 Commits
Author SHA1 Message Date
Raphael ColletandThibault Delavallée 65fd4373c5 [FIX] core: invoke constraint methods once per write
Consider a constraint method with two fields: a normal field, and a
field with an inverse method.  When calling write() with both fields,
the constraint method should be invoked once.

closes odoo/odoo#64433

X-original-commit: 25760348859f594abb796b5bc7b28f63e298cd53
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2021-01-12 15:59:10 +00:00
Goffin Simon e8fea60bb8 [FIX] purchase_requisition: Purchase Order Approval
Steps to reproduce the bug:

- Create a user with only access rights, Inventory = Administrator, Purchase = user
- Enable feature Purchase order approval in Purchase > Settings
- Agreement Type = Exclusive, lines of Agreement, Quantity of Agreement
- Login as a new created user and navigate to a menu Purchase > Purchase agreement and
create a new Purchase agreement, confirm it
- From the button create two PO (having a total > 5000)
- Cancel one of the PO first and try to approve another one

Bug:

A UserError was riased: You have to cancel or validate every RFQ before closing the purchase requisition.

opw:2368999

closes odoo/odoo#64431

X-original-commit: dfee34b0b9c83beca9aca0b21e7f130ae86c0ee6
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-01-12 15:42:15 +00:00
Ivan Yelizariev 8e6d1d7d24 [FIX] base_automation: reset active_id(s) in onchange handler
If we change ``active_model`` in context, we have to reset active_id(s),
otherwise we read a random records which may not exist.

STEPS:
1. Activate Developer mode
2. Go to Settings > Technical > Automation > Automated Actions
3. Define a new Automated Action with the following settings:
- Model: Lead/Opportunity
- Action To Do: Execute Python Code
- Trigger: Based on Form Modification
- Trigger Fields: Customer (crm.lead)
- Python Code:
```
raise Warning(records)
```
4. Go to Contacts, create a new contact and save it.
5. Click on the "Opportunities" Smart Button on the top left of the contact record.
6. Click "Create".

BEFORE: ``records`` in context read crm.lead, while id is for res.partner
record

AFTER: ``records`` is None

---

opw-2424392

closes odoo/odoo#64421

X-original-commit: 6fd6d68ee6eee6460ffda8b7dd691c0ef93b7a30
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-01-12 15:06:03 +00:00
Benjamin Frantzen (bfr) 302c5d8596 [FIX] l10n_it_edi: the xml is now correctly attached when sending to PEC mail
Related ticket : 2425845

closes odoo/odoo#64432

X-original-commit: ddd10ad9bbef0005c2c518884c4b753c9042382e
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
2021-01-12 15:55:38 +00:00
Adrien Widart c8515a53b0 [FIX] pos_cache: add pos to product
When adding a product to the order, the total will be updated but the
orderline will not be displayed

To reproduce the error:
1. Go to Point Of Sale
2. New Session
3. Click on a product so it will be added to the order

Err: The order's total is correctly updated but the line is not
displayed.

When displaying an orderline, the system wants to use the product's unit
name (`t-esc="props.line.get_unit().name"`). To do so, it uses one
specific variable of the current product, `pos`:
https://github.com/odoo/odoo/blob/abff1ca94bcc829250b63fd9677890988b796819/addons/point_of_sale/static/src/js/models.js#L1518-L1528
When using the standard Point of Sale, this variable is added on products
loading (L446) :
https://github.com/odoo/odoo/blob/abff1ca94bcc829250b63fd9677890988b796819/addons/point_of_sale/static/src/js/models.js#L438-L448
However, this variable is not set when using the pos_cache module.

OPW-2431221

closes odoo/odoo#64413

X-original-commit: cc2bd6717df379e87c9dfc485aa51f8dd33f6b76
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-01-12 14:14:11 +00:00
Samuel Degueldre e68a37f379 [FIX] web_editor: fix steps snippet line removed when change icon bg-col
Previously, when changing the background-color of an icon in the
s_process_steps snippet, the line that goes through the snippet would
disappear from that block. This was caused by our font-application code
attempting to remove extraneous DOM nodes when changing a font color or
backrgound-color, but not considering elements with a ::before or
::after pseudoelement has having content, and subsequently removing
them.

opw-2423785

closes odoo/odoo#64412

X-original-commit: 6b363d202d9c35e8249f7bb2b0730b995fdf4a7d
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
2021-01-12 13:50:20 +00:00
Florent de Labarre f239cd546e [FIX] sale_coupon : wrong decorator
closes odoo/odoo#64316

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-01-11 10:31:25 +00:00
William Henrotin 7fa9ec2638 [IMP] stock_account: create account moves in batch
This commit groups creation and posting of account moves related to
stock valuation in case of automatic valuation product.

Previously, the account move were created one by one and posted right at
the creation. Which can really slow (for instance running
_run_fifo_vaccum with a large amount of remaining quantity layer)

closes odoo/odoo#62700

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-12-08 13:40:54 +00:00
Ibrahima Gueye e95b9c068f [CLA] update optesis CCLA
Remove Abdel Rahaman TOUKOUROU

closes odoo/odoo#64407

X-original-commit: 802ee59a8d458ffb85455c547ceb89c185a5fb64
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-01-12 13:16:18 +00:00
Christophe Monniez 2949138a7d [IMP] various: use the barcode qweb widget whenever possible
When using the route `/report/barcode/...` in a report, wkhtmltopdf
makes htpps requests on the server to retrieve the barcode image.
If a lot of barcodes have to be printed, this can overload the server
with too much requests and makes wkhtml crashes.

With this commit, the qweb barcode widget is used to include the barcode
as an img tag with inline barcode image as base64 data.

closes odoo/odoo#64211

Related: odoo/enterprise#15619
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-01-12 12:50:23 +00:00
Christophe Monniez db8b3f1dbf [IMP] base: improve qweb barcode widget
When printing barcodes for a large amount of records, wkhtmltopdf will
make the same amount of http requests to the server in order to retrieve
barcodes. This can lead to performance issues or wkhtml to crash.

Fortunately, an already existsing qweb widget exists that include
barcodes images as inline base64.

With this commit, the web widget is a bit improved to accept attributes
for the generated image tag. Each option dictionary key starting with
`img_` will be converted into a tag attribute with the corresponding
value.

e.g.: `'img_alt': 'Barcode'` will result in `<img alt="Barcode"...`

The `alt` img attribute now defaults to `'Barcode %s' % value` with the
barcode value.

Also, the `quiet` reportlab option is also avalaible in the widget
options, as well as the `mask` option.

Finally, if the `symbology` option is not given, the widget defaults to
`Code128`. If `symbology` is set to `auto`, the action report will try
to guess the barcode type, based on the len of the value.
2021-01-12 12:50:23 +00:00
qsm-odoo 5ab2771d30 [FIX] website_form: adapt editor list widget design
The design was not properly adapted to the last changes before the 14.0
release and still contained some invalid properties. Now the list inputs
match the design of the normal inputs.

closes odoo/odoo#64400

X-original-commit: fe102c04c0526cb7aa547f146974cdfb80629723
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-12 12:03:30 +00:00
Martin Trigaux ade40f9028 [I18n] *: export saas-14.1 source terms
closes odoo/odoo#64393

X-original-commit: eaf7ec38b2f13b044768ccb457c5523cd24753f6
Related: odoo/enterprise#15693
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-01-12 10:38:54 +00:00
Samuel Degueldre 2f2ea71301 [FIX] web: fix colorpicker "unknown CORS error" on safari
Previously, when opening a colorpicker in safari, the crash manager
would open with the message "An unknown CORS error occured [...]". This
is actually odoo's default message when an error has no file, line or
column, which is usually the case for security reasons on CORS error.
This is however not a true CORS error, but a "ResizeObserver loop
completed with undelivered notifications" error, which also does not
report file, line and col for the error.

This error is caused by the fact that in webkit, the baseline of an
empty input is considered to be at the bottom of the input element,
rather than at the baseline of the text of the input once it has some
content. (see https://bugs.webkit.org/show_bug.cgi?id=142968 )

In the case of the colorpicker, it uses a ResizeObserver to update its
UI, including updating the content of its inputs. This will cause the
first _updateUI to fill the empty inputs, which changes the layout of
the widget content and changes its size. Changing the size of an element
inside of a handler of a ResizeObserver on that same element will cause
an error and not call the callback again, so as to prevent infinite
loop.

This commit fixes that by filling the inputs before attaching the
ResizeObserver, so that it has its final size from the get-go, and
_updateUI will no longer change the layout/size, causing this error.

opw-2419296

closes odoo/odoo#64389

X-original-commit: 5e9e35ef0d7b0cdecc5c25dc4db04925ed0408a6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-12 10:09:31 +00:00
Goffin Simon a767c5155b [FIX] payment_stripe: Bancontact with mobile
Steps to reproduce the bug:

- Let's make a bancontact payment with Stripe on mobile from the web shop
- Stripe redirects you to Odoo
- Your phone asks on which browser you wanted to redirected to Odoo
- Choose one

Bug:

An internal error was raised.

When you clicked on a browser (the same you were using or a new one, whatever)
Odoo will resend a request to Stripe. But this request will have wrong data in it.

Stripe will answer with:

Stripe: entering form_feedback with post data {'error': {'code': 'resource_missing',
'doc_url': 'https://stripe.com/docs/error-codes/resource-missing',
'message': "No such payment_intent: 'py_1I6c4UKhH8RhRq18TJs2CP0z'",
'param': 'intent',
'type': 'invalid_request_error'},
'reference': 'S00002-1'}

opw:2422031

closes odoo/odoo#64385

X-original-commit: a42075c9f913f4a20b28f97f0f6786f5a7b2968a
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-01-12 09:52:08 +00:00
Goffin Simon 14a1c6b21c [FIX] hr_fleet: mobility card on employee not repercuted on vehicle
Steps to reproduce the bug:

- Let's consider a partner P linked to an employee E and a vehicle V
- Let's change the mobility card of E with 12345

Bug:

The mobility card on V was not changed.

opw:2431316

closes odoo/odoo#64343

X-original-commit: 81e574aae3059844179dd9f54a241cd51a2474fd
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-01-11 14:54:51 +00:00
erik-bzcl 90e721d9af [CLA] Corporate signature for Bizi Software SRL
closes odoo/odoo#64374

X-original-commit: f29c6b1ffcbcfdf12d848df8ee427cc11d2df123
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-01-12 08:28:51 +00:00
Samuel Degueldre 3bb892cfab [FIX] web_editor: fix icons losing classes when modifying them
Previously, when double clicking and image, video, icon, or document in
the web-editor and replacing it with a different media type, it would
lose its custom classes. This means among other things, that it would
lose margins and paddings from bootstrap classes, or in the case of the
three columns snippet, that the new media would not be properly rounded
in its top corner, or not show up at all in the case of the video. The
only exception was when changing any media type to an icon, but in that
case it would also keep some of the media-specific classes that are
supposed to be removed (eg img-fluid or media_iframe_video).

This commit fixes that as well as some _clear behaviour that didn't
remove all classes that had to be removed, eg some fa-classes would
linger depending on their order, and the o_image class from documents
would always remain

Part of https://github.com/odoo/odoo/pull/64234
task-2282542

closes odoo/odoo#64234

X-original-commit: 99531f5dd8966fc4ad89d1e9c2886ad701527f3a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-12 06:52:14 +00:00
Samuel Degueldre 398259c93f [FIX] web_editor: fix replacing media leaving unexpected elements
Previously, changing a media from a video/icon/document to a different
type would leave empty elements in the DOM, this is because summernote's
range API `range.insertNode` function deletes the content but not the
structure (HTML elements).

This commit fixes that by using jQuery's replaceWith method instead of
summernote's insertNode when a media was found, and only using
summernote in case no media was found (eg. a text range).

Part of https://github.com/odoo/odoo/pull/64234

X-original-commit: 63f80995a05eeab1061b769c7733a1cfa98c726e
2021-01-12 06:52:14 +00:00
David James a2cb36e854 [CLA] signed by davejames
closes odoo/odoo#64289

X-original-commit: 30a0a5ced3a90c73fbec322a447e741b4b677ca2
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-01-08 17:36:18 +00:00
张文广 44ca035641 [CLA] Zhang WenGuang signs personal CLA
closes odoo/odoo#64287

X-original-commit: 640610a39b7acc6a2840443e895266e8a64320a6
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-01-08 17:31:11 +00:00
Romain Derie ec132b530f [FIX] web_editor, website: prevent multiple click on save
Clicking on save on html editor is taking quite some time. The user might think
something is not happening and need to click again.
If he does click again, 2 write RPC will be sent, making the COW business code
being triggered twice, ultimately leading to create 2 COW.

Instead of
  A
 / \
B   B'

It will be
    A
  / | \
B   B' B'
With as many B' than there is click on save.

This commit adds a generic helper to make a button load/spin.

closes odoo/odoo#64366

X-original-commit: 80592abda266ef3f9f463854c3101eb3f728087b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2021-01-11 18:41:32 +00:00
Ivan Yelizariev d20f10c0c1 [FIX] point_of_sale: respect setting only_round_cash_method
STEPS:
* configure rounding:
  - cash_rounding=True
  - only_round_cash_method=True
  - round method: 1.0 Down

* open a session
* add products with subtotal in decimals (such as 6.35)
* select Bank payment method and process the order

BEFORE: error "You have to round your payments lines"

AFTER: order is processed and marked as paid

---

https://github.com/odoo/odoo/commit/42425996e36d9cb1fc1391402cf6d00df4aea019
opw-2426027

closes odoo/odoo#64351

X-original-commit: db0b65e547defe3d49c1a31c4671f546aa5156e8
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-01-11 15:45:33 +00:00
Sébastien Theys 508a2bbc96 [FIX] mail: adapt useStore test to OWL v1.2.1
The intent of the test was to count renders but it counted calls to `onUpdate`
which was the same "by luck", but the function was changed to be called more
often than renders to fix another bug.

Proper way to count renders (after the initial mount) is just to use `patched`.

closes odoo/odoo#64352

X-original-commit: c7375ebaf8d4baa6e02534425ed634c7264ce90f
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-01-11 15:46:39 +00:00
Aaron Bohy 9fc79bbf14 [FIX] web: update owl to last version
This commit updates owl from v1.2.0 to v1.2.1

See [1] for the list of changes.

[1] https://github.com/odoo/owl/commit/25738a1bf08ff47b2d8cb7b7c57d3bf4a7e1caa7

X-original-commit: 1e87d7b65bdfef323a6cdae3a54b3beb6aacf3b4
2021-01-11 15:46:37 +00:00
Adrien Widart fa2837b924 [FIX] account: sending several invoices at one
When sending several invoices, customers also receive those that do not
concern them.

To reproduce the error:
(Need mailcatcher)
1. Go to Invoicing
2. Select two invoices
    - Status must be "Posted"
    - Customers must be different
3. Action > Send & Print
4. Uncheck "Print", then click on "Send"
5. Repeat 2-4

Err: Each customer receives both invoices. (In some cases, a third mail
is event sent). Each customer must receive his own invoices.

The mail composer wasn't correctly configured.

OPW-2422117

closes odoo/odoo#64340

X-original-commit: 603752df5444f60ac7282758c7e6596940747889
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-01-11 14:04:28 +00:00
William HenrotinandJuppe 2d0a413f82 [FIX] stock: from from_date domain
Commit c2c9d6d143 changed the inequality sign unintentionally.
This commit change it to the right value

closes odoo/odoo#64334

X-original-commit: 217d9201deea06d36a7417f54360cb695f70212d
Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Co-authored-by: Juppe <johan.totterman@sprintit.fi>
2021-01-11 12:35:16 +00:00
Arnold Moyaux 49be9e4904 [FIX] stock: Add index for free reservation
Free reservation is called each time an extra quantity is
used on a move (and for each immediate transfer). It means
that the function is called many times on a database with an
inventoy activity. Also _free_reservation method do a search
on fields that are not indexed, and is slow on large database.

This index is specific to _free_reservation.
On a live database with an important stock, the queries dropped from 265ms
to 1.5ms.

closes odoo/odoo#64327

X-original-commit: 74ea87d0a354b7414afb76d98ed39ecde45a8fb1
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-01-11 11:46:29 +00:00
Adrien Widart 31bf2fd446 [FIX] mrp: reordering rules for BoM product
When running the scheduler, if one of the concerned product  is a
kit, it will always generate a RfQ for the components, even if there
are already enough of them.

To reproduce the error:
(Need purchase)
1. Create 2 products P and P_compo
	- Both must be storable products
	- P_compo must have at least one vendor
2. Go on P-product page
3. Add a reordering rule (e.g., min: 5 and max: 10)
4. Add a BoM
	- Must be a Kit
	- Add P_compo to components
5. Inventory > Operations > Run Scheduler
6. Go to Purchase, find the generated RfQ
7. Confirm the order, Receive Products, Validate
8. Go on P-product's page
	- As you can see, you have enough P-products on hand
9. Repeat steps 5-6

=> You should not find any RfQ since you already have enough P-products.

When checking the P-product's page, you can see the correct quantity on
hand because it uses the `_compute_quantities` method and this one has been
overridden in the mrp-module so a kit will be correctly computed.

However, when running the scheduler, it uses another method to get the
current quantities: `_compute_quantities_dict`. Since this method has
not been overridden in mrp-module, it will use the basic implementation
and this one does not consider the possibility for a product to be a
kit.

This fix creates an override of `_compute_quantities_dict` so it can
compute the correct quantities of products with 'phantom' as BoM type.
Moreover, for the code to be simpler and clearer, thix fix also merges
`_compute_quantities` and the new `_compute_quantities_dict`.

OPW-2421841

closes odoo/odoo#64326

X-original-commit: 609e2f4427082431b56aa8f999d74ed9d39db653
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-01-11 11:46:01 +00:00
nie 23233a7051 [FIX] tools: try decrypting PDF with empty password
Steps:
- Install accounting
- On the dashboard, try to upload an "encrypted" PDF like this one https://launchpadlibrarian.net/24827090/DS-0157.pdf

Bug:
Traceback:
PyPDF2.utils.PdfReadError: file has not been decrypted

Explanation:
In 13.0, these errors were caught in a catch all `except` as shown here: https://github.com/odoo/odoo/blob/4e089041252c25cc197a30f9e285d82f7162d809/addons/account_facturx/models/account_move.py#L303-L328

From this SO comment: https://stackoverflow.com/questions/52047944/pdfbox-extracting-blanks-from-pdf-encrypted-with-no-password#comment91054285_52047944

> A PDF can be encrypted with two passwords: a user password and an owner password. When a PDF is encrypted with a user password, you can't open the document in a PDF viewer without entering that password. When a PDF is encrypted with an owner password only, everyone can open a PDF without that password, but some restrictions may be in place.

From time to time, we get a PDF encrypted with an owner password. The
content is still readable, but PyPDF2 fails because it thinks the PDF is
encrypted. With this fix, we try to unwrap the PDF by providing an empty
user password. This way, PyPDF2 thinks the content is now decrypted.

However, PyPDF2 only supports decrypting versions 1 and 2 of the
encryption implementation. If the version is different, we skip reading
the attachments and carry on to allow the user to upload the document.

opw:2375993

closes odoo/odoo#64320

X-original-commit: 851fe64f7789bb398383c22e3ebbaebb051791f6
Signed-off-by: backspac <backspac@users.noreply.github.com>
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-01-11 10:56:43 +00:00
wan d9ab32fef8 [FIX] account: dashboard view cash statements
Fine tuning of 78286851034b8f3ef4dcab78e50b7220c0bdd213

The link to view Cash Statements on the dashboard openned the wrong
action.
Also in some cases, removing the context key `search_default_journal`
was not enough so we set it to `False` instead.

closes #64118

closes odoo/odoo#64279

X-original-commit: 95ffa9fd122eae82d12d40db3cb7364cf3d3c919
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2021-01-08 16:42:38 +00:00
Goffin Simon 1febb882ac [FIX] account: Bank account not selectable
Steps to reproduce the bug:

An account with the type "Credit Card" can not be chosen for the
creation
of a journal with the type "Bank" as the domain for bank account filter
only for accounts with the type "Bank and Cash"

As the filter on the `user_type_id` is too restrictive we remove it in
case the journal is bank or cash

Bug:

Impossible to select the correct account.

opw-2394959

closes odoo/odoo#64288

X-original-commit: f4e67d8ae174d7e2ee75a1de1083b31a6ff2af8b
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-01-08 17:33:09 +00:00
oco-odoo 237574c48c [FIX] account: reconcile models: create write-offs properly when matching a statement line with no partner
Before that, write-offs were simply never created in this case ; only an open balance. This was (obviously) wrong.

Also, the partner set on the statement line was not modified, and kept empty. We fix that so that, when a statement line without is reconciled with lines sharing the same partner, this partner is also assigned to the statement line.

Task 2423231

closes odoo/odoo#64253

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-08 11:10:01 +00:00
oco-odoo d9c5c3e095 [FIX] account: reconciliation models: make auto_reconcile rules work properly with write-offs
- Create an invoice for 100
- Create a bank statement for 95
- Setup your reconciliation model so that it will match them and create a write-off for the remaining 5. Make it auto_reconciled.

=> Doing that, we expect the bank journal move to be created like this:

- 100 on payable/receivable, reconciled with the invoice
- 95 on the bank account
- 5 on the write-off account

This wasn't the case. Instead, Odoo created the following (correct from an accounting point of view, but weird):

- 95 on payable/receivable, reconciled with the invoice
- 5 on payable/receivable, not reconciled
- 95 on the bank account
- 5 on the write-off account

=> So an open balance of 5 was actually created. This was weird, and also caused an additional bug, as only the first payable/receivable line was reconciled with the invoice, making it only partially paid.

This commit restores the expected behavior.
2021-01-08 11:09:48 +00:00
Nasreddin (bon) 82ca092bd1 [FIX] misc: Babel; handle 'kur' (kurdish) locale
Issue

	- add a new language with locale code KUR (for Kurdish)
	- print any report with a datetime on it (RFQ for example)

Cause

	Babel (version < 2.7.0) does not handle locale "KUR".

Solution

	If wrong locale or not managed by Babel, try to fallback
	on server default locale.
	If still wrong locale or not managed, then fallback on "en_US" as locale.

opw-2416482

closes odoo/odoo#64304

X-original-commit: e6ccdb397792db62c3b08d96435b3c1667c1aa9d
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-01-10 19:59:01 +00:00
Didier (did) 0a3ad62e40 [IMP] mail: save/restore the feedback in the activity model
task-2397404

closes odoo/odoo#64094

X-original-commit: 74453020c89facd504c140023e302a72ae6b415e
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-01-05 15:19:49 +00:00
nie 6d64212f08 [FIX] website: dynamic snippet products overflows on mobile
Steps:
- Install eCommerce
- Go to "Website" > "Go to Website"
- Click Edit
- Add the Dynamic Products block with a template and a category
- Save
- Switch to mobile view

Bug:
The right arrow of the block overflows and makes it possible to scroll
the entire view sideways.

Explanation:
This commit puts back prev and next arrows onto the carousel. It also
changes their design to be more visible over the content. The arrows are
now smaller and displayed in clickable gray circles.

opw:2415187

closes odoo/odoo#64274

X-original-commit: a5d7a1a6f3cf82610802ad84a9ae1baaa3f58e15
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-01-08 15:36:35 +00:00
Olivier Dony 2ded82920e [FIX] website: repair "overwrite" mode for translation wizard
In the context of bug #43365, the fix merged in #48031 introduced an
override of `ir.translation._load_module_terms()`, which calls `super()`
then does some extra stuff.

This was forward-ported to later versions, unfortunately the
forward-ports missed the fact that the method signature changed at some
point (circa saas-13.2) and the `overwrite` flag which used to be passed
in the `context` had become an explicit method argument.

As a result, that argument is lost in the `super()` call and the
`website` module entirely disables the "overwrite" mode for the
translation loading wizard.

The fwd-port that seems to introduce the issue is odoo/odoo#50477 (998987f8ee148235f4025eb97a424e838ac6fc9f)

closes odoo/odoo#64251

X-original-commit: 26355a6bf83a194c2e398e859e49920da1f415b8
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-01-08 10:40:26 +00:00
Aurélien Warnon 1f73a652be [IMP] crm[_sms]: align crm list view with "My Activities" view
Some of the feature of the "My Activities" list view of the crm app were not
available on the regular crm tree view.

This commit aligns the 2 views by sharing these features, notably:
- You can "snooze" your next activity if there is one
- You can contact the lead by email with a direct button on the row/list header
- You can contact the lead by sms with a direct button on the row/list header

The "team_id" column is now optional="hide" since not required most of the time
when you go to check your own leads (and can be activated in a few clicks if
needed).

Finally, the "Email" action at the end of the tree row is now in "single" mode
to allow adding contacts on the fly. This implied re-introducing an action that
was recently removed in 8c65d7c5f7
Further demonstrating that R&D is just an eternal loop.

UPG PR odoo/upgrade#2064
Task-2390500

closes odoo/odoo#62289

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-08 10:10:27 +00:00
Raphael Collet 1e7659ad48 [FIX] core: avoid access error when flushing
This takes a former patch one step further.

Assume you recompute a field on two records, and the computation assigns
the first record but not the second one.  Before this patch, the
recomputation process was accessing the field on both records.  When
accessing the first record, both records are recomputed, and the value
of the first one is found in cache.  When accessing the second record,
no recomputation is made (it has been done already), and the cache is
empty. The field is thus fetched from database, and this crashes because
of insufficient access rights.

This scenario was causing some obscure nondeterministic crashes in
tests. The nondeterminism comes from the choice of the environment for
flushing (it should not be in superuser mode); the order of records in
the set to compute; the order in which records are assigned in the
compute method; the fact that the compute method should assign some
records and some not.

The fix consists in adding a method that processes pending computations,
without doing anything special for unassigned records.  The method is
used in field accessors (__get__ and mapped) and in method recompute().
The access error is gone because the recomputation no longer tries to
get the value of a field to compute.

closes odoo/odoo#64264

X-original-commit: b7676ec33172e6196b5fd1eda4df730ebf90eb6b
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2021-01-08 13:06:25 +00:00
nie ad59eff40a [FIX] portal: Due in %d days is not translated
Steps:
- Install Invoicing and load French
- Go to Invoicing
- Click an invoice due in the future
- Click Preview
- Switch the preview to French by modifying the URL like this: example.com/my/invoices/6 -> example.com/fr_FR/my/invoices/6

Bug:
"Due in %d days" is still displayed in English. The rest of the page is in French.

Explanation:
This is due to two things:
1. `mail` and `portal` are both installed and we cannot have more than one `code` translation of a source [1]. Since `mail` is loaded before, alphabetically, `portal` doesn't add the duplicated translations with its own module name. When loading a web page, only the modules returned by `_get_translation_frontend_modules_domain()` are sent to the frontend. `mail` is not one of them and the duplicated translations are not sent. Since sending all the `mail` translations is overkill, this commit is modifying the format string. This won't change the text outcome, but will make the new sources unique and make the backend send these translations to the frontend.
2. Translations in `portal_sidebar.js` are queried before the translation DB [2] is made. This results in an empty array and `_t()` returns the source. `session.is_bound` will wait until the app is fully loaded before querying.

[1] https://github.com/odoo/odoo/blob/ad2d96db8ad3e1fd7af2edda218fc34c0c1d259a/odoo/addons/base/models/ir_translation.py#L290
[2] https://github.com/odoo/odoo/blob/0de069b8ca9fb005ba5b076984f5677de25889ee/addons/web/static/src/js/core/translation.js#L51

opw:2421501

closes odoo/odoo#64263

X-original-commit: 118d79192cf0fc923a121745c78e6dd0da563df0
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-01-08 12:51:34 +00:00
Andrea Grazioso (agr-odoo) afed9f0d80 [FIX] account: label for internal transfer
Create two differnt journals for two different bank accounts (A, B).
Create an Internal Transfer in bank A to send money, then reconcile.
Create an Internal Transfer in bank B to receive money, then try to
reconcile

Internal transfers are labeled 'Customer Reimbursement' and 'Customer
Payment' even if no external partner is involved in the process,

opw-2423161

closes odoo/odoo#64258

X-original-commit: 4fcacfac8967a3facbe751f748faff02033ce0ae
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-08 12:17:06 +00:00
Laurent Smet 221e6da548 [FIX] account: Allow sharing outstanding accounts on bank journals
In the bank reconciliation widget, allow matching a payment (blue lines) owned by another bank journal as the statement line one if both journal are sharing the same outstanding account.
It implies to remove the constraint preventing such accounts sharing.

The purpose is the following.
Suppose you are working with payment acquirers generating payments on a bank journal A.
At the end of the month, the bank journal B is debited to pay the payment acquirer.
At this point, you get a statement line on journal B you need to match with payments generated on A.

closes odoo/odoo#64115

X-original-commit: 8d34e1606f930deaa148563ffd40c69457650305
Related: odoo/enterprise#15577
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-05 18:38:05 +00:00
Andrea Grazioso (agr-odoo) 6611628019 [FIX] base_vat: fix ABN check for Australia
The Australian equivalent of a VAT number is an ABN number.
In Australia TFN are private and not meant to be entered into
systems or publicly displayed.
ABN numbers are the public facing number that legally must be displayed
on all tax invoices and legal documents.

This fix will override the 'tfn' check done via stdnum for AU companies
with 'abn' check

opw-2415142

closes odoo/odoo#64221

X-original-commit: a72f7222c9f5987a20461be9c837e3de73801ff7
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-01-07 16:13:06 +00:00
Arnold Moyaux 161a9b8192 [FIX] repair: be able to put service on repair fees
commit 38711e9f9c prevent multi company issues.
But it goes a litle too far in restriction and prevent to put a service
in the repair fee. Which is a feature since user would like to register
and invoice human ressources in maintenance cost.

closes odoo/odoo#64033

X-original-commit: 64de68b4420eb4d82ff2130dfaa310e40775a0b7
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2021-01-04 17:04:08 +00:00
Achraf (abz)andThibault Delavallée f5adb5b25d [FIX] mail: send notification mail with right access link when using mail.thread
PURPOSE

Notification may be sent using a generic mail.thread record, notably when
sending user notifications. In that case links to view document are
incorrect.

HOW TO REPRODUCE

Issue

    - Install "Approvals"
    - Submit new approval with you as "Request Owner"
    - Click on "View Approval Request" in your mailbox

    The link redirects to a 505 error

Cause

    The model is not the correct one and the res_id is undefined

Solution

    Specify the model and the res_id to _notify_get_action_link
    when creating the link with kwargs

SPECIFICATIONS

Propagate message value through various notification sub methods. That way
we can rely on them if model seems void.

Also limit values given as URL parameters to some white listed values.

LINKS

opw-2358846
Task ID-2379766
Followup of odoo/odoo#60998
Followup of odoo/odoo#61545
Closes odoo/odoo#63292
Closes odoo/enterprise#15585

closes odoo/odoo#64229

X-original-commit: 58bac5d242d6548d54f0163328fa64b319852e40
Related: odoo/enterprise#15634
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Achraf Ben Azzouz <abz@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2021-01-07 17:44:37 +00:00
Nicolas Galler f7ccadb353 [FIX] stock: run scheduler actions as super user
In `run_scheduler`, we are running certain functions as super user to
avoid inter company and access rights issues.  This commit adds a
`sudo()` call to the `action_assign()` call, in case some objects
related to the retrieved moves are not accessible.

In addition a commit call is moved up to apply after the
`procure_orderpoint_confirm` call (as it was, it was applied after the
`_action_assign` loop, but there is in fact already a commit in that
loop, this lead to a somewhat random behavior where the replenish rules
were sometimes rolled back and sometimes not, depending on whether the
first iteration of the loop errored out or not)

opw-2394706

closes odoo/odoo#64041

X-original-commit: 592ee14d7fe81e7e5afd23f2bbbdac344eae6060
Signed-off-by: Nicolas Galler <ngaller@users.noreply.github.com>
2021-01-04 18:39:21 +00:00
mir-odoo 57db30ba69 [IMP] website: Use nolabel on visitor country_flag on tree view.
Before, there was no support of nolabel in tree view but now we
added it.

So in this commit, Replace the empty string with nolabel True.

closes odoo/odoo#64212

Taskid: 2414124
X-original-commit: 4286f2f90258a5c1f97d42f7c2aee1e964723ca0
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-01-07 13:45:14 +00:00
qsm-odoo 089ae3d28b [IMP] web_editor: review image size display
Now the size is displayed in a badge in a better location.

Also, the size is now always displayed even if the user did not just
apply a modification (so that if the user saves then reopens edit mode
and clicks on an image, he can inspect the image size).

task-2424917

closes odoo/odoo#64036

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-07 16:17:13 +00:00
Christophe Simonis 8d5aaaa0e2 [FIX] core: check module state inconsistencies after end upgrade scripts
Some modules may be removed by the upgrade scripts with the help of the
ORM and are done in `end` scripts.
This is the case for uninstalling the themes which use the `_theme_remove`
method [1].

[1] in 12.0: https://github.com/odoo/odoo/blob/e2084a4356f63249920d8c777e92f1710be8b5a6/addons/website_theme_install/models/ir_module_module.py#L337

closes odoo/odoo#64219

X-original-commit: e5ab5410dbc006fc4bcdd21e603026483bf5d360
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Christophe Simonis <chs@odoo.com>
2021-01-07 15:24:27 +00:00