Commit Graph
16260 Commits
Author SHA1 Message Date
+2 318cdcc0b8 [REF] *: adapt code to owl 2
Owl 2 changelog: https://github.com/odoo/owl/blob/a9f29c4caad4f32d06be1ec4780572825781cd9b/CHANGELOG.md

Part-of: odoo/odoo#80156
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
2022-02-10 07:46:13 +00:00
Yannick Tivisse c1616b94e6 [IMP] account: Improve frenglish terms in configuration
Part-of: odoo/odoo#82999
2022-02-08 14:53:37 +00:00
Yannick Tivisse f448b3314e [IMP] all: Improve res.config perf on method execute
Purpose
=======

Several actions are done even if nothing has changed on the configuration.

Example:
Writing on a cron the same value makes a dummy write-lock on the table
...

Part-of: odoo/odoo#82999
2022-02-08 14:53:36 +00:00
stefanorigano (SRI) 4a5dbf6a57 [FIX] web, *: float utility-classes
'pull-[left/right]' classes are discontinued since Bootstrap v3 [1].
The reason why we never noticed is that we were unknowingly
relying on fontAwesome utility classes that are basically the same.

Since v3 we were supposed to use 'float-[left/right]' classes [2], but
these classes will be renamed again in v5 with 'float-[start/end]'[3].

This commit introduces "v5 ready" utility-classes and replaces v2 legacy
occurrences across the UI.
These classes definitions can be safely removed when v5 migration will
be completed.

Notes:
- this commit will *not* adapt frontend occurrences since its CSS
  already relies on a "migration table" [4]. 
- this commit will *not* adapt the few v3 'float-[left/right]'
  occurrences since are supposed to be handled in the v5 migration
  task (task-2704984).

This commit is part of v16 overall restyle (task-2704984).

enterprise: https://github.com/odoo/enterprise/pull/23848
task-2745275

[1] https://getbootstrap.com/docs/4.3/migration/#utilities
[2] https://getbootstrap.com/docs/4.3/utilities/float/#classes
[3] https://getbootstrap.com/docs/5.1/utilities/float/#overview
[4] https://github.com/odoo/odoo/blob/15.0/addons/website/static/src/scss/compatibility/bs3_for_12_0.scss#L49

Part-of: odoo/odoo#83501
2022-02-08 12:05:53 +00:00
thcl-odoo 6c086ba6d8 [FIX] account: update website URL
Current behavior :
"Learn More" link redirects to 404 page

Steps :
- Go to Apps
- Search for Invoicing
- Click on "LEARN MORE"

OPW-2743304

closes odoo/odoo#84030

X-original-commit: 8d6fbe78cc820579f978d883050027eafbcbd259
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
Signed-off-by: Claude Thibault (thcl) <thcl@odoo.com>
2022-02-07 09:06:56 +00:00
nicolas 24b9a61c70 [FIX] account: Use the company of the env instead user company.
For this case is wrong use the company of the user, because you may in other company at this moment and the search is not
working properly.
The way to solve this is use the "env" company as use in the computed method.

closes odoo/odoo#84037

X-original-commit: ee264787841395a95162ae809928ee71fd1b7c84
Signed-off-by: William André (wan) <wan@odoo.com>
2022-02-04 23:32:54 +00:00
Nicolas (vin) d0c3e6cba1 [FIX] account: fix tax line partner assignation
When creating a new invoice by giving it an invoice_line_ids list for
which the last line is a note, the tax line may be created wrongfully
without partner_id, which is totally wrong.

To reproduce :

Create a SO
Set a customer
Insert a product with tax
Insert a note
Deliver the product
Invoice the SO and confirm the invoice
The partner_id is not set on the created tax line

While the issue only arises in 15.0, it brings to light that the partner
is not in the grouping keys while it should, so it will be changed in 13.0+

opw-2750851

closes odoo/odoo#83999

