Commit Graph
609 Commits
Author SHA1 Message Date
Andrea Grazioso (agr-odoo) 4a0054a409 [FIX] account: fix total recomputation when having 100% tax
Create a tax as follows:
* Tax Computation: Percentage of Price Tax Included
* Tax Scope: Purchase
* Amount: 100%
* Included in Price
* Affect Base of Subsequent Taxes
Create a vendor bill with the tax on the line
Change unit price

The total does not change

This occur because when having 100% tax debit/credit are unchanged.
So the onchange `_onchange_mark_recompute_taxes` is not triggered and
the tax lines are not updated, thus not changing the
total (as in this case the invoice total is just the tax value)

opw-2370861

closes odoo/odoo#61555

X-original-commit: 9e203cc016b45875f699ffab24fe3f8382a97303
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2020-11-09 16:04:03 +00:00
william-andre d4b4069dec [FIX] account: prevent changing date and journal of move with name
We need to ensure the name stays consitent with the journal_id and the
date when we try to change one of those fields.

X-original-commit: 634aaeeac36d2371743338536466a0bcc9ad6c69
2020-11-06 11:24:26 +00:00
oco-odoo b66c4fd0f7 [FIX] account: reconciliation widget: make invoice matching reconciliation models work with write-off lines
Use case:

1) Create an invoice matching reconciliation model, matching 90% percent of the amount, with a write-off line applying a 100% write-off of the remaining amount.

2) Create a 100€ invoice

3) Create a bank statement with a 90€ statement line whose payment reference corresponds to the one of the invoice

4) Click 'reconcile' on the bank statement

On enterprise, this crashes when preparing the data to give to the reconciliation widget, as the write_off_vals key is not set properly by the call to _apply_rules.

OPW 2367754

closes odoo/odoo#61265

X-original-commit: 1dd6199519b4ad5b5b17dfa17965ededcecb6da4
Related: odoo/enterprise#14563
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-11-03 13:23:08 +00:00
oco-odoo 84c14fde05 [IMP] account: better handling of journal codes when duplicating
Before that, even though the code contained something about it, the duplication of account.journal objects handled their code field pretty poorly (as it was trimmed to 5 characters), leading to situations where journals could have the same code, leading to possibility for account moves to have the same name.

This commit improves the SQL constraint testing journal codes so that they  must now be unique per company. We also recompute the code in a more advanced way so that journal duplications works as smoothly as possible.

Task 2346404

closes odoo/odoo#59791

Related: odoo/enterprise#14447
Related: odoo/upgrade#1880
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-11-02 15:46:15 +00:00
oco-odoo 8b3f14087a [IMP] account: improve tests for taxes made on misc operations
- Some tax_base_amounts checks were missing
- The type of repartition used to generate tax lines was not tested; it made the test confusing (as in this case, sales taxes invert their tag, given here the impression the wrong repartition was used, and potentially shadowing a bug)

closes odoo/odoo#60966

X-original-commit: c703b3a2f5a2d4d8bfbf0bc14203dde1b1bdec23
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-29 11:06:08 +00:00
oco-odoo f1f3366bc0 [FIX] account, hr_expense: show correct sign for tax_base_amounts of misc operations' lines
Before this, misc operations always used the balance of the base line as the tax_base_amount of the tax line. This was inconsistent with the invoices, for which we invert its sign when making a sale invoice or a purchase refund (as for those operations, positive amounts are put in credit). This commit should make everything behave in the same way.

closes odoo/odoo#60912

X-original-commit: 2ca3158ce2de596526067dbd86da2ef7d4ae85bd
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-28 14:56:20 +00:00
wan c514e54b9d [FIX] account: analytic default + add test
* Analytic defaults keep their old value
* The date_maturity is non-sense, it isn't set on lines needing analytic
* Analytic default should work for misc. operations too, but only for
  product/service lines on invoice documents.

closes odoo/odoo#60904

X-original-commit: 4d2b8dd1bef40c592215728fab6c31f192176e93
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-10-28 14:08:02 +00:00
Laurent Smet 422d5d3e09 [FIX] account: Fix useless test introduced by https://github.com/odoo/odoo/pull/60614
closes odoo/odoo#60766

X-original-commit: bba6f1989bedf8799e93f676e872628f884a5f4b
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-26 17:03:07 +00:00
Laurent Smet 1738273e4a [FIX] account: Fix unbalanced journal entry when switching payment terms
When switching immediate payment term to 30% advance then back to immediate payment term, the receivable line is back to its previous value.
This is due to the '_get_fields_onchange_balance' that is not updating correctly the business fields since price_subtotal == amount_currency.
So, when `writing`, debit/credit are removed from the dictionary because the values are the same as before. However, `price_unit` hasn't be updated with the new value and remains as its previous value.
It leads to a recomputation of accounting fields regarding the business fields and then, trigger the unbalanced journal entry.

closes odoo/odoo#60654

X-original-commit: 18b5ad16a442404061b1028c2ffd82f179beaba3
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-10-23 15:51:28 +00:00
Nicolas Galler 6c74444c96 [FIX] account: use commercial partner id for auto computed lines
Behavior before the fix:

- if you create a sales order for a customer invoice address (a child
partner record), then create the invoice for that order, the partner_id
is not consistent between the move_line (some get the child partner id,
some get the commercial partner id = the parent partner id)
- if you create the invoice directly from the accounting app for a
child partner, the commercial partner id is used consistently for all
move lines (the invoice itself keeps the child partner id)

Behavior after the fix:

- when an invoice is created from a sales order, the partner id is set
using the commercial partner id, consistently for all lines (in this way
the behavior is consistent with that of the accounting app)

It is more appropriate to use the commercial_partner_id for this purpose
as it is used pretty consistently in the account_move file

opw-2347878

closes odoo/odoo#60302

X-original-commit: cd299518ae45f2732d47788869b013be16b814e8
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Signed-off-by: Nicolas Galler <nicocrm@users.noreply.github.com>
2020-10-19 15:57:20 +00:00
Laurent Smet f646b11c8d [IMP] account: Refactor ugly test introduced by https://github.com/odoo/odoo/pull/58881
All tests must use the generic sandboxed setup and must absolutely not depends of demo data.
In this case, creating a new rate is far less hacky.

[IMP] account: Fix ugly test introduced by https://github.com/odoo/odoo/pull/58798

All tests must use the generic sandboxed setup and must absolutely not depends of demo data.

forwart-port of: https://github.com/odoo/odoo/pull/59749

closes odoo/odoo#60253

X-original-commit: d577d2b53fcfdfa478d0b054768df1bcb1bf3715
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-19 10:50:13 +00:00
Nicolas Martinelli 3319803a93 [FIX] account: wrong rounding with multi-currency
- Create a tax:
  5%
  Included in price
- Set the company currency to USD
- Set the currency rounding of CHF to 0.05
- Set the rate for CHF to 0.654065014
- Create the following invoice in CHF:
  Set a payment term
  Prod 1, 1 unit,  5.0 CHF, tax 5%
  Prod 2, 1 unit, 10.0 CHF, tax 5%
  Prod 3, 1 unit, 50.0 CHF, tax 5%

It is not possible to save the invoice because of an unbalanced journal
entry.

Indeed, the Receivable line is $99.30 while it should be $99.29. This
happens because we round the `total_balance` with the rounding precision
of the invoice currency while it is in the company currency.

closes odoo/odoo#58798

closes odoo/odoo#60035

X-original-commit: dad5e2a575448b68cc1b59880fecfe48dbe30a4e
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-14 17:24:32 +00:00
Nicolas Martinelli fa60131f9c [FIX] account: wrong computation with currency rounding 0.05
- Create a tax:
  5%
  Included in price
- Set the currency rounding of the company to 0.05 (e.g. CHF)
- Create the following invoice
  Prod 1, 1 unit,  5.0 CHF, tax 5%
  Prod 2, 1 unit, 10.0 CHF, tax 5%
  Prod 3, 1 unit, 50.0 CHF, tax 5%

The total amount of the invoice is 64.95 CHF instead of 65.00 CHF, even
in a 'Round per line' configuration.

It happens because `compute_all` rounds the amounts following the number
of digits of the currency instead of using the `rounding` field.

Note that there is a discrepancy between the POS computation and the
Account computation: the POS already uses the `rounding` field instead
of the number of digits:

https://github.com/odoo/odoo/blob/80073c5430f0ab562dfc27572c108114161ebb25/addons/point_of_sale/static/src/js/models.js#L1855-L1991

opw-2341566

X-original-commit: 94353ebd6b47a286157f0559b194ff03ea49ff68
2020-10-14 17:24:31 +00:00
oco-odoo 270716c8a2 [FIX] account: tests: remove the default taxes from the invoices created by init_invoice helper
closes odoo/odoo#59798

X-original-commit: f3bb7e12823d13967b32a1f762c3589e5c7aa26c
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-10-13 12:02:11 +00:00
oco-odoo 00504fe7e7 [FIX] account: cash basis taxis: allow full reconciliation of tax lines on cash basis final account without full payment of the invoice
To reproduce the issue before this fix:

1. Create accounts ACC TAX A, ACC TAX B, with reconcile = True, internal_type = other

2. Create Tax B, with tax_exigibilty = on_payment and account_id = ACC TAX B and cash_basic_account_id = ACC TAX A, 20%

3. Create invoice B, account_id = Tax B, unit_price = 1000, Valide invoice,

4. Register a payment of 600 for invoice B (so, that's half the invoice, when including the taxes). The cash basis tax creates a miscellaneous operation MISC A, containing a line on ACC TAX A.

5. Create a mis operation MISC TVA, like this:
line 1 : account_id = ACC TAX A, credit = 100
line 2 : account_id = 401100, debit = 100

6. Reconcile the following move lines:
line of MISC A with account ACC TAX A (100)
line of MISC TVA with account ACC TAX A (100)

==> The lines should be fully reconciled

To solve that without breaking the fix made here https://github.com/odoo/odoo/commit/c43acc34b873dc70cf792675fe1d58d8b0e116b1 , we rely on the tax_exigible field of account move lines. When all the reconcile lines are exigible, it means we're not reconciling the transition line of a cash basis entry, and so we can directly full reconcile.

Fixes https://github.com/odoo/odoo/issues/58996
OPW 2350494

X-original-commit: b8ab3c78ff9354091f5154bb03a716c32a609de2
2020-10-13 12:02:11 +00:00
IEL f1da6f61e1 [FIX] account: call tearDownClass explicitly
It's needed only on using skipTest in SavepointCase.setUpClass.

From docs https://docs.python.org/3/library/unittest.html#unittest-skipping:

> Skipped classes will not have setUpClass() or tearDownClass() run.

This may lead to running out of available sql connections. It mostly happens in
odoo.sh, which has max connections set to 16, while default value is 64

Fixes #56636
opw-2345762

closes odoo/odoo#59388

X-original-commit: b7f922050217634cdf85d15cae62b78fa3ce1834
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-07 10:50:56 +00:00
Nicolas Galler 91bd2b8c38 [FIX] account: avoid multiplying rounding error on unit price.
Do not round the unit price when calculating the company currency price
used to calculate the tax.  This avoids rounding errors when the company
currency amount has been calculated based on a converted (and rounded) unit
price.

Corrects a regression bug introduced in 13.0.  The behavior has been
corrected in 14.0 by a more extensive rework of the accounting module
(commit id 419d4bbee0 among others).
This fix seeks to correct the bug with minimal impact.

In version 12.0, the tax amount was calculated strictly based on the
total amount, which avoided compounding the rounding issue but had some
other problems (see https://github.com/odoo/odoo/issues/35358).

In version 14.0, the problem does not exist.  This commit only includes
the unit test.

Current behavior before PR:

For example: 20000 @ 2.82 with a rate of 1.1726 gives a
tax amount in foreign currency of 11844, which is 10100 in company
currency.  But if the company currency amount is calculated
based on a unit price of 2.4 (rounded converted amount of 2.82), the
calculated tax amount will only be 10080 in company currency.

Desired behavior after PR is merged:

Tax amount is calculated based on the total amount in the foreign
currency, not the amount based on the rounded unit price.

opw-2340933

closes odoo/odoo#59365

X-original-commit: 14c86a020429dfc6b545b65b89cbc7e3828dc557
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Nicolas Galler <nicocrm@users.noreply.github.com>
2020-10-07 09:41:50 +00:00
fw-bot dd2ac143f7 [FIX] account: cash basis taxes: set move lines as tax_exigible=False only when some other line has a payable or receivable account in the move.
Before that, making a misc operation with cash basis taxes always set the move lines as tax_exigible=False (or at least, it was supposed to, see below). This was wrong, as if the move did not contain any payable/receivable account, it would result in no cash basis move being ever created, and so the entry would never affect the tax report.

Additionnally, the tax line was wrongly managed for cash basis taxes on misc entries, as vals.get('tax_ids') returned an ORM command, so a non-False value, even when the tax_ids field was empty. this caused the condition to execute and to reassign taxes to an empty list, which then caused tax_exigible not to be set to False, even when it should.

X-original-commit: https://github.com/odoo/odoo/commit/2437eb0691d07f92094152b84c96a2149c8f4fd8

[FIX] account: make tax exigible correct in cases where the move lines are created separetely from the move.

Additional fix on top of https://github.com/odoo/odoo/commit/02fe997932070cc101a96eb869023702c224318b

Also, add tax_exigible to the form view of account.move.line, as it will not be computed automatically anymore when modifying a single line in draft state through its form view. It now needs to be manually changed in case the user wants to change something having an impact on it through this form (note that this is absolutely not a typical use case).

closes odoo/odoo#58260

X-original-commit: 867797e4983b704599be7943490fc6f071d8c0b7
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-09-22 16:00:14 +00:00
wan 34ea8f97ae [FIX] account: concurency in sequence.mixin
The SELECT FOR UPDATE clause stopped concurent executions but did not
prevent from writing on other rows.
By doing a real UPDATE, we now have the desired behaviour with a
SerializationFailure error.

closes odoo/odoo#58118

X-original-commit: ba6ee0b75d66d6f22a592b1b6a7c5158461bec41
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-09-21 11:22:38 +00:00
fw-bot df5dde330c [FIX] account: allow full reconciliation for tax lines on entries mixing cash basis and regular taxes
Solves https://github.com/odoo/odoo/issues/56803

Use case:

1) Create accounts ACC TAX A, ACC TAX B, with reconcile = True, internal_type = other

2) Create Tax A, with tax_exigibilty = on_invoice and account_id = ACC TAX A, 20%

3) Create Tax B, with tax_exigibilty = on_payment and account_id = ACC TAX B and cash_basic_account_id = ACC TAX A, 20%

4) Create invoice A, account_id = Tax A, unit_price = 1000, Valide invoice

5) Create invoice B, account_id = Tax B, unit_price = 500, Valide invoice,

6) Register full payment for invoice B. The cash basis tax creates a miscellaneous operation MISC A, containing a line on ACC TAX A.

7) Create a mis operation MISC TVA, like this:
line 1 : account_id = ACC TAX A, credit = 300
line 2 : account_id = 401100, debit = 300

8) Reconcile the following move lines:
line of MISC A with account ACC TAX A (300)
line of invoice A with account ACC TAX A (200)
line of MISC TVA with account ACC TAX A (100)

==> When doing that, not full reconcile object was created between the reconciled lines, while it should have been.

X-original-commit: ff35a49

[IMP] account: reintroduce a test that should have been forward-ported …

This test was made together with a bugfix by https://github.com/odoo/odoo/pull/51529 . The fix did not need to be forward-ported to 13.0, but the test should have been, so that we are sure it does not break again in the future.

closes odoo/odoo#58072

X-original-commit: 5d00592f7d803888d8d5befd5a8cd1b096067860
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-09-18 17:34:46 +00:00
wan 231e562945 [FIX] account: readd after_invoice_month in payment terms
opw-2253532

It was removed in saas-12.2 to simplify the model as it was judged
useless, but it wasnt.

closes odoo/odoo#57747

X-original-commit: 33a65b9e51c602621eb037c2eb8a796029114cd0
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-09-15 13:20:28 +00:00
oco-odoo a22e7e4c85 [FIX] account: reconcile models: inject selected partner and write-off details in the values sent to the widget
Before that, write-off rules with partner mapping did not work properly, as the partner they selected got lost when passing the values to the widget, which later made a second rpc call to fetch the write-off details. Now, we pass all the values directly, including the selected partner. This way, we remove the need for a second rpc call when processing the results for the reconcile models, and the partner is handled properly.

X-original-commit: d74db80d11e603719eefa5799ac1f8ac2afa2540
2020-09-09 13:15:56 +00:00
wan 68eb3a988a [FIX] account: saas-13.5 release fixes
Task 2327599

* The date is not copied on duplicate of account.move
* Do not throw traceback if we remove the invoice date of an
  invoice/bill
* Add extra triggers in account_tour to ensure it is done in the right
  view
* Update the position of some tour indicators
* Move the Product Categories in the Management menu
* The accounting onboarding is only visible on customer invoices list
  view
* Switch the position of banc and bic

closes odoo/odoo#57420

Related: odoo/enterprise#13122
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-09-10 12:32:29 +00:00
Laurent Smet ca815e9a10 [FIX] account,stock_account: Fix bad bug fixes
https://github.com/odoo/odoo/commit/5309c252f6d0bc4994265a4c39259b70e7507fb1

This fix isn't working when using the 'modify' refund_method.
Also, you can't change the behavior of the whole invoices when there is only one move dealing with the auto_post feature.

https://github.com/odoo/odoo/commit/c9cd83e538a0be9d626d7587c465924146327cb2

This fix is only fixing the reversal wizard but must be done everytime a journal entry is duplicated.

closes odoo/odoo#56904

X-original-commit: 3057ee6cdd63c0adb5037041492427268b5e7549
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-09-02 07:25:57 +00:00
wan aaf0b65448 [IMP] account: improve perf of sequencing account.move
The peformances were bad when posting a lot of moves at the same time.
This is because a SQL query was executed for each document to retrieve
the last sequence used to build the new one.

By batching the documents to sequence, we can reduce drasticaly the
number of SQL queries done.

X-original-commit: ff26e093c98a5b933620642e242530a8931c1471
2020-09-01 09:11:01 +00:00
william d1391314d9 [FIX] account: name of invoices sent by mail
The name set by the mail gateway was the title of the mail. The name
should be set with the journal sequence when posting instead.
This behavior was broken by 5d24244f417cb8f221f8d418663f4544adcd5613

closes odoo/odoo#56065

Related: odoo/enterprise#12492
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-08-25 08:54:11 +00:00
wan 4cf9fa928e [IMP] account: redo the tour
The tour has been updated
Task 2306134

closes odoo/odoo#55624

Related: odoo/enterprise#12378
Related: odoo/upgrade#1659
Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2020-08-19 16:04:01 +00:00
Benjamin Frantzen (bfr) 013936261b [IMP] account_edi: added flows to manage web-services and payments.
Added edi.documents representing an electronic document for a move and an edi.format.
A format can be asynchronous if it needs to call a web-service to generate the document, it will then be generated by the CRON (otherwise it's generated in post).
The formats can support payments if needed (can be generated immediately or by the CRON).
Added support for errors and related views.
Setting defaults format on a journal can be done automatically (based on a hook).
Added tests : xml comparaison with diff and helpers to test a EDI import/export

--task: 2247368
2020-08-17 10:22:01 +00:00
Xavier Morel dccbf425a1 [FIX] core: ensure we create a new session for each tour
The browser itself would get mostly cleaned up between tours, but the
session object would not get cleaned, and apparently in some cases
that could lead to an incoherent session: a tour would add data to the
session which the next tour (logging in as a different user) would
not (fully) override, leading to a session inconsistency and a Session
Expired exception during the tour.

Fix by not storing the session on the test object, the session is
created during authentication then set on the opener & browser.
2020-08-14 21:20:47 +00:00
william 98b64be59f [IMP] account: misc improvements of reconciliation models
Task 2292368
Bundle
https://runbot.odoo.com/runbot/bundle/master-reconcile-model-boost-wan-60105

* Search in Notes and References, not only in the statement's
communication.
* Activate the partner mapping for Suggest Counterpart models
* Always show the Amount Matching field
* Do not block the deletion of models with a partner mapping
* Allow to archive models
* Add a button to get back to Processing state from Validated state on
bank statements.

closes odoo/odoo#55031

Related: odoo/upgrade#1619
Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2020-08-13 13:10:33 +00:00
Nicolas (vin) 7354da6923 [IMP] account: Accounts m2o behavior
There are inconsistencies in the m2o accounts create & edit behavior.
New off-balance account type was not correctly filtered

This change correct those two issues

Task ID: #2288757

closes odoo/odoo#54626

Related: odoo/enterprise#11920
Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2020-08-13 08:56:53 +00:00
Laurent Smet 419d4bbee0 [IMP] account, *: Required currency on journal items
closes odoo/odoo#50711

Task: 1930680
Related: odoo/enterprise#10394
Related: odoo/upgrade#1147
Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
2020-08-13 11:48:06 +00:00
Nicolas Martinelli ebac669b2e [FIX] account: tax rounding error
- Create Tax 0:
  Percentage
  Amount: 0
  Tax Included
  Tax Group 0
- Create Tax 8:
  Percentage
  Amount: 8
  Tax Included
  Tax Group 8
- Create a customer invoice with one line
  Quantity: 8.0
  Price Unit: 15.55
  Taxes: Tax 8, Tax 0 (order is important)

The tax amounts are:
  Tax 8: 9.22
  Tax 0: -0.01

If the taxes are inverted, the tax amounts
  Tax 8: 9.21
  Tax 0: 0.00

The difference is due to the rounding of the 8% tax done differently. In
the second case, the computation of the 8% tax goes through:

https://github.com/odoo/odoo/blob/8c5cd335a57c20ed5faa6b7c7630c296c1f2a5cf/addons/account/models/account.py#L1480

In the first case, the amount is recomputed in:

https://github.com/odoo/odoo/blob/8c5cd335a57c20ed5faa6b7c7630c296c1f2a5cf/addons/account/models/account.py#L1483

The rounding is different in both cases, leading to an inconsistency.

When the tax amount is zero, there is no need to save the amount in
`total_included_checkpoints`.

opw-2306676

closes odoo/odoo#55812

X-original-commit: e2776e188070221ef465a864bd2cb8dcfc971e14
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2020-08-12 13:42:20 +00:00
Nicolas (vin) 41f119d532 [IMP] account: Misc. improvements
Miscellaneous changes aiming to improve the user experience in the accounting module,
mainly in the journal model and its form view.

Also aim to improve the bank account creation wizard.

Task ID: #2250349

closes odoo/odoo#54494

Related: odoo/upgrade#1546
Related: odoo/enterprise#11862
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-08-11 12:41:13 +00:00
Florian Gilbert 2720cf570c [IMP] account: Change Validation error to redirect warning for lock date
Change ValidationError to RedirectWarning, RedirectWarning is usefull to redirect user to
the problem. For the lock date, we can redirect user to unposted entries or unreconciled bank statement lines.

Task ID: 2297407
2020-08-07 06:59:25 +00:00
wan b13f40c83e [FIX] account: use context_today instead of today
The problem of using fields.Date.today() instead of
fields.Date.context_today() arose with the recent changes in the
account.move._post() method used in the POS tests, around 1 am.

This commit changes all occurences of today to context_today.

closes odoo/odoo#55511

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-08-06 10:07:28 +00:00
Laurent Smet d6141b0777 [REF] account: Make 'test_portal_attachment' independant to any demo data
--task: 2290120

closes odoo/odoo#55091

Related: odoo/enterprise#12083
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-08-06 11:22:13 +00:00
Laurent Smet e2f81f182d [REF] account: Make the render report tour independant to any demo data
--task: 2290120
2020-08-06 11:22:06 +00:00
Laurent Smet 34d53ebc87 [REF] account: Add generic 'AccountTestInvoicingHttpCommon' class
Thanks to this setup, we will be able to run the tours independently to any demo data.
To do so, the HttpSavepointCase is born to do the same as HttpCase but with a setUpClass.

--task: 2290120
2020-08-06 11:20:27 +00:00
william 0809601d6d [IMP] account: do not pollute test_reconciliation with unlink log
By deleting the res.currency.rate in the setUpClass, we do not pollute
the log with the unlink info, and the test is a little bit faster.

closes odoo/odoo#48651

Related: odoo/upgrade#1502
Related: odoo/enterprise#9559
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-08-05 11:57:10 +00:00
william 0ea9254c81 [IMP] account: fusion wizards for automatic entries
Task 2227389

The wizards for creating Accrual Entries and Transfer Entries are quite
similar. We are merging them as they share code and business logic.

Entries in the future should not be posted for both wizards, but set to
be auto posted instead.
2020-08-05 11:57:10 +00:00
william 82dc0cb7b9 [IMP] account: soft post entries in the future
Add an easy way to not post the entries in the future when calling
post() on it, but rather set it to be auto-posted at accounting date.
This is useful when we are creating a lot of entries in batch and some
might be in the future, some in the past, and we don't want to separate
that in two batch every time. (asset, accrual, transfer,... )
2020-08-05 11:57:10 +00:00
Laurent Smet 45c9dc8e38 [FIX] account: Fix counterpart account for cash difference
The cash difference line created on a statement using a cash journal should use the loss/profit account.
Then, the line is supposed to be marked as reconciled and then, doesn't appear in the bank reconciliation report.

closes odoo/odoo#55336

X-original-commit: 60e32447cc3fda3650aa718cb0996d29976005d4
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-08-04 06:54:45 +00:00
william 75d4ffc83b [FIX] account: update the sequence when we change the date
The first Journal Entry of a tuple (period, journal) has a name set by
default so that the user can change it before posting.
If we changed the date after the name has been given, it never changed
anymore; meaning the number could not be of the same period as the date
of the Journal Entry.
We now always reset the name to the default one if the name has to be
recomputed (change of date/journal)

closes odoo/odoo#55321

X-original-commit: 0c5d71aab8eefb57116a5b93b4c67222a080ddec
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-08-03 12:11:32 +00:00
Laurent Smet 0ca24b9af1 [FIX] account: Fix register payment with mark as fully paid on vendor bills
- Create a vendor bill with amount X
- Register payment of X - 5 and mark as fully paid
=> The vendor bill is not fully paid.

closes odoo/odoo#55271

X-original-commit: 5c729d4cb7dacc46409259850ed7a5620fd6eb64
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-07-31 15:17:53 +00:00
Laurent Smet 972ab11029 [IMP] account: Remove AccountTestCommon
l10n runbot builds are all failing when running at least one test depending of AccountTestCommon because it:
- doesn't create a sandboxed testing environnement to manage the multi-currency, multi-company, the default company's currency, the exchange rates...
- doesn't setup a testing user then all tests are done using the superuser.
- doesn't provide a fully setup chart of accounts: exchange difference journal is not set, accounts have bad types, etc...
- is run sometimes at-install.

--task: 2301180
2020-07-31 08:38:40 +00:00
Laurent Smet 6d1e1e09ea [IMP] sale*: Remove dependency to AccountTestCommon
l10n runbot builds are all failing when running at least one test depending of AccountTestCommon because it:
- doesn't create a sandboxed testing environnement to manage the multi-currency, multi-company, the default company's currency, the exchange rates...
- doesn't setup a testing user then all tests are done using the superuser.
- doesn't provide a fully setup chart of accounts: exchange difference journal is not set, accounts have bad types, etc...
- is run sometimes at-install.

--task: 2301180m
2020-07-31 08:38:30 +00:00
Laurent Smet 4d35dc3e96 [IMP] account: Remove AccountTestUsersCommon testing class
l10n runbot builds are all failing when running at least one test depending of AccountTestCommon because it:
- doesn't create a sandboxed testing environnement to manage the multi-currency, multi-company, the default company's currency, the exchange rates...
- doesn't setup a testing user then all tests are done using the superuser.
- doesn't provide a fully setup chart of accounts: exchange difference journal is not set, accounts have bad types, etc...
- is run sometimes at-install.

--task: 2301180
2020-07-31 07:11:33 +00:00
Laurent Smet 5bbd56aea4 [IMP] account: Remove test_control_journal_account dependency to AccountTestCommon
l10n runbot builds are all failing when running at least one test depending of AccountTestCommon because it:
- doesn't create a sandboxed testing environnement to manage the multi-currency, multi-company, the default company's currency, the exchange rates...
- doesn't setup a testing user then all tests are done using the superuser.
- doesn't provide a fully setup chart of accounts: exchange difference journal is not set, accounts have bad types, etc...
- is run sometimes at-install.

--task: 2301180
2020-07-31 07:11:32 +00:00
Nicolas Martinelli dcf1f48ee6 [FIX] account: prevent unlink item linked to posted entry
- Create a vendor bill, post it
- Go to Accounting > Accounting > Journals > Purchases
- Select the items linked to the vendor bill, delete

Nothing prevents from deleting the items while a posted entry cannot be
modified.

opw-2305873

closes odoo/odoo#55187

X-original-commit: 14ef02f73e649b5f8c50f09213f0a0dbddf46217
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-07-30 08:49:10 +00:00