Commit Graph
16489 Commits
Author SHA1 Message Date
Ricardo Gomes Rodrigues (rigr) 7f6ab3d7bc [FIX] account: fix bug when opening a misc journal entry
Before this commit, opening a misc journal entry resulted in an error because we tried
to compute the tax totals as if it was an invoice.

This commit ignores the computation of these tax totals in case we have a misc journaly entry.

opw-2946634

closes odoo/odoo#97600

Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2022-08-08 22:15:58 +02:00
aliya 7406ec13d3 [FIX] account: fix account type computation
There can be many accounts in self and the "search_read" is currently breaking because of self.company_id in the domain.
This commit addresses two problems:
- Creating accounts in a multi-company environment
- Setting a default account_type when there is no parent found.
Account codes should however be still limited to the current company even though for performance reason we batch the searching part.

closes odoo/odoo#96832

Signed-off-by: William André (wan) <wan@odoo.com>
2022-08-08 14:17:08 +02:00
stefanorigano (SRI) 56064ff1e4 [REM] *: drop oe_clear class in favor of clearfix bootstrap default
Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2918463

Part-of: odoo/odoo#97051
2022-08-04 13:54:14 +02:00
Xavier Morel 9915953342 [FIX] account_tour: ensure the form is saved by the end of the tour
Since 54ea956490 the form view has an
"urgent save" fallback mechanism. Even if nothing has changed since
the last (?), it will save during unload, which leads to extra
requests during the browser teardown (deletion of cookies and storage,
navigation to about:blank, ...), which can lead to inconsistent
behaviors and non-deterministic errors.

- add check steps at the end of the tour to wait for relevant terminal
  states
- perform an explicit save during the tour (before confirmation)

Ideally we'd really only block on *dirty* forms, because logically the
urgent auto save thing should not trigger if the form is not
dirty. However I'm not sure there's any way to check for that
externally, so saved it is...

Part-of: odoo/odoo#96517
2022-08-04 09:14:10 +02:00
william-andre d8d47f9ff8 [REF] accounting v16. Yeeeeaah
TLDR:
* invoices are implemented using computed methods instead of onchange
* the synchronization only happens when switching tabs in the Form view
  to improve perfs.

_______________________________________________________________________

The whole engine of the synchronization of Invoices to the Journal
Entries has been refactored
* by using computed fields instead of onchange functions
* by synchronizing only from invoice to journal entry in `create` and
  `write`
* by saving when switching tabs on the Invoice form, to synchronize
  before showing the values

This comes with numerous advantages:
* no need to call the onchange methods manually
* no need to use the Form emulator to build invoices (i.e. EDI, OCR,
  intercompany, ...)
* the performance for invoices with many lines improves drastically, going
  from 2 minutes to 4 seconds to create an invoice with 500 lines
* the model is more declarative, we can now see how the values are computed
  instead of having the values being copied from various places.
* remove the hack in `onchange` that disabled the recursivity of it,
  which was unexpected and needed to be managed manually in all the
  onchange methods

This means that:
* Some fields need to be exclusively computed on journal entries values
  or invoice values, more specifically the Tax Summary widget.
  It is now
    - computed from entry lines, when opening the view
    - computed from invoice lines when changing those, because the tax lines
      will need to be recomputed anyways, erasing previously set values
    - set with an inverse function when saving; after the sync has been done
* Some possible operations previously possible have been dropped.
  (i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
  This is because such a behavior was undefined (how is changing the balance going
  to affect the unit price? How is the amount currency going to affect it?)

_______________________________________________________________________

Implementation Details
----------------------

The "dynamic lines", meaning the payment terms and the tax lines are now
only created in the `create` and `write` functions.
In order to reduce code duplication, it has been implemented using
context managers used in both `account.move` and `account.move.line`
These context managers help comparing the values before/after, acting
like a local `onchange`, but getting benefit from the dirty flags from
the `compute` dependences.
This is relying on computed fields on the move (`needed_terms`) and on
the lines (`compute_all_tax`) which contain the values needed for the
related move.
Depending on the needed values and the existing values (`term_key` and
`tax_key`, respectively) the context manager will determine what needs
to be created/updated/deleted.

Some related changes are to produce a `dict` instead of a `str` for the
`tax_totals` (previously `tax_totals_json`) fields, by simplicity to
reduce the complexity of IO, and simplicity of debugging, because the
logic of the field needed to change (cannot be computed at the same time
anymore since it needed the lines to be synced)

By simplicity, and also because it makes more sense, some boolean fields
have been merged into `display_type`:
* `is_rounding_line`
* `exclude_from_invoice_tab`
* `is_anglo_saxon_line`

The `price_unit`, `quantity` and other "invoice fields" are now not set
anymore on lines that are not product lines since it didn't make any
sense to have it.

Performances
------------

You have to keep in mind that a simple `create` didn't compute a lot of
fields, for instance not taxes were set, no payment terms,...
Now it does.

```python
import random
from timeit import timeit
from odoo import Command
domain = [('company_id', 'in', (False, self.env.company.id))]
products = self.env['product.product'].search(domain).ids
partners = self.env['res.partner'].search(domain).ids
taxes = self.env['account.tax'].search(domain).ids
def create(nmove, nline):
    self.env['account.move'].create([
        {
            'move_type': 'out_invoice',
            'partner_id': random.choice(partners),
            'invoice_line_ids': [
                Command.create({
                    'name': f'line{i}',
                    'product_id': random.choice(products),
                    'tax_ids': [Command.set([random.choice(taxes)])],
                })
                for i in range(nline)
            ]
        }
        for j in range(nmove)
    ])
                                                             # After  | Before
print(timeit("create(1, 1)", globals=globals(), number=1))   # 0.11   | 0.09
print(timeit("create(100, 1)", globals=globals(), number=1)) # 2.76   | 2.50
print(timeit("create(500, 1)", globals=globals(), number=1)) # 14.56  | 12.34
print(timeit("create(1, 100)", globals=globals(), number=1)) # 1.03   | 5.52
print(timeit("create(1, 500)", globals=globals(), number=1)) # 3.99   | 125.02
print(timeit("create(50, 50)", globals=globals(), number=1)) # 19.44  | 79.55
```

Another metric that can be used is running the test suite with
`--test-tags=/account` (only `account` installed)
* before: 404s, 267127 queries (366 tests)
* after: 318s, 232125 queries (362 tests)

Why this commit title?
----------------------

Someone told me that this was the perfect way of naming your commits.
c04065abd8

task-2711317

closes odoo/odoo#96134

Related: odoo/upgrade#3715
Related: odoo/enterprise#29758
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-03 13:44:49 +02:00
Martin Trigaux ffc525419a [IMP] base: avoid render with env mixup
The render API was confusing as mixing the access to the report and
the rendering env.

The ambiguity was present for code such as
`report.sudo()._render(record_ids)` where it was not clear if the
`sudo()` is needed to access to `report` or to `record_ids`. For low
priviledge users (such as portal or public), it was common to use
`report.with_user(SUPERUSER_ID)._render(record_ids)`.

This PR changes the render methods signature to be `api.model`. The
`report_ref` can be:
- ir.actions.report external id
- ir.actions.report id
- ir.actions.report recod
- `report_name` value

This will allow to call the report methods with any user and no longer
need to use `with_user(1)` to render reports as public user.

Task-id 2670865

closes odoo/odoo#91341

Related: odoo/upgrade#3650
Related: odoo/enterprise#27323
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-08-02 11:48:46 +02:00
Fabien Pinckaers 3363e55cac [IMP] cleanup of help messages in all modules
This commit aims at removing unuseful help message to:
1/ reduce translators work, to focus on more useful translations
2/ not sending unuseful information in load_views
3/ reduce help message to useful messages, so that we can mark
   fields having a tooltip in the future UI.
4/ some cleanup of existing messages too

The main use cases:
- REMOVED: help redundant with the field name, providing no extra info
- MOVED TO COMMENT: technical help messages, that should not be in UX

closes odoo/odoo#97279

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-08-02 00:26:53 +02:00
Guillaume (guva) 57b7c4ddd3 [FIX] account: customer address show in invoice report
When printing an invoice, the customer address
was not displayed if there was no delivery
address specified.

As the address should be displayed at the same place
than when the delivery address and customer address
are the same, we just paste the code from the related
condition.

opw-2899259

closes odoo/odoo#97248

X-original-commit: c0544097d38fae25decb096808dbbdec0cdb5c4d
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
2022-08-01 20:41:08 +02:00
Andrea Grazioso (agr-odoo) f80d3924fa [FIX] account: reconciliation of 0 balance line in automatic entry
Open Accounting>Journal Items
Select 1+ items with 0 credit/debit
Hit Actions>Automatic Entries
In the wizard choose 'Change Period', select an Accrued Account with
'reconcile' flag and confirm

Error will raise 'You are trying to reconcile some entries that are
already reconciled.'
This occurs because new entries, with 0 balance, will be created to match
the selected one. The flow include a reconciliation step in which the 0
balance will raise the error.

With this patch the problematic lines will be created but not reconciled

opw-2909058

closes odoo/odoo#97228

X-original-commit: 2433d5daec851293abcd04332dcbb589ceba92c1
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-08-01 20:41:04 +02:00
Guillaume (guva) 63d44ffd35 [FIX] account: keep statement line note
We keep the statement line note when changing
the partner in reconciliation widget

Steps:

- Create a Bank Statement, a Bank Statement
  Line BSL with a note (field narration)
- Save, edit, change partner on statement
  line and save.
-> The note on BSL is empty

With this commit we allow narration computation
only for sale documents.

opw-2832287

closes odoo/odoo#97125

X-original-commit: 19394d1971259933c5158139c56344c9c35bdaed
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Guillaume Vanleynseele (guva) <guva@odoo.com>
2022-08-01 10:55:47 +02:00
Florian(flg) cf34b1e04a [FIX] account: Remove useless check on bank statement button post.
As we allow editing balances in processing state, we do not want
to check balances before the validation of the bank statement
(only in case of a bank journal).
Commit about editing balances: 03f83eb87da00938b9d2df78651c1e06cf8a6d58
This fix split the _check_balance_end_real_same_as_computed into
2 functions. One to check "bank" bank statement and one to check
"cash" bank statement. It allows to keep the same behavior for
a "cash" bank statement when we post the bank statement, and
having the right behavior for a "bank" bank statement.

opw-2835728

closes odoo/odoo#97153

X-original-commit: 2d97efb4c84f647be3eb03f249c52b236bf00d55
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2022-07-29 23:09:09 +02:00
smdc-odoo 81720212e8 [FIX] account: fix cutoff percent display
Before this commit : When using the cutoff option (e.g. on journal
entries), the percentage in the wizard is displayed with 6 digits precision

After this commit : The percentage is displayed using only 2 digits precision

opw-2896143

closes odoo/odoo#96876

X-original-commit: d71e46dc8369b4d4c929321277a104f6db3fa7a8
Signed-off-by: Laurent Smet <las@odoo.com>
2022-07-29 15:53:21 +02:00
Nguyen Hong Quang 869f933252 [FIX] account:'Journal Entry' being hidden by their container
Currently, button 'Journal Entry' not wrap with classes `.o_stat_info
.o_stat_text` which make this
text being hidden by their own container.

This PR will fix this problem.

closes odoo/odoo#96927

X-original-commit: 8b7d548cdab9d9e6169553c2b8cde5a4e68004dd
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2022-07-28 09:14:53 +02:00
John Laterre (jol) e55196375a [FIX] account: prevent tracebacks from PDF read errors
Until now, an invalid PDF file would generate a traceback
during the export, which is not very user friendly.

The export happens when on the vendor bills list view,
by selecting one or more bill(s) that were generated
by the OCR (via the 'Upload' button),
clicking on 'Print' then 'Original Bills'.

The goal here is simply to catch those errors and display
a slightly more helpful message.

closes odoo/odoo#96935

X-original-commit: 7e7bd50403b6f5e2dabc39caf5fddb57d7052ebc
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2022-07-28 05:05:04 +02:00
Pierrot (prro) 157ae1c708 [IMP] account: improve invoice UX and bank addition
When using the wizard to add a bank account, it should be added to
an existing journal only if the journal has no bank account set
and no journal entries.

We also want to be able to remove a set bank account.

When using the wizard to add a bank account (Create it button ;
not Connect button), it should be added to an existing journal
only if the journal has no bank account set and no journal entries.

We remove an unwanted constraint on the bank journals that
prevented the removal of an Account Number (IBAN).

Some UX changes. In the Journal Items list view, specific views
open depending on their move type. This commit also changes
the "View" button of the invoice payment widget on the Journal Entry's
form view in order to align behaviours.

The core open_move method is also moved from the account move line
model to the account move's one for more flexibility.

The "1 Statement" button of the payment's form view now links to the
new reconciliation widget.

The Journal Items lists accessed from the Journal report now show
the partner by default.

The "Unreconciled" filter now filter out partial reconciliations which
have a residual amount != 0.

The Partner column should almost always be shown by default in a
Journal Items list view.

task-2893208

closes odoo/odoo#94923

Related: odoo/enterprise#29092
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2022-07-27 16:33:51 +02:00
tsb-odoo 4a415aba2e [FIX] account: analytic account fix in multicompanies env
When using _prepare_analytic_distribution_line, it would take
the company for the line from the distribution, then the env.
This would cause multicompany issues in some case, creating the
line for the wrong company. By using current the move line to
get the company before falling back on the env, we can avoid such
an issue.

OPW-2900827

closes odoo/odoo#96465

X-original-commit: 8c10324f062e4cd239494545cdfce7cde7ffadbb
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2022-07-27 03:34:57 +02:00
+2 bc0a0cead6 [IMP] web,*: enable owl list & form views
The new list and form views were merged recently [1], but they
weren't activated because they weren't 100% ready yet. This is now
the case. This commit adds those views to the view registry. As a
consequence, a lot of qunit tests and tours needed to be adapted,
mostly for selector changes.

We also add legacy list and form views to the view registry, with
keys 'legacy_list' and 'legacy_form'. This allows to force those
legacy views when necessary. For instance, we did it in views
using complex custom legacy x2many field widgets that haven't been
converted yet (we have a compatibility layer but it isn't complete
and doesn't support every advanced usecases).

[1] odoo/odoo#92475

Part-of: odoo/odoo#78221
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: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
2022-07-22 16:21:45 +02:00
Simon Genin (ges)andluvi 350ad39d51 [REF] account: convert fields to owl
This commit converts the following fields to owl:
 - account_resequence_widget
 - grouped_view_widget
 - account-tax-totals-field

Part-of: odoo/odoo#78221
Co-authored-by: luvi <luvi@odoo.com>
2022-07-22 16:21:42 +02:00
Hubert Van de Walle (huvw) c21101c161 [FIX] account: mobile: unable to add lines to misc journal
Steps to reproduce:

  - Load odoo on a small screen / mobile phone
  - Go to accounting > Miscellaneous Operations
  - Click on create
  -> The button to add a line in Journal Items is missing

Cause of the issue:

  On mobile, the kanban view is used for Journal Items
  The kanban view used [0] has an attribute `create="false"`

Solution:

  Override the `create` attribute when the kanban view is a subview

[0]: https://github.com/odoo/odoo/blob/93520cc291ffb76dd1425e413f29653df37b4062/addons/account/views/account_move_views.xml#L94

opw-2870637

closes odoo/odoo#96484

X-original-commit: 31ac34816e61d66479dbd11ebb9c5348c3f12886
Signed-off-by: Christophe Simonis <chs@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-07-21 01:53:44 +02:00
aliya 8a455d8519 [IMP] account: make account creation easier
Task 2888204

- Name is automatically split into code and name
- account_type is computed based on the closest parent of the code prefix (and can be changed)
- _onchange_name is needed to split name into code and name when creating from a related model's form

closes odoo/odoo#94171

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2022-07-14 18:03:47 +02:00
aliya 5d4b5d71c0 [FIX] account: fix the account selection widget
After the change in account_type field in account.account the old selection widget didn't work.
Fixing the selection widget and adding it back on acocunt_type field.

As account types cannot be custom anymore, the account types within the hierarchy can be hardcoded.

closes odoo/odoo#95821

Signed-off-by: Cedric Snauwaert <csn@odoo.com>
2022-07-13 19:55:47 +02:00
Joseph Caburnay 8f03b342e5 [FIX] account: allow missing account_id in account.move.line vals
When an invoice line has a display_type, account addon is expecting
account_id=False in vals. Replacing the normal dict access with a
`get` will fix the error when invoicing with note/section lines
without explicitly specifying the `account_id` to be false.

closes odoo/odoo#95894

Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-07-13 18:49:52 +02:00
Jorge Pinna Puissant f4d8d3c169 [FIX] account: apply correctly the css to the journal dashboard
Since 4f984568e1, the specific css style
was not applied correctly to the journal dashboard.

closes odoo/odoo#95886

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-13 18:49:47 +02:00
Jinjiu Liu d9893e385d [FIX] web: created css class for mt32 and mb32
Reproduction:
1. Create an invoice, then save and confirm it
2. Print the invoice
3. The CSS spacing does not work in the PDF report

Reason: V13 uses Bootstrap 3 but Odoo V14 uses Bootstrap 4. In
Bootstrap 4, the margin class is defined in a different way.

Fix: Instead of re-defining mt32 mb32 in the css file, we use mt-4 and
mb-4 to create a similar effect for the margins.

opw-2654880

closes odoo/odoo#95925

X-original-commit: 510c3f38ad54a09167774bb1e46215b761978024
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Liu Jinjiu (jili) <jili@odoo.com>
2022-07-13 16:23:12 +02:00
Camille Spiritus ca999dd8a3 [IMP] account: remove deprecated invoice date method
Deprecated method _get_default_invoice_date is no longer used and can therefore be safely removed.

closes odoo/odoo#95820

Signed-off-by: William André (wan) <wan@odoo.com>
2022-07-12 13:21:33 +02:00
Xavier-Do 2c6e73a6f3 [FIX] account: avoid invisible product_uom_id
For a non well identified reason, the user doesn't have the uom group
to see the field during the test.

this commit adds the group to the user to make it visible during
the test as a simple fix.

closes odoo/odoo#95741

Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-11 20:25:17 +02:00
aliya 26b2472f49 [IMP] account: refactor account types
Task: 2856281

- Remove user_type_id, account.account.type model, internal_type
- Add account_type that is a simple selection field
- Move internal_group and include_initial_balance to account.account
- Because of these changes, type_control_ids on account.journal is also removed

closes odoo/odoo#93212

Related: odoo/documentation#2223
Related: odoo/upgrade#3595
Related: odoo/enterprise#28205
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
2022-07-08 19:52:15 +02:00
Denis Ledoux 5ccc32fcf7 [IMP] tests: common.Form, can't write on invisible fields
In the web client, in a real use case, it's not possible
to write on fields which are invisible,
as it's not possible to write on fields which are readonly.

This is a first step in the goal to change the behavior
of the `groups=` attribute in the back-end views,
to remove them for the view instead of making them invisible.

This is mainly to reduce the diff of the revision that will introduce
the mentioned above behavior change.

As nodes with `groups=` will be removed from the view
when the user doesn't have the group, it's no longer possible
to set a value on a field having a `groups=` the user doesn't have
in the `Form` test class, as the field will no longer be at all in the
view.
However, these unit tests shouldn't have been able to set values
on invisible fields in the first place.
This revision therefore aims to correct the unit tests setting value
on fields which were invisible because the user executing the
test was not part of the required group(s) for these fields
to be visible in the view.

closes odoo/odoo#94337

Related: odoo/enterprise#28936
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-07-08 14:33:47 +02:00
Ivan Yelizariev e66efe8fe0 [FIX] account: properly handle move without sequence_number
Since Odoo v15, user can rename invoice to a custom value. Odoo automatically
detects `sequence_number` for the new name. If no number is detected, the
`sequence_number` is set to zero. In this edge case, method
`_is_end_of_seq_chain` doesn't work and raises an exception, because `last_rec` is
empty, while `_get_last_sequence` has constrain `self.ensure_one()`.

Fix it by allowing `last_rec` with zero `sequence_number`.

STEPS:

* Create invoice
* Confirm
* Reset to Draft
* Rename invoice to "Test"
* Save
* Try to delete the invoice

BEFORE: ensure_one error

Once it's fixed, we face another problem: User Error *You cannot delete this entry, as it
has already consumed a sequence number and is not the last one in the chain. You
should probably revert it instead.*

It happens because `sequence_prefix` is computed as empty string, while
`_get_last_sequence` method ignores empty values. Fix it by allowing search by
empty string too.

AFTER the two changes user can delete draft invoice

opw-2861841

closes odoo/odoo#95614

X-original-commit: 301b499b9d0ce189dc5d0433e55ce654d212927b
Signed-off-by: William André (wan) <wan@odoo.com>
2022-07-07 23:29:09 +02:00
jbw 8accd442ed [FIX] account: bank statement with erroneous partner_bank_id
Bug introduced in commit : https://github.com/odoo/odoo/pull/92660/commits/f4bf83382d479cd7060d09ccfe7bd528ec9e29dd would trigger partner_bank_id computation on bst entries and erroneously set the company bank as partner bank.

opw-2900828

closes odoo/odoo#95600

X-original-commit: 72e4471595a360635f878b8ea942a20cfef8c9b2
Signed-off-by: William André (wan) <wan@odoo.com>
2022-07-07 23:29:06 +02:00
william 0f71c64237 [FIX] account: reduce locking on moves
By trying to avoid concurrency issues while assigning the sequence [1],
we are locking too many operations even when not in the process of
assigning a new number.
* when computing `highest_name`, we don't need to lock as this is mostly
  an information on the form that can possibly change anyway while the
  form view is open (without any lock anymore)
* when computing the accounting date, we don't need to lock, the only
  information we want is the format of the sequence (yearly, monthly, no
  reset), which is not likely to change on a same journal.
* when changing the `journal_id`, it is only a helper for encoding, if
  there is a concurrency error it will be shown during the post anyways.
  Also same argument as for `highest_name`

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

closes odoo/odoo#95480

X-original-commit: 809557cdd02fe6581ed573b58158a927aabe0694
Related: odoo/enterprise#29212
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2022-07-07 14:44:25 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli 9b5c9484fe [REF] *: BS5: adapt changes in media query mixin
> Media query mixins parameters have changed for a more logical approach

> media-breakpoint-down() uses the breakpoint itself instead of the next
> breakpoint (e.g., media-breakpoint-down(lg) instead of
> media-breakpoint-down(md) targets viewports smaller than lg).
> Similarly, the second parameter in media-breakpoint-between() also
> uses the breakpoint itself instead of the next breakpoint (e.g.,
> media-between(sm, lg) instead of media-breakpoint-between(sm, md)
> targets viewports between sm and lg).

https://getbootstrap.com/docs/5.1/migration/#sass

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli e1ea58c941 [REF] *: BS5: Migrate dropdowns
- BS5 JS use the `data-bs-toggle="dropdown"` attribute to
automatically enable the BS Component.
But in this case as the `.dropdown-menu` is only rendered when the
`.dropdown-toggle` is clicked we can't initialize the Dropdown at the
first render. So we do it manually.

- change .dropdown-menu by .o-dropdown-menu (owl)
  -> to handle keyboard navigation we can't use BS dropdowns

- use currentTarget of event
  As the event can bubble we use currentTarget to be sure to be at the
  higher level in the DOM.

> All the events for the dropdown are now triggered on the dropdown
> toggle button and then bubbled up to the parent element.

- BS5 don't add .show on parent group anymore
  -> dropdown show class not on the same node on BS5

- avoid dropdown warning using margin in CSS
  BS5 show a warning if we use margin statically in CSS for a dropdown.

> Popper: CSS "margin" styles cannot be used to apply padding between
> the popper and its reference element or boundary. To replicate margin,
> use the `offset` modifier, as well as the `padding` option in the
> `preventOverflow` and `flip` modifiers.

- adapt the systray activity dropdown for mobile
  On desktop positions are now dynamic and on mobile it's static

- In BS5 the CSS `bottom: 100%;` is not more applied to the
  `.dropup .dropdown-menu` selector.

- Change right -> end and add data-bs-popper="none" to avoid
  Popper interaction

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:19 +02:00
Romeo Fragomeli d8c131c894 [FIX] *: wrong use of row and col revealed in BS5
* restore position relative:

> Columns no longer have position: relative applied, so you may have to
> add .position-relative to some elements to restore that behavior.

https://getbootstrap.com/docs/5.1/migration/#grid-updates

Example:
Favorite widget isn't shown on the right location due to change
in Boostrap 5, so we restore the old positioning of the `.col`

PS: another fix is to simply remove the position absolute of
`.o_favorite` but its break the favorite in kanban project.

* remove usage of `width` in kanban image when `col` is also used:

The class `o_kanban_image` is
```css
.o_kanban_image {
    width: 64px;
}
```

In BS4 the col rules are:
```css
.col-4 {
    flex: 0 0 33.33333333%;
    max-width: 33.33333333%;
}
```
and in BS5:
```css
.col-4 {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    width: 33.33333333%;
}
```

So `width` overrides the `col` rules.

To summarize:
In BS4
```css
{
    max-width: 33.33333333%;
    width: 64px;
}
```

In BS5
```css
{
    width: 33.33333333%;
    width: 64px;
}
```

e.g. where there is the case:
Helpdesk > Reporting > Customer Ratings (Kanban card)

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:18 +02:00
Guillaume (guva) 4805103274 [FIX] account: change journal on draft invoice
Step to reproduce:

- Create a SO, save and confirm it
- Create an invoice, on edit mode, change the journal and click on save

Issue:

- If the invoice is the first one in the current month, a sequence
  number is automatically assigned and an error is displaid.

forwardport of https://github.com/odoo/odoo/commit/b8328e45d526d276b5781da3523a0d5874da64bd

opw-2660571
opw-2879716

closes odoo/odoo#79084

closes odoo/odoo#95386

X-original-commit: 7b296982139518460405fa63eca6774bd82ba7b1
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Minet Adrien (admi) <admi@odoo.com>
2022-07-06 13:11:34 +02:00
Laurent Smet e96757194c [FIX] account: Prevent deletion of tax lines
Improvement of the current fixes:
https://github.com/odoo/odoo/commit/ac3cf2ed59c1dd5a6c91da201a0d4093212b26ae
https://github.com/odoo/odoo/commit/feb4e839dc4e35ab16527e5e264b5cc1c0a76c8e

- A tax line is linked to a tax repartition line. If you suppose a tax with 2 repartition lines then, removing one tax line should recompute the tax line.
- There are multiple taxes configuration leading to a tax line with a zero amount. For example, python tax, fixed tax with quantity = 0, a tax with a tiny amount...etc

closes odoo/odoo#95342

X-original-commit: 33d3b17e88d17314b88264f17780d500d67d72f1
Signed-off-by: William André (wan) <wan@odoo.com>
2022-07-06 11:49:57 +02:00
Valentin Chevalier b5dab9b119 [IMP] account_payment: hide pay button when paid
Hide the 'Pay Now' button for invoices which transactions total amount
equals their total amount.

When the total amount of all transactions related to the invoice is
equal to or greater than the total amount of said invoice, the 'Pay Now'
button should no longer be displayed.

task-2527323

closes odoo/odoo#95262

X-original-commit: de81225d39e7951ea9a63e24bab3a0138a6942e3
Signed-off-by: Achraf <abz@odoo.com>
2022-07-05 12:42:33 +02:00
Achraf (abz) 5d8fcdf492 [FIX] account_payment: Don't display pay now button if the status is paid
Correct "Status" position in the account_portal header

opw-2817794

X-original-commit: acf1003d46360bff23b605ccb77a44d099f1c1a8
Part-of: odoo/odoo#95262
2022-07-05 12:42:33 +02:00
Jairo Llopis 4f5491b347 [FIX] account: extensible subtree views
Both the CE and EE web clients don't support proper responsivity when a subtree view is inside a `<group>`.

By removing them (they were unnecessary anyway) we recover proper responsivity in these views.

@moduon MT-688 OPW-2843895

closes odoo/odoo#90946

Signed-off-by: William André (wan) <wan@odoo.com>
2022-07-05 12:42:25 +02:00
Raphael ColletandVincent Schippefilt eb67feb590 [FIX] *: cache consistency
In module mail, invalidating 'message_ids' on a mail thread also
invalidates its inverse field 'res_id' on messages.  If you haven't
flushed it before, your cache will be inconsistent, as shown by the test
/mail:TestMailgateway.test_message_process_bounce_records_channel.

In module purchase_stock, add depends on report.stock.quantity.  This
ensures that when the model is queried after changes in other models,
the data on which the SQL view depends is flushed to the database before
querying that model's table.

closes odoo/odoo#66938

Related: odoo/enterprise#16722
Signed-off-by: Raphael Collet <rco@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2022-07-05 11:35:01 +02:00
Abdelouahab (abla) d126f01e30 [FIX] account : add current assets to default bank supense account
Purpose
=======

possible values of Default Bank Supense Account (in accounting settings) are Current Liabilities
when they must be Current Assets.

Specification
=============

to solve the issue we added Current Assets to the possible values of this field.

opw-2855788

closes odoo/odoo#95233

X-original-commit: 2730b80942d3d32f72bae922cb06a61ecfa38c0f
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: abla001 <abla@odoo.com>
2022-07-04 16:44:55 +02:00
Ayoub Amzil c9e43c7bff [FIX] account: wrong currency separator in the tax field
The issue:
1.) Switch to German language (or any language that uses , versus . as a point separator
2.) Create a vendor bill
3.) Add items
4.) Click on the pencil/edit icon next to the tax field (below subtotal)
5.) Separator used is . instead of ,

The fix:
the field will use the right separator depending on the currency.

closes odoo/odoo#95147

X-original-commit: 3cca50bfca14f3748d16c43c25119dbe90972f7f
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2022-07-04 08:35:47 +02:00
Pierrot (prro) 783a06fee8 [IMP] account: improve account list view UX
In the Chart of Accounts list view, the column "Non Trade"
is hidden by default

closes odoo/odoo#94150

Signed-off-by: Cedric Snauwaert <csn@odoo.com>
2022-06-30 14:14:42 +02:00
Aaron Bohy 4f984568e1 [REF] *: adapt code to new kanban view
This commit makes various adapations in addons with respect to
the introduction of the owl kanban view. Mainly, some selectors
in scss and in tests needed to be adapted. Moreover, in some tests
that we haven't adapted yet, we must ensure that legacy form and
list views are still used (useLegacyViews).

It also contains some adaptations in kanban templates, e.g. the
replacement of moment by luxon, the removal of underscore...

Part-of: odoo/odoo#92475
2022-06-30 09:29:45 +02:00
Andrea Grazioso (agr-odoo) 5679a57877 [FIX] account: do not copy paired internal transfer reference
Create an internal transfer and post it
The system will automatically create the paired payment
Now duplicate the transfer and post it
No paired payment will be created

This occurs because the field paired_internal_transfer_payment_id is
copied to the new record, linking the new intenal transfer to the old
paired payment, so the system will not create a new one

opw-2870995

closes odoo/odoo#94796

X-original-commit: 86a95de1aad3e27dabaf19d5deb4c14bdd87fa1f
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-06-29 12:19:45 +02:00
Laurent Smet b2c8932db1 [FIX] account: Use 'parent_state' instead of 'move_id.state'
closes odoo/odoo#94287

X-original-commit: fd51248bf4c5535b33fb5a6335dbb3b10cb1d2d9
Related: odoo/enterprise#28744
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2022-06-28 10:23:30 +02:00
Laurent Smet f7af82def6 [FIX] account: Exclude to_check st_lines from accounting dashboard
The bank reconciliation widget is using the 'not matched' filter excluding the already reconciled statement lines and the lines marked as 'to_check'.
This commit aims to adapt the accounting dashboard to the same behavior.
This avoid having "RECONCILE 5 ITEMS" and display only 4 of them when opening the wizard.
This happens when a statement line is not reconciled but marked as 'to check'.

X-original-commit: f78192b5e12cad8b4c5a0109e7194abab29097fe
Part-of: odoo/odoo#94287
2022-06-28 10:23:30 +02:00
Yolann Sabaux 24e89a3fbe [FIX] account: prevent deletion partner
Steps to reproduce:
- Create a partner-individual, assign to a company
- Create an invoice and set the new partner as the customer
- Go to the partner view
- Delete it

Issue:
- It is possible to delete it

Cause:
The constraint in "account.move.line" uses the "commercial_partner_id" as the partner

Solution:
- Prevent the unlink if the partner is used in 'account.move' -> To delete in Master
- add "ondelete='restrict' for partner and commercial_parner in 'account.move'

opw-2858789

closes odoo/odoo#94591

X-original-commit: 7d37f5ef7ecd87aea666d96dc8200a74c8dc0b31
Signed-off-by: William André (wan) <wan@odoo.com>
2022-06-24 19:34:28 +02:00
Brice bib Bartoletti c340c0ea9d [FIX] account: report_payment_receipt_document.xml
This commit fix the template "report_payment_receipt_document".

The template call the python method "_get_reconciled_invoices_partials" but
which signature was broken by https://github.com/odoo/odoo/commit/785d49f3f0a21720d8c929d597d4041918ab7f41

closes odoo/odoo#94579

Task-id: None
X-original-commit: 3ed9a07a3674d5ce5d4378acf589231a2867acc3
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Brice Bartoletti <bib@odoo.com>
2022-06-24 19:34:25 +02:00