X-original-commit: 2ce994d279126aa0356b86d3fa38b699e9035e54
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Nicolas Viseur <vin@odoo.com>
2022-02-04 17:56:35 +00:00
oco-odoo 5033a532c8 [FIX] account: fix labelling on payment's partner_bank_id
In the for view of account.payment, when creating an inbound one, the partner_bank_id field was always labeled either "Customer Bank Account" or "Vendor Bank Account". This was wrong, as this field contains the bank accounts receiving the payment, so in case of an inbound operation, it's the company account. We hence add a third possible label for it in that case.

closes odoo/odoo#83974

X-original-commit: c55f2e6aa88d01bc4f26bee7c6303f53e5bb8e48
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Olivier Colson <oco@odoo.com>
2022-02-04 15:26:33 +00:00
Josse Colpaert 1247f5dba0 [IMP] account: put country_code field in debit note and reversal wizard
closes odoo/odoo#83943

Signed-off-by: William André (wan) <wan@odoo.com>
2022-02-04 13:06:58 +00:00
Nicolas (vin) 45666139ee [FIX] account: bank account config company_id
When trying to set up a new bank account using the bank account wizard,
there is an issue with the check company on the linked_journal_id field.

The check will make sure that the company on that field is either false
or the same as the company on the record. But with a recent change in
68f4534aa5 the bank account company_id will be the one from the linked partner.
As the partners for companies have an empty company_id, this check does
not make a lot of sense anymore, as it would be wrong in most cases.
(We expect a journal with the currently selected company, but the bank
account will in most cases have an empty company_id)

closes odoo/odoo#83852

Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-02-03 15:21:39 +00:00
0b38cc527b [IMP] account: implementation of storno accounting
Storno accounting is the term used to described the process of recording
a reverse action as a negative amount on the same site instead of a
positive amount on the opposite site of the credt/debit.
For instance, when one creates a credit note for an invoice, the values
of debit and credit will be kept in the same column with negative signs
instead of swapping columns like in non-Storno accounting.

It is a business practice commonly used in Eastern European countries.

Countries where Storno accounting is mandatory or considered as best
practice would be :
Czech Republic, Poland, Romania, Russia, Slovakia, Ukraine, Croatia,
Bosnia and Herzegovina, Serbia, Romania, China, Russia, Slovenia

It is available as an option in the settings and is automatically
activated for some countries which use this type of accounting.

otask-2064899

closes odoo/odoo#79581

Related: odoo/upgrade#3212
Signed-off-by: William André (wan) <wan@odoo.com>
Co-authored-by: william-andre <wan@odoo.com>
Co-authored-by: qdp-odoo <qdp@odoo.com>
2022-02-03 15:21:28 +00:00
Habib (ayh) 676c5b5f69 [IMP] account: enable account type domain filter using the context
Users are able to create accounts without restriction on the type of account to be created. With this commit we provide a context key to limit available account types and thus minimise errors.

part of task-2684816

closes odoo/odoo#80831

Related: odoo/enterprise#22198
Signed-off-by: William André (wan) <wan@odoo.com>
2022-02-03 15:21:20 +00:00
Sébastien Geelen (sge) 207a49275e [FIX] *: adapt some html fields in views
Some html field are not in their ideal style.
As the style for html fields is now dependent of
where you are in the xml view ( in group or not),
we have to adapt some views and flags some fields
to ensure they have the correct look.

This change is only be a visual enhancement
and should not prevent the function of said html fields
even if the views are not updated.

task-2637488

# Conflicts:
#	addons/mail/wizard/mail_compose_message_views.xml
#	addons/website_slides/views/slide_channel_views.xml

# Conflicts:
#	addons/sale/views/sale_views.xml

closes odoo/odoo#83792

Related: odoo/enterprise#23911
Signed-off-by: Antoine Guenet <age@odoo.com>
Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
2022-02-02 09:03:44 +00:00
Guillaume (guva) 8b5f613cc0 [FIX] account: compute the journal_id for payment register wizard
Steps to reproduce:

- Create an invoice and confirm it
- In Accounting Dashboard, on the Customer Invoices card,
  click on 'Unpaid Invoices'
- Select the invoice with the checkbox
- Click on button 'Register Payment'

Issue:

- The journal_id is not set by default

Before this commit, the default fields inherited 'journal_id',
if it's not the good one, we delete it in order to compute it..

opw-2729754

closes odoo/odoo#83770

X-original-commit: 9e2f96598f3d62b501e894eab7151af8390937e1
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Guillaume Vanleynseele <guva@odoo.com>
2022-02-01 15:32:29 +00:00
oco-odoo 67cd29a6c3 [FIX] account: partial revert of 9311b087e1, for usability
The part of 9311b087e1 affecting field labels on account.payment's form view was mistakenly merged. The actual fix regarding those labels is done in 15.0 here https://github.com/odoo/odoo/pull/83674 .

closes odoo/odoo#83744

Signed-off-by: Laurent Smet <las@odoo.com>
2022-02-01 14:37:48 +00:00
John Laterre (jol) a8628c5697 [IMP] account: add test for fiscal positions with delivery address
The goal is to test various use cases related to fiscal positions
having a specific delivery address.

The use cases are as follows:

- Case : 1
Billing (VAT/country) : BE/BE
Delivery (VAT/country) : NL/NL
Expected FP : Régime National

- Case : 2
Billing (VAT/country) : NL/NL
Delivery (VAT/country) : BE/BE
Expected FP : Régime National

- Case : 3
Billing (VAT/country) : BE/BE
Delivery (VAT/country) : None/NL
Expected FP : Régime National

- Case : 4
Billing (VAT/country) : NL/NL
Delivery (VAT/country) : NL/NL
Expected FP : Régime Intra-Communautaire

- Case : 5
Billing (VAT/country) : None/NL
Delivery (VAT/country) : None/NL
Expected FP : EU privé

- Case : 6
Billing (VAT/country) : None/US
Delivery (VAT/country) : None/US
Expected FP : Régime Extra-Communautaire

closes odoo/odoo#83714

X-original-commit: e7f112ab658b2254d0663207831f4eabdfcec166
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2022-02-01 11:53:05 +00:00
jbw 16feec36da [FIX] account: fix change period reconciliation for automatic entry wizard
When creating automatic entries for multiple moves on different dates with the automatic entry wizard, the wizard would reconcile all the lines on the accrual account of the destination move with the lines on the accrual account of each accrual move. As this would imply reconciling the same lines multiple times, it triggers a reconciliation error.
What must be done is, for each accrual move, reconcile it’s lines with only the related lines on the destination move.

closes odoo/odoo#83732

Task: 2717578
X-original-commit: 502003ac548d6620374dfbab4fb7be6dee3c1bf5
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Florian Gilbert <flg@odoo.com>
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
2022-02-01 10:54:36 +00:00
jbw 3eb760c567 [FIX] account: fix _compute_percentage returning > 100%
Sometimes _compute_percentage would return a percentage slightly over 100 due to a rounding error. This would then  trigger the constraint asserting that percentage must be >= 0 and <= 100.

Task: 2717578
X-original-commit: 813d52ed7daff408819d8838c8c36fcee825905f
Part-of: odoo/odoo#83732
2022-02-01 10:54:36 +00:00
aliya 9311b087e1 [FIX] account: make recipient bank account readonly
Currently: "register payment" wizard allows selecting different bank accounts or even creating one when registering a payment on customer invoice/vendor refund.

Should be: the field should be set to partner_bank_id and be set as readonly. When cash journal is selected, "Recipient Bank Account" field should be hidden

Task ID: 2710936

closes odoo/odoo#81319

Signed-off-by: Olivier Colson <oco@odoo.com>
2022-02-01 09:54:13 +00:00
Nicolas (vin) 62f0a3e0ff [FIX] account: fix the tax template test
In master, the tax template consistency test
is broken since 8fb53c53c3
Fix this to make sure we add an exception for
that new computed field as it should not be in
the template.

closes odoo/odoo#83724

Signed-off-by: Florian Gilbert <flg@odoo.com>
2022-02-01 08:03:00 +00:00
Thibault Delavallée 5aa0580531 [IMP] mail, various: add subtitle to notification layout
PURPOSE

Allow to somehow decorate notification emails headers with a subtitle holding
the record name and some main informations.

SPECIFICATIONS

Next to access button in "Pay Now" notification email, display a subtitle
for some of the main "Send by email" based email flows. It should be something
like 'Invoice REF/01 \n35€ due 11/2022' for account.move or equivalent for
sale.order models.

Task-2712450 (Mail/Sale: Improve 'Pay Now' notification template)

Part-of: odoo/odoo#82167
2022-01-31 17:47:35 +00:00
Thibault Delavallée bf6c805b66 [FIX] mail, *: add signature in email layouts only if requested and set
* = account, purchase, sale

Purpose of this commit is to add signature only if really asked. A variable
is available for that purpose (``email_add_signature``, recently renamed from
``add_sign``). We also correctly check signature is not void or pseudo-void
using tool ``is_html_empty``. Indeed editor may generates pseudo-void content
like ``<p><br /></p>``.

As signature is not added when a template is used (see composer code) we ensure
it is defined in mail templates used in "Send by email" flows. Indeed we cannot
know if a template already has a signature or not. To avoid having twice a
signature no signature is added in email notification layout when a template
is involved.

Continuation of odoo/odoo#76418 .

Task-2712450 (Mail/Sale: Improve 'Pay Now' notification template)

Part-of: odoo/odoo#82167
2022-01-31 17:47:33 +00:00
Thibault Delavallée 0b952df5e0 [MOV] account, purchase: move thread code in its own section
Purpose is to better isolate MailThread related methods in those huge files
containing lot of code. Better have them located in a sub-section in order
to have all mail code at the same place.

Task-2710804 (Mail: Clean Mail.Thread API)

Part-of: odoo/odoo#82167
2022-01-31 17:47:29 +00:00
Raphael Collet 75e6b645ac [IMP] core: install PG extension "pg_trgm" only if necessary
Task 2742526

closes odoo/odoo#83274

Signed-off-by: Raphael Collet <rco@odoo.com>
2022-01-28 14:10:02 +00:00
Raphael Collet a1904aa6f6 [IMP] core: field index names
The possible index names have been renamed "btree", "btree_not_null"
(instead of "not null") and "trigram" (instead of "gin").

Task 2742526

Part-of: odoo/odoo#83274
2022-01-28 14:10:01 +00:00
Joseph CaburnayandJacky 8fb53c53c3 [REF] point_of_sale,*pos*: remove Backbone.js, single loading request
This commit accomplishes multiple objectives:

1. Loading of model data for the POS UI is now done in single
request (with some exemptions).
2. Backbone.js is removed and is replaced by reactivity.js
authored by the js framework team.
3. Better organization of assets in the `__manifest__.py`

Data Loading
------------

One request per model -- that's always been how the data is loaded
in POS UI. Now, we move the aggregation of data to the backend which
simplified the data loading. In the frontend, data loading is
initiated in `load_server_data` which makes the single rpc call
to the `load_pos_data` defined in `pos.session` model.

There remains some rpc calls during loading but the number is
greatly reduced.

This change result to faster loading of the POS UI. However,
there is no more progress bar during the loading.

Notable entry points:

- .js: `PosGlobalState.load_server_data`
- .py: `pos.session.load_pos_data`

It is possible to make customizations in the loading, but is done in
several steps:

1. Override `_pos_ui_models_to_load` to include the new model to load.
2. Define `_loader_params_<model_name>` to define the `search_params` and
optional `context`.
3. Define `_get_pos_ui_<model_name>` to return the data that will be
included in the full `loaded_data`. Perform the organization in this method
whenever necessary.
4. Override `_pos_data_process` for further post processing. The final
form of `loaded_data` in this method will be sent to the frontend.

Removal of Backbone.js
----------------------

POS is no longer dependent from `Backbone.js`, but it's replaced by a
new dependency -- `reactivity.js`. It's invented by the js framework
team which will be available in owl v2.

The consequences of this change are the following:

1. The old `PosModel` is renamed to `PosGlobalState`.
2. The name of the other models are kept (except Paymentline which
is renamed to Payment).
3. The name `PosModel` is now used as the base model of the data models.
This is symmetric to our use of `PosComponent`.
4. The instance of `PosGlobalState` is made reactive in `Chrome` (the
root component). As a result, whatever mutation made in that instance,
`Chrome` will rerender. But rendering is batched so multiple mutations
in a single sychronous function call will only result to a single
render call.
5. `PosModel`s can be extended in the `Registries` the same way as we
extend the `PosComponent`s.
```js
// E.g.
Registries.Component.extend(Chrome, PosResChrome);
Registries.Model.extend(Order, PosResOrder);
```

Reorganization of assets declaration
------------------------------------

This is a simple change that replaced the explicit enumeration
of loaded .js and .xml files. Also, we now have regions in the
manifest separating:

1. Augmentations of dependencies
2. Assets for `point_of_sale.index`
3. Assets for the qunit test (soon will be improved)

Other notable changes
---------------------

- Automatic call to `Order.save_to_db` is batched.
- Instances of `devices.DeviceProxy` (`proxy`), `devices.JobQueue`
(`proxy_queue`) and `BarcodeReader` (`barcode_reader`) are moved
to `point_of_sale.env`. Together with `posbus` and `posMutex`
(previously `flush_mutex`).
- `ActivePrograms` is now passed a props.
- `cashier` is no longer saved to `localStorage`.
- `pos_cache` is overhauled.
- `cache` is taken out from `PosDB` to prevent infinite rendering
loop whenever `cache` is mutated. It's now called `CACHE` in
the `db.js` file.
- reactive version of `posmodel` is exposed globally when in debug mode.
This means that calling when calling a mutator, the UI will react.
- Added control buttons in the `ProductScreen` is sorted during `Chrome`
setup. As a result, we don't need to worry on the loading order of the
control buttons components.
- Model can be simply instantiated using `BaseModel.create(obj)`. This
takes into account the extensions.
- `pos_coupon`: rewards are now updated whenever set_order is called.
- Component unit tests were removed. It wasn't useful and it just blocks
the development. We'll be introducing better unit testing later.

closes odoo/odoo#82461

Related: odoo/enterprise#23344
Signed-off-by: Masereel Pierre <pim@odoo.com>
Co-authored-by: Jacky (trj) <trj@odoo.com>
2022-01-27 21:50:25 +00:00
Yolann Sabaux 6ae34e53b2 [FIX] account: accrual orders lines filter
Steps to repdroduce:
- install Purchase - Accounting
- Create a new Purchase Order
- Add a product
- Add a section or a note
- in Actions select Accrued Expense Entry
-> traceback rounding error

OPW-2728854

closes odoo/odoo#83057

X-original-commit: 582be68bb5e4d441548a987fda3ff6450faa24ca
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: yosa-odoo <yosa@odoo.com>
2022-01-26 13:10:52 +00:00
Guillaume (guva) beaae97201 [FIX] account: reversal_date accrued_orders wizard
Before this commit, the field reversal_date was not stored, which lead to inconsistent behaviour when creating entries, as the reversal date was always recompute with the default value.

opw-2722435

closes odoo/odoo#82445

Signed-off-by: William André (wan) <wan@odoo.com>
2022-01-26 08:48:39 +00:00
Merlin (megu) 1b8e3e4ec0 [FIX] account: use same date for paired internal transfer
The paired payment generated when doing an internal transfer didn't have the correct date

Steps to reproduce:
1. Install Accounting
2. Go to Accounting -> Configuration -> Accounting -> Journals and duplicate the 'Bank' journal
3. Go to the Accounting Dashboard
4. Create a new internal transfer in Bank (go to the three dots on the top left corner of Bank and select New -> Internal Transfer)
5. Select 'Bank (copy)' as destination journal and select a date in the past
6. Save and confirm the internal transfer
7. Go to the paired internal transfer (link in the log notes)
8. The date of the transfer is the date of creation, it should be the same as the other transfer

Solution:
Use the date of the posted internal transfer to create the paired one

OPW-2710356
OPW-2730529

closes odoo/odoo#83316

X-original-commit: ce4b81e6abc49268623bad1fcb85e963eb8990c0
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2022-01-25 13:52:39 +00:00
Nicolas (vin) 68f4534aa5 [IMP] account_*, l10n_*: allows the same bank account on multiple partners
Some use cases require the use of the same account number on multiple
partners. This will relax the constraints to allows such use cases, and
adapt to avoid setting the partner or bank when we cannot be sure of the
one we should take (on bank statement line, and during reconciliation)

Task id #2692025

closes odoo/odoo#81362

Related: odoo/enterprise#22881
Signed-off-by: Laurent Smet <las@odoo.com>
2022-01-25 13:52:29 +00:00
Laurent Smet 8223407a98 [FIX] account: Don't enable 'reconcile' on liquidity account
If the liquidity account becomes reconcile (not possible from the UI but possible when setting the account on a payment.method.line), the account is visible from the bank reconciliation widget and then, the user is able to reconcile a statement line with itself that is wrong.

closes odoo/odoo#82997

Issue: 2713163
X-original-commit: b300e71076298fe622e36789fd849c5b1c83346a
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2022-01-25 09:57:14 +00:00
John (jol) 49fe63a4d0 [FIX] account: fix fiscal position with delivery address
The goal is to ensure that 2 conditions are met for a fiscal position to
be applied (within the EU):

- The customer must have a valid VAT number from another EU Member State
- The goods must leave the country of origin

Task: 2596204
X-original-commit: ca0fc6cda38fd1e4d3c8cd8953bea790a90001f5
Part-of: odoo/odoo#81832
2022-01-24 16:05:55 +00:00
oco-odoo 65aab85da0 [FIX] account: apply correct tags to move lines when using cash rounding
To reproduce:
1- Configure a 0.05 cash rounding modifying the tax amount

2- Create an invoice using this rounding, for 3€, with a 21% tax (configured with some tags related on tax repartition; a Belgian one for example). => This will create a 0.02 tax rounding move line, for a total tax amount of 0.63 + 0.02 = 0.65

3- Check the tax report => Only 0.63 appears

This is wrong and leads to inconsistencies with the tax closing (which will consider 0.65 because of the tax account used), or the generic tax report (which only considers tax_line_id field, not tag_ids). The tags should be copied from the line we intend to modify the tax amounts of.

OPW 2714411

closes odoo/odoo#83091

X-original-commit: e8e4b0fe3913aadb0c8e1f958b65a24543e6fd9d
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Olivier Colson <oco@odoo.com>
2022-01-20 15:11:53 +00:00
Josse Colpaert 1861aa9134 [FIX] account: expressions should be passed as a list to create_index
closes odoo/odoo#83080

Signed-off-by: William André (wan) <wan@odoo.com>
2022-01-20 11:03:05 +00:00
Julien Mougenot db63ff2259 [REF] web: Owl imports adaptation
In the next version of Owl, all exported terms are directly available
from the top level `owl` object. This commit aims to adapt existing
imports to this new system. This is done by importing any Owl property
used in files at the top, right after the `import` or `require`
statements.

closes odoo/odoo#82736

Related: odoo/enterprise#23609
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-01-20 11:03:01 +00:00
Fabien Pinckaers eedf37d6e2 [IMP] Better handling of indexes
Three supported types:
- btree (default for index=True)
- btree not null (when >90% of the data are null)
- gin trigram search (for char fields)

Review of indexes on all objects.

closes odoo/odoo#83015

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-19 16:52:23 +00:00
Brice bib Bartoletti 65a89b4d57 [FIX] account: remove readonly on auto_post
The aim of this commit is to allow user to post a reversed entry even
when the date for the reversed has been set in the future.

before this commit:
if the move is generated using the reverse entry button and a date in
the future, the reverse entry is created with auto_post True and is
readonly in the view resulting in the user being unable to post the
move himself.

after this commit:
auto_post can be manually set to false and the user can post the move
himself.

closes odoo/odoo#83029

Task: #2522640
X-original-commit: 40b7976de1fe1cae71eb1063188eacb9a8a8fb70
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-01-19 13:15:00 +00:00
Laurent Smet 022ecb50fe [FIX] account: 0% tax not in tax report due
Steps to reproduce:

Have a 0% Tax
Make an invoice with it
Open tax report

The 0% tax is not present in the report because there is no tax lines generated for them because the resulting balance is zero.
Since the tax details is making a mapping between tax lines and base lines and the tax report is using them to compute the report, the tax report is not able to compute the tax base amount for such taxes.

Explanation:

Until now, the tax line with a zero amount wasn't generated because considered as noisy journal items.
Now we must be able to groupby on the base tax account on the tax report, we are forced to use the tax details.
Injecting dynamically the 0% tax on the tax details sub-queries is really complicated and leads to a huge performance drop.
For that reason, we start to generate the tax lines for 0% tax even the balance is zero.
However, since there is nothing creating the missing lines in the past, it should be fixed case by case if needed.

opw-2711432

closes odoo/odoo#82971

X-original-commit: 65b5ec4ad65f798b1d647978b5b42a49e760139a
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2022-01-18 13:40:43 +00:00
Julien Castiaux 3d7f49b2f5 [IMP] *: Don't override HttpCase.base_url() in tests
HttpCase.base_url() was introduced with ded278b9c2 but many tests were
using the name attribute already. The tests have been adapted to use the
new method.

closes odoo/odoo#82910

Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-01-17 16:56:01 +00:00
wan 4f3f28ada3 [IMP] account: add index used to open the dashboard
closes odoo/odoo#82807

X-original-commit: 18f03ef60153f593346738cfc09aaf755ba8d761
Signed-off-by: William André (wan) <wan@odoo.com>
2022-01-17 09:31:52 +00:00
wan 172269ee75 [IMP] account: auto_join statements on move_id
The dashboard is using a domain `[('move_id.state', '=', self.id)]`
This impacts the performances because we are not joining explicitely on
`move_id`. We can't use the field `state` because it is re-declared on
`account.bank.statement.line`.

X-original-commit: 8b19f0f981fefc6df7c8298b57619c6b9b0a0890
Part-of: odoo/odoo#82807
2022-01-17 09:31:52 +00:00
Yolann Sabaux 3ae25d62bb [FIX] account: adequate template loading at first time
Steps to reproduce:
- install accounting (account_accountant)
- go to invoice
- click on "send and print"
-> template is not loaded directly

Solution:
- revert changes of commit #fc5812c327daab4 since the onchange is now called only once

OPW-2732687

closes odoo/odoo#82805

X-original-commit: fa25a3b2b7cdafbce70e39a8a896924f015185a9
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: yosa-odoo <yosa@odoo.com>
2022-01-17 08:38:49 +00:00
Laurent Smet f8ce1c0457 [FIX] account: Fix wrong st line account in pos box
If money is withdrawn, we can't tell if it's a transfert to the bank account or if some money has been withdrawn to pay an invoice or some expense.
We then assign the suspense account in order for the accountant to go through the reconciliation widget process in order to dispatch/assign the amount to the right account(s).
This allows all the accounting process to go smoothly without any needs for the accountant to manually create a miscellaneous entry.

Introduced by:

closes odoo/odoo#82616

Pr: https://github.com/odoo/odoo/pull/82123
Commit: https://github.com/odoo/odoo/commit/336656e0e9677ccb2f43935b6f267fa83ed153df
X-original-commit: 04396e0627fd36d28b047e0e122ffb55a3a12ebc
Signed-off-by: Florian Gilbert <flg@odoo.com>
2022-01-17 07:46:58 +00:00
Thibault Delavallée 37db926fe8 [REF] various: remove usage and dependency on html2text library
We have our own html2plaintext, already used in lot of use cases instead of
just a few for the html2txt library.

Notably for emails: most emails going through Odoo stack use our simple
html2plaintext to format the body alternative. When no body alternative
is given to ``build_email`` an alternative is built using the library to
remove. Using our own parser allows to have the same results compared to
using ``MailMail.send()``. Difference lies in spaces and new lines as well
as markdown. Our html2plaintext is a bit simple and does not try to generate
Markdown but generates a simple plaintext version.

This also helps solving some issues with depending on that library.

Task-2702034

closes odoo/odoo#82486

X-original-commit: b3b9627b655cd7cb928925affed6cc8d92661e8d
Related: odoo/enterprise#23364
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-01-12 16:43:16 +00:00
Laurent Smet 10a3df3511 [FIX] account: 'ref' should be readonly on account.move.line
closes odoo/odoo#82508

X-original-commit: 38c13bbef39e3e82a77cfd4a316be94280e3cee5
Related: odoo/enterprise#23376
Signed-off-by: Florian Gilbert <flg@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2022-01-12 09:24:46 +00:00
roen-odoo ca6cd0362e [FIX] hr_expense: Expense not cancelled
Current behavior:
When cancelling an expense payment, the expense state was not modified and was still 'paid' when it should be 'refused'.

Steps to reproduce:
- Create an expense and post the expense and register a payment for the expense.
- Then go the vendor payments and cancel the associated vendor payment.
- The expense still shows as paid in the expenses page.

opw-2711383

closes odoo/odoo#82496

X-original-commit: 16459957d23f4bdfddfe96d72ef96cbdc6fec539
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-01-11 16:18:49 +00:00
Guillaume (guva) e666487446 [FIX] account: bank reconciliation: don't force partner when mixing payments with and without partner
Steps to reproduce :

- Create an invoice for a customer (ex $100)
- Create a payment for the invoice (ex $100)
- create a bank statement with a line item for $200
- In reconciliation, add either another journal entry or a manual operation without partner to reconcile the remaining $100

Issue:

All lines receive the partner from the invoice

opw-2691196

closes odoo/odoo#82517

X-original-commit: 6cda0780fdccf666f5a3fb0f39db59fcb0bd45c8
Signed-off-by: Guillaume Vanleynseele <guva@odoo.com>
Signed-off-by: Olivier Colson <oco@odoo.com>
2022-01-11 08:36:51 +00:00
Stéphane Bidoul 9224313e34 [IMP] account: search on parent_state instead of move_id.state
By searching on account.move.line parent_state instead
of move_id.state, we avoid a join in many circumstances
and allow the database to benefit on an index on
company_id+parent_state to optimize several
queries, such as the default filter on the Journal Items
menu which shows posted items.

closes odoo/odoo#82504

X-original-commit: ef61db1cf8ebf1ab11e5dfdd439256d0607edba8
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Florian Gilbert <flg@odoo.com>
2022-01-11 06:48:27 +00:00
Stéphane Bidoul 35f8e21c65 [IMP] account: avoid join when filtering on journal
account.move.line has a journal_id field that is related on move_id.journal_id.
By searching on journal_id we avoid a useless join,
offering more room for database query optimizations.

closes odoo/odoo#81856

X-original-commit: 2741f245f8a47e971309e97128662f1863329e45
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Florian Gilbert <flg@odoo.com>
2022-01-10 14:49:49 +00:00
Sébastien BEAU ab4637f4cd [FIX] account: Fix counterpart statement line account from posbox
closes odoo/odoo#82457

X-original-commit: 336656e0e9677ccb2f43935b6f267fa83ed153df
Signed-off-by: Laurent Smet <las@odoo.com>
2022-01-10 13:53:01 +00:00