Commit Graph
3130 Commits
Author SHA1 Message Date
oco-odoo 86601ea9f7 [FIX] account: fiscal positions: filter tax country properly in view
In case the address of the company is in a different country as its fiscal country, the taxes available as "source tax" on the fiscal position lines were not the right ones (the country of the address was used to fetch them).

closes odoo/odoo#79144

Signed-off-by: Laurent Smet <las@openerp.com>
2021-10-28 14:37:43 +00:00
Guillaume (guva) 6c35ed8346 [FIX] account: Fix unbalanced journal entry when editing payment
Steps to reproduce:

- On bank journal set the outstanding payments accounts and the
  outstanding receipts accounts, respectively to 101403 and
  101402
- In Accounting > Configuration > Settings > Default Accounts,
  let the two outstanding accounts empty.
- Customer > payment > create a payment : payment type "Receive",
  amount 5 for example. Save it.
- Edit the payment and change the payment type to "Send".
- Click on Save.

Issue

Got an UserError "Cannot create unbalanced journal entry"

Since the payment_type has changed, the computed outstanding_account_id on the payment is recomputed.
When splitting journal items using the _seek_for_lines() method, odoo is not able to retrieve the liquidity lines since outstanding_account_id has changed.

opw-2620046

closes odoo/odoo#78866

X-original-commit: 865c5d7741ca1bf003b4181d06484cc4ecaf8fcb
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: guva-odoo <guva-odoo@users.noreply.github.com>
2021-10-23 22:00:39 +00:00
Julien Van Roy 2234f26a28 [IMP] account: replace tooltips for the 3 accounts in Tax Group
For clarity purpose, tooltips for the 3 accounts in Tax Group (Configuration > Tax Group) are added.

task-2602730

closes odoo/odoo#78453

Related: odoo/enterprise#21725
Signed-off-by: William André (wan) <wan@odoo.com>
2021-10-18 15:12:50 +00:00
Andrea Grazioso (agr-odoo) d60063e159 [FIX] account: use refund repartition line when needed when applying a reconciliation model with a tax from a button
The fix made in https://github.com/odoo/odoo/pull/74427 was mistakenly not forward-ported. We reintroduce it here together with the fix that was made for it by https://github.com/odoo/odoo/pull/77589 .

Before this fix, the wrong repartition was used, and the tax_tag_invert computed for the move lines in this case was inconsistent, leading to wrong reporting.

closes odoo/odoo#78546

X-original-commit: 663bc7c0a0c0d7d16cd754bba5cea34bdb6315bf
Related: odoo/enterprise#21756
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-10-18 14:01:49 +00:00
william-andre 8bbc6e7811 [FIX] account: forward port of 4c06b3c1180048b1c0db5067adf0c0bef5c02785
The method name is private since
d9287caf94

closes odoo/odoo#78317

X-original-commit: cb9ca92ae54abb707725097eecda5b12c4ad189f
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-10-13 18:24:37 +00:00
Nicolas (vin) 66b721236c [IMP] account: Log changes on bank statements
With bank synchronization, having information about changes done by
the user on the bank statements can be useful when looking into issues.

We'll now log changes in the starting/ending balance as well as the
state of the statement to keep better track of what is happening on
the statements.

Task id #2647224

closes odoo/odoo#78264

X-original-commit: 3f2379347dae2482669aded034f3a5249aececa5
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-10-13 16:33:57 +00:00
oco-odoo 26c2c705e4 [FIX] account: carryover lines: improve view
- allow editing the date of a carryover line manually

- don't display the tax report line the carryover line is linked to anymore, as the user goes through this line to open the carryover line anyway, and it shouldn't be editable.

- also remove a domain that made no sense on carryover lines: pointing to a related field depending on the field defining the domain

Manual forward-port of https://github.com/odoo/odoo/pull/77718

closes odoo/odoo#78213

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-10-12 12:56:55 +00:00
Joseph Caburnay 7eb742f6b8 [FIX] point_of_sale: post diff on bank payment methods when closing the session
1. When the diff amount is for "combine" bank payment method, the
account.move record used to represent the combine amount is modified
to contain the diff amount. The journal entry is modified:

FROM:
```
                Debit                           Credit
Outstanding     combine_amount
Receivable                                      combine_amount
```

TO:
```
		Debit				Credit
Outstanding 	combine_amount - diff_amount
Receivable					combine_amount
Diff account	diff_amount
```

2. When the diff amount is for "split" bank payment method, an
account.move moving the diff amount from Outstanding to Diff account
is created. The journal entry is like:

```
                Debit                           Credit
Outstanding     diff_amount
Diff account    				diff_amount
```

closes odoo/odoo#77859

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2021-10-08 11:46:44 +00:00
oco-odoo eabb144fc6 [IMP] account: reconciliation models: make use of the fact currency_id is always set on move lines
In older versions, currency_id was left empty on move lines in domestic currency (as well as amount_currency and amount_residual_currency). It's not the case anymore, so we can simplify the code a little bit.

closes odoo/odoo#77260

closes odoo/odoo#77801

Related: odoo/enterprise#21354
Related: odoo/enterprise#21437
Signed-off-by: William André (wan) <wan@odoo.com>
2021-10-05 15:41:03 +00:00
oco-odoo 2df6107cd7 [IMP] account: reconciliation models: don't suggest too many matches in case of partial mathing
- Create a statement line for partner A, amounting to 90€
- Make 5 invoices for partner A, of 10, 50, 100, 500 and 100 €
- create a reconciliation model (make sure it's the only one active for testing), with
>>> "invoice matching" selected
>>> "payment tolerance" disabled
>>> "partner should be set" enabled
>>> "same currency" enabled
>>> "auto-validate" disabled

Try to reconcile your statement. The reconciliation model associates your statement line to the 5 invoices, showing a partial match of 30 for the line of 100€, as only 30€ remain after matching 10 and 50. The following lines (500 and 100) are useless in the reconciliation and confusing for the user. They shouldn't be there.

After this commit, no useless line will be proposed anymore. In our example, only lines 10, 50 and 100 will be proposed.

Task 2652915

Part-of: odoo/odoo#77801
2021-10-05 15:41:03 +00:00
oco-odoo fc1a860b3e [IMP] account: better default reconciliation models
Task 2652915

Part-of: odoo/odoo#77801
2021-10-05 15:41:03 +00:00
william-andre c03924bfbb [FIX] account: manage multiple ids in _is_end_of_seq_chain
`_deduce_sequence_number_reset` should be used on maximum one record.
That function is called from `_get_sequence_format_param` in
`_is_end_of_seq_chain` but that function was possibly calling it on
multiple ids.

https://runbot.odoo.com/runbot/build/10315612

closes odoo/odoo#77811

X-original-commit: 10b880ae999643a4e3e9328d96196a19b0cf7ac6
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-10-05 14:16:50 +00:00
Nicolas (vin) 9812d135af [ADD] Added VAT report for Italy and simplify tax templates
The Italian VAT report is needed to help Italian customers fill in
their VAT report.

Task id #2079462

X-original-commit: 570afc9f237ce6048bd412dd6f3cd7ad38ffb17a
[ADD] Added VAT report for Italy and simplify tax templates

The Italian VAT report is needed to help Italian customers fill in
their VAT report.

Task id #2079462

closes odoo/odoo#77565

X-original-commit: 616839df835283b5d682323cf96bbae579d3900a
Related: odoo/enterprise#21330
Signed-off-by: Florian Gilbert <FlorianGilbert@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-10-05 07:27:20 +00:00
Guillaume (guva) 5490d4eb94 [FIX] accounting: have the right order for bank statement
Steps to reproduce:

- Go to Accounting -> Cash Registers
- Create a first statement named E, add a line with amount 100,
  set the Ending Balance (balance_end) to 100.
- Create a second statement named H, add a line with amount 50,
  set the Ending Balance (balance_end) to 150.
- Create a third statement named C, add a line with amount 1,
  set the Ending Balance (balance_end) to 151.
- Create a last statement named as you want.

Issue:

The Starting Balance of the last statement is compute from the
Ending Balance of statement H instead of statement C.

Cause:

Because of the _order = 'date desc, name desc, id desc', if several
statements have the same date, the name is taking into account to
classify the statements, which cause issue because the name doesn't
always reflect the chronological order of creation.

Solution:

Change the order to 'date desc, id desc' when we get the previous
statement.

opw-2635092

closes odoo/odoo#77757

X-original-commit: 8a9982856318068f64e5bbdbe2c120e8c6d52097
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: guva-odoo <guva-odoo@users.noreply.github.com>
2021-10-05 06:11:07 +00:00
oco-odoo 80e8f11796 [IMP] account: forbid creating multiple foreign VAT fiscal positions for the same region
Having the same VAT fiscal position for the same region multiple times doesn't make sense and is not supported by the report enfinge. We should prevent that.

closes odoo/odoo#77663

X-original-commit: d9dfeeb498dab359df52db87ff601d68fcf0ad7c
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-10-04 09:16:25 +00:00
Nicolas (vin) eab2a5ce54 [IMP] account: hide journals without payment method line
When registering/creating payments, filter out from the selection
the journals that do not have any relevant payment method lines.

Also, always show payment method lines even when there are only
one of them.

closes odoo/odoo#74741

Related: odoo/upgrade#2861
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-09-30 18:27:49 +00:00
wan 57e714d8d1 [FIX] account: empty string is an empty sequence
The empty string, the forward slash `/` and NULL are all to be
considered as without a sequence set on `account.move`.

While this is just true, it was detected because of non deterministic
bugs at the end of the month because the tax closing move was
explicitly set to an empty string on version 14.3 and higher.
See: https://github.com/odoo/enterprise/commit/4641825daa0ed3b8e407fb3817c582cb541e88a4
Most of the tests posting an entry in the MISC journal could then
randomly fail on the last day of the month.

closes odoo/odoo#77532

X-original-commit: 9ed77eb3eee660a77a90c231258b69968e3b8df2
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-09-30 15:57:55 +00:00
oco-odoo 8873e2015f [IMP] account: make use of fiscal positions in write-offs created by reconciliation models
Before, the taxes assigned by the reconciliation models in their write-offs weren't mapped by fiscal positions. This could cause confusion, and essentially required the user to always fix by hand the cases that weren't matched.

Task 2645280

closes odoo/odoo#77204

X-original-commit: e75184459a7d47df86aa72efa36c06462d7ee9ea
Related: odoo/enterprise#21187
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-09-27 16:56:42 +00:00
oco-odoo 8b51e483ae [FIX] account: fix outdated docstring
X-original-commit: 26ec76ce8a4759ff7006d58f609e64bf0fbda410
Part-of: odoo/odoo#77112
2021-09-27 16:56:34 +00:00
qdp-odoo 65dec306b9 [FIX] account: usability fix when no partner and journal set
when an account.payment object had no partner and no journal, the computation of is_internal_transfer was wrongly computed as True... and the information banner was displayed accordingly

closes odoo/odoo#77122

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-09-24 15:49:58 +00:00
qdp-odoo bb61168f7e [FIX] account: prevent crash in account.payment
when removing the bank in an account.payment, the method _get_available_payment_method_lines() was called on an empty recordset which wasn't supported.

Part-of: odoo/odoo#77122
2021-09-24 15:49:57 +00:00
oco-odoo 46ab490c5d [FIX] account: fix wrong call to super()
closes odoo/odoo#76898

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-09-24 14:00:00 +00:00
Goffin Simon 9550789604 [FIX] account, mail: Using alias with journals in multi comapnies
Steps to reproduce the bug:

- Let's consider two companies A, B
- Let's consider two contact with the same email E, C1 in A and  C2 in B
- Let's create an alias AL for the vendor bill journal of B
- Send a vendor bill VB from E to AL

Bug:

A new bill is created in B with C1 as partner instead of C2
So an access error was raised when trying to open the bill in company B

opw:2495870

closes odoo/odoo#76963

X-original-commit: 1a58be583629af80af00f288dc5925c3940be1ef
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-22 13:47:08 +00:00
william-andre 33ae8b76f5 [IMP] account: allow batch deletion of account.sequence.mixin
In order to prevent holes in the sequence, a constraint is checking that
only the last number of the chain is removed.

This commit extends that to a batch of records by checking that:
* the last number of the sequence is part of the batch
* the batch is sequential (there are no holes in it)

closes odoo/odoo#76870

X-original-commit: 7883900e3b615c632dab2b02c792f6d8c1045a15
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-09-21 11:09:57 +00:00
Xavier Morel 5e81361f80 [FIX] *: opt parent_path fields out of unaccent
closes odoo/odoo#76436

Related: odoo/enterprise#20822
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-09-20 12:53:01 +00:00
Nathan Marotte (nama) e2c819351f [FIX] account move: Due date not updated when invoice_date changed
Issue: When changing the bill date (invoice_date) of a vendor bill,
the due date (invoice_payment_term_id) is not updated correctly

Steps to reproduce :
1) Install Accounting, Purchase
2) Create a vendor bill
3) (debug) Edit the view, remove the invisible attr for the div with
label invoice_payment_term_id
4) For the vendor bill, in that order, set the Vendor, then the due date
to 30 days, then bill date, then add a product
5) Due date is now set to 30 days after the bill date
6) Change the Bill Date
-> Due Date stays unchanged

Thanks to @smetl for writing the test !

opw-2627686

closes odoo/odoo#76736

X-original-commit: d15e0a678b021d842b96bce9c8880ed28f7fff77
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Nathan Marotte <nmarotte@users.noreply.github.com>
2021-09-20 09:30:00 +00:00
Touati Djamel (otd) d40f4f592b [FIX] account: recompute the payment terms only if there is an invoice
Bug introduced by this commit: https://github.com/odoo/odoo/commit/f05db8b122140a9d0f124484ab22eb094b4e36e9

Steps to reproduce the bug:
- create a journal entry with 4 ”account.move.line”:
    - two `”account.move.line”` with accounts of type ('receivable' or 'payable') > with the amount of both in debit or both in credit
    - two `”account.move.line”` with accounts other than the type ('receivable' or 'payable')
- save
- duplicate the `“account.move”`
- validation error will be triggered: https:github.com/odoo/odoo/blob/14.0/addons/account/models/account_move.py#L3209-L3211

Problem:
The payment terms must be recomputed only if the `”account.move”` is an invoice

OPW-2642826

closes odoo/odoo#76779

X-original-commit: 52482ae43f38a95bce9e17f2e455378d1badc893
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2021-09-17 23:59:41 +00:00
William Braeckman 13084f0faa [FIX] account,mail: fix no depends not computing field
Computed fields with no depends are not computed before record creation
rendering those fields empty instead of being computed on the first
request.
By adding a depends (the field does not actually depend on it) the field
is computed correctly and may be used directly.

TaskId-2647225

closes odoo/odoo#76744

X-original-commit: f03e74317a40957a355235b92dacff6310fbdd5b
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-17 18:52:49 +00:00
oco-odoo 62e72ca121 [FIX] account, l10n_eu_oss: make OSS report work with cash basis OSS taxes
Before this fix, a cash basis OSS tax used together with a product using the "non-EU origin" tag didn't appear properly in the OSS import report. This was due to the fact the product tag was not copied on the cash basis move: it only appeared on the invoice, on non exigible lines.

To fix that, we make the choice to keep the product tag as markup on the invoice, and to copy it to the cash basis lines created from move lines containing this tag. We therefore need a non-ambiguous way to identify account.account.tag objects that are used on products, since we don't want to copy tags used by taxes. Hence, we introduct a new value for the 'applicability' field of account.account.tag, limitating their use to products.

closes odoo/odoo#76626

X-original-commit: 0dd712b876844c3e342447e4cf26b324fcaffc37
Related: odoo/enterprise#20916
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-09-16 08:36:18 +00:00
oco-odoo 18842ee53f [IMP] account: carryover: better tooltip
closes odoo/odoo#76530

X-original-commit: d3728f89250a5e71723a48c55b4213650aa261f8
Related: odoo/enterprise#20874
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-09-15 10:16:39 +00:00
mreficent 85500f5a07 [IMP] account: add hook to pre-process taxes_map
Currently, the _recompute_tax_lines method is too long and there is no way to customize the taxes_map before move line creation. This commit adds a hook to be able to customize the tax dict values.

closes odoo/odoo#76431

X-original-commit: 748ac0764ae2f68dfd2a73ba273e2c194fad282b
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-09-15 09:01:58 +00:00
oco-odoo 0f2d151d9b [FIX] account: Don't generate pdf at all when trying to print a misc operation from the 'print invoices' actions
Before, clicking on 'print invoices' or 'print invoices without payment' on a posted misc operation raised an error message saying that only invoices could be printed. However, the pdf file still got generated and could be found as attachement on the move. With this commit, we don't generate the file anymore in this case.

closes odoo/odoo#76534

X-original-commit: 4c06b3c1180048b1c0db5067adf0c0bef5c02785
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-09-15 05:27:53 +00:00
Swapnesh Shah 078c7161a3 [FIX] account: use current date as fallback to convert currency
Description of the issue/feature this PR addresses: Fixes #76177

Current behavior before PR:
Before this commit, There will be tracback on adding new
Journal Item if there is not date on Journal Entry.

Desired behavior after PR is merged:
Now we use current date to as fallback to convert currency.

closes odoo/odoo#76416

X-original-commit: 5919fbb8a4a3bdf4e7122dadf419a131bad8d1f8
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-09-14 06:01:26 +00:00
Habib (ayh) bbb9c957eb [IMP] account: simplify invoice payment status filters
Modify search filters on the invoice views:
Open -> Unpaid (not_paid & partial)
Closed -> Paid (in_payment & paid)
Overdue -> Overdue

[FIX] journal kanban view "late invoices/bills" should not include due date = today

Task 2635664

closes odoo/odoo#76362

X-original-commit: fa15c73a087bd6b5a81aa448df2e0a8654213246
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Habib Ayob <h4818@users.noreply.github.com>
2021-09-10 17:14:02 +00:00
Victor FeyensandThibault Delavallée f85387ef33 [IMP] mail(_*): limit usage of search
Purpose of this commit is to globally improve code performance by limiting
search impact by

  * adding limits when only first found record id used;
  * avoid unnecessary searches when record set can be filtered instead;
  * using cache when accessing ir.model;

Task-2638444
PR odoo/odoo#76005

Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Co-Authored-By: Victor Feyens <vfe@odoo.com>
2021-09-08 07:56:04 +00:00
Thibault DelavalléeandVictor Feyens e87b46864c [IMP] mail(_*): improve compute in batch and remove unnecessary defaults
Purpose of this commit is to clean field definitions by

  * doing compute in batch: especially when the loop can be reduced to a single
    computation / batch assignment (based on groups or config parameter for
    example);
  * remove default when having a compute as computes should completely define
    the field value at any time;

Some side dish code cleaning is performed at the same time: unnecessary
import or dead code removal.

Task-2638444
PR odoo/odoo#76005

Co-Authored-By: Thibault Delavallée <tde@odoo.com>
Co-Authored-By: Victor Feyens <vfe@odoo.com>
2021-09-08 07:56:02 +00:00
wan fa034b2a64 [IMP] *: product back2basics 15.0
Rework the whole view, generally.

task-2605931

Part-of: odoo/odoo#75862
2021-09-07 15:50:00 +00:00
Julien Castiaux b8b89bf47d [FIX] core: prevent redundant default on related
Setting a default value on a readonly related field without an inverse
method is nonsense.  We log some warning when it happens.

We also fixed other cases where a related field has a default value
that overrides the target field's value.

closes odoo/odoo#67762

Related: odoo/enterprise#17313
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2021-09-07 15:49:48 +00:00
Touati Djamel (otd) 947dc19151 [FIX] account: copy the invoice_date_due when duplicating an invoice
Steps to reproduce the bug:
- Go to Accounting
- Create an invoice:
    - select a `invoice_payment_term_id`
    - Add product on “account.move.live”
- Save and duplicate it.

Problem:
The `invoice_payment_term_id` field will be duplicated on the second invoice, but not the `invoice_date_due` field

Solution:
The `invoice_date_due` field is set in the `_recompute_payment_terms_lines()` function when adding an `account.move.line`.
As in the duplicate invoice we also have an `account.move.line` we can therefore call this function so that the field is set
https://github.com/odoo/odoo/blob/14.0/addons/account/models/account_move.py#L1043

opw- 2628333

closes odoo/odoo#76045

X-original-commit: aa2e4b9a90d4b67a8b65542ece37ced9b1460557
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2021-09-07 11:35:08 +00:00
Louis Baudoux 5d42dfcf33 [FIX] account: fix bank_id from another company
When using module `account_invoice_extract`, it would happen that a
bank account of another company was set on the `account.move`.
This happened when the extract update was done in background via the
cron.
A check on the company of the bank account fixes the issue.

opw-2631833

closes odoo/odoo#76024

X-original-commit: 12559929a551c7f837facb8242333e9b0285950b
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Louis Baudoux <lobaudoux@users.noreply.github.com>
2021-09-06 15:47:29 +00:00
Odoo's Mergebot 7cc67aecec [MERGE] project: remove project overview and improve analytic account
The project overview is a significant technical debt
as it is a custom qweb view. It is quite limited:
- It is not possible to group the data, to filter on dates,
SOs or Field Service projects.
- Improving this is very difficult and would require weeks
of development that are not worth it.
In any case, all the information provided by the project overview
can be found elsewhere. The stat buttons of the report are basically
duplicates of the ones from the project form view.
Therefore, we are removing this report and its twin,
the Project Costs and Revenues.

In addition, analytic items lack context for the user to understand
what generated a certain cost or revenue:
- there is no link to the source document;
- the entries are not categorized (e.g. it is not easy to understand
if a cost comes from a timesheet cost, a purchase order or an expense);
- the billable type group by works fine for timesheets but then all
the other entries are flagged as Undefined, which is not very helpful;
- there is no option to easily isolate costs from revenues.

task-2545084
See odoo/enterprise#19250
See odoo/upgrade#2706

closes odoo/odoo#72736

Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-09-06 16:35:49 +02:00
Adrien Widart 717c178a5e [FIX] account: always set the account move name
On payment creation, when changing twice the payment's journal, if the
first journal already has some lines and the second one doesn't have any
lines, the payment name will be incorrect.

To reproduce the error:
1. (If present, delete all payments)
2. Create and save a payment P01:
    - Journal: Bank
3. Create a second payment P02 (do not save it):
    - Journal: Bank
4. Change P02's payment: Cash
5. Change P02's payment: Bank
6. Save P02

Error: The name of P02 is "CSH1/2021/08/0001", which would be correct if
it was a Cash payment. This error has a consequence: suppose the user
creates a third payment (journal: Bank) and confirms it, its name will
be "CSH1/2021/08/0002" (again, name linked to the incorrect journal)

On step 4, when changing the journal to Cash, since the latter hasn't
any payment, the server returns a new name ("CSH1/2021/08/0001"). Then,
on step 5, when changing back the journal to "Bank", since the latter
already has a payment (P01) and since the current record already has a
name ("CSH1/2021/08/0001"), the server doesn't change it and the
`onchange` response doesn't contain anything. As a result, when saving
the payment from the client side, the wrong name is included in the data
("CSH1/2021/08/0001"). Regarding the consequence: later, when creating
and confirming a third payment, the server will take the name of the
previous one in the same journal and will increment it
("CSH1/2021/08/0002").

OPW-2601668

closes odoo/odoo#75986

X-original-commit: 2024ff2b344d841cf775dbb14da9cc9e1e4c05e9
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-09-06 12:03:50 +00:00
Thibault Libioulle 22cd824772 [FIX] account: fix invoice count
Prior to this commit, the count distinct on move_id called in the read
group was not used correctly.

This commit uses the move_id:count_distinct result of the read_group,
which represents the number of distinct invoices.

See task-2469742

PR : #70527

task-2458135
2021-09-06 10:41:14 +02:00
Cedric Prieels (cpr) 0df93da823 [IMP] account,analytic: move the track cost setting
This commit moves the Track cost setting from account to analytic in
order to use it in modules depending on analytic.

This setting is based on a group defined in analytic
(analytic.group_analytic_accounting), this group is not moved.

PR : #72736
See odoo/upgrade#2706

task-2545084
2021-09-06 10:41:13 +02:00
oco-odoo 0ebe0ede45 [MOV] l10n_eu_oss: new name for l10n_eu_service
This module is now used to support OSS taxes, which replaced MOSS a few months ago. This renaming follows the changes introduced in stable by https://github.com/odoo/odoo/commit/0e7c289003a0a69075188dbfaea724919dac32a4 .

[IMP] l10n_eu_oss: remove dead code from former l10n_eu_service feature

[IMP] account, product, l10n_eu_oss: community adjustements to support enterprise's OSS report

The following changes where introduced in order to support the features implemented in the new l10n_eu_oss_reports module:

- account.tag objects applicable on taxes are no longer required to have a country_id. This way, we allow using tags in generic reports (i.e. the ones available for multiple countries) as well.

- add account_tag_is on product.template and product.category: this fields are m2m to account.account.tag applicable on taxes. When making an entry from this product, these tags will be set on all the tax move lines created for it. We use it in OSS to differentiate between imported and non-imported goods in the report.

- always display country_id on fiscal positions' form view: OSS taxes require to be used in some fiscal position with a country_id set, so that we can infer the country they are mapping the vat from. We make that change in the view so that users are not obliged to create auto-applied fiscal positions to fix the OSS taxes they created manually, and can directly set the country on the fiscal position.

Task 2591541

closes odoo/odoo#73602

Related: odoo/upgrade#2669
Related: odoo/enterprise#19628
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-09-04 05:21:05 +00:00
oco-odoo 5419fe445d [IMP] account: allow instantiating taxes from foreign charts of accounts
In multivat setup, we need to create taxes in foreign countries to map them with domestic taxes. Before this commit, this was only possible manually, even though all the necessary information lies in Odoo's account.tax.template objects created by l10n modules.

We now display a banner on top of foreign vat fiscal positions with a button allowing instantiating those templates directly from them when it's appropriate.

closes odoo/odoo#75803

Task: 2453325
Related: odoo/enterprise#20553
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-09-03 02:03:43 +00:00
oco-odoo d9a3b938fe [IMP] account, sale, purchase, l10n_latam, l10n_ar: add the possibility to use subtotals above tax groups when displaying them
A new field on tax groups makes it now possible for this group to be displayed under a subtotal label. If not set, this defaults instead to "Untaxed Amount", keeping the traditional behavior. This is intended for withholding taxes, which can now be implemented with negative taxes and a tax group with this field set.

To do that, this commit entirely refactors the way amount_by_group worked, and replaces it with a more complete json field called tax_totals_json. It also streamlines the way taxe totals are displayed on invoices, PO and SO and makes it so that a common code is called instead of copy-pasting the same block 3 times as before.

[IMP] purchase: always display tax totals by groups on purchases orders

Before, tax totals on purchase.order's form were not shown by group, and were instead all aggregated in a single "Taxes" category. The same went for the pdf export. The portal view, though, did show the totals by group. We now display the tax groups in the same way all the time.

closes odoo/odoo#74138

Task: 2457374
Related: odoo/enterprise#19802
Related: odoo/upgrade#2670
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-09-02 14:15:13 +00:00
oco-odoo d8c4332c8d [IMP] account: allow mixing cash basis and non-cash basis taxes on the same line
The tax_exigible field of account.move.line made it impossible to mix 'on_payment' and 'on_invoice' taxes on the same invoice line, as the base line couldn't be be tax exigible and non-tax exigible at the same time. However, this use case is needed by some countries in order to implement withholding taxes.

To solve that, we totally remove the tax_exigible field from account.move.line and instead compute it on the fly with a domain (also passed to the query_get for SQL queries). An 'always_tax_exigible' stored computed field is also added on account.move, in order to still allow (like before) putting cash basis taxes on a miscellaneous operation without any payable/receivable line and still see it become exigible without needing any payment.

[IMP] account: improve cash basis traceability

A smart button is now available on invoices generating cash basis entries, so see them all at once. The move originally creating cash basis entries is also shown as a field on them.

Task: 2457374
Part-of: odoo/odoo#74138
2021-09-02 14:15:12 +00:00
Florian Gilbert 0f90e80f9e [IMP] account: Refactor tax group widget with OWL
Refactor the tax group widget with the new JavaScript Odoo Framework:
OWL. This widget has 2 different components, one representing a tax group
and one representing the list of tax groups.

Task ID: #2312900
Initial Task ID: #1986412

Part-of: odoo/odoo#74138
2021-09-02 14:15:12 +00:00
John (jol) 0624e3f728 [IMP] base: remove setting 'Show Full Accounting Features'
The goal is to remove confusion between Invoicing and Accounting.

The current setting "Show Full Accounting Features" is confusing
and leads users to believe they have a full accounting package
in community, which is not true.

closes odoo/odoo#73977

Task: 2578997
Signed-off-by: William André (wan) <wan@odoo.com>
2021-09-02 12:57:17 +00:00