Commit Graph
2900 Commits
Author SHA1 Message Date
Laurent Smet 66a98f8ed8 [FIX] account: Use only partner bank accounts of the payment company
closes odoo/odoo#65418

X-original-commit: 8ff165025e18a8d49a5666caac1747046ce87b6e
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-02-02 14:05:10 +00:00
John (jol) 634e707b16 [FIX] account: remove constraint on bank statement line amount = 0
A former constraint made it impossible to import bank statements with lines = 0.
The task #2403369 removed that constraint.
But the user could no longer reconcile Bank Statement Lines = 0.

Drawbacks :
- The user is then blocked when setting a lock date.
- The bank statement remains endlessly in Status Processing

A previous fix made a bank statement line = 0 immediately reconciled.

Closes task #2449127.

closes odoo/odoo#65359

X-original-commit: ee4f7df8d34593bdde3fc6f9bd062f6dad238fcb
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-02-01 16:08:26 +00:00
Nicolas (vin) 164c467c3d [IMP] account: Improve distinction between payment and bank statement
Increase the distinction between a journal entry linked to a bank
statement line and another one linked to a payment by adding a smart
button linked to them.

Also improve the navigation from the Bank And Cash view to directly
open the linked bank statement line or payment.

Task id #2448618

closes odoo/odoo#65316

Signed-off-by: William André (wan) <wan@odoo.com>
2021-02-01 16:58:25 +00:00
Laurent Smet 0a2d73e738 [FIX] account: Fix 'is_reconciled' flag for zero-amount statement line
When the suspense account is not reconcilable, 'suspense_lines.reconciled' always gives 'False' leading to a not reconciled statement line.

closes odoo/odoo#65290

X-original-commit: 73ddcfbcc58b7a6542ced4bd8b20dd67c9f446ee
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-29 16:13:12 +00:00
Laurent Smet 73d363866e [IMP] account,point_of_sale: Remove dead code
This code is no longer needed since:
https://github.com/odoo/odoo/commit/6576e1388e0a3d2a822a768c6c563769afb392a1

closes odoo/odoo#65272

Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-29 13:37:13 +00:00
Goffin Simon 23f1a57f63 [FIX] account: Selecting a journal from Journal entries
Steps to reproduce the bug:

- Go to Accounting (module)> Accounting (menu) > Journal Entries
- Create a new account move M
- Remove the default journal

Bug:

Impossible to set a journal

opw:2445553

closes odoo/odoo#65200

X-original-commit: cd1823a1066dd9a820afed8427e3a9abc2faade0
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-01-28 10:25:39 +00:00
Jalpesh Patel 66637644ea [FIX] account: typo for return default_account_id value
closes odoo/odoo#64739

X-original-commit: 5495808c6504b3c8a026be92e53bb62326a1164f
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-19 10:10:57 +00:00
bve 2ad912900e [IMP] account: warn msg decimal accuracy on modification
commit 31e1322b40 is allowing the
customer to increase is decimal accuracy for currency without
consequences but triggering issue upon lowering it if entries
already exist.
+ Remove the redirection to the support.

Let's ensure that the behavior is consistent and the users are
warned on first modification. To do so, adding an alert msg
in addition of the blocking message in case of lowering the decimal
accuracy after already creating accounting entries.

opw-2428857

closes odoo/odoo#64757

X-original-commit: 66533ebd88ed89c3baae6fdb1d0a28a458fa0cb9
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2021-01-19 15:50:17 +00:00
Nicolas Seinlet ea4e594b28 [FIX] account: restricted fields on notes
In 13.0, some account.move.line fields (amount_currency, debit, credit
and account_id) couldn't have a value when the line is of type 'note'.
Skiping them during line copy for notes is not an issue.

During 12.0->13.0 migration, we were facing issues with "grouped similar
invoice lines in a single move line", because this feature is not
available anymore in 13.0. To avoid any "loss of data" during migration,
we used lines of type note to create "missing" invoice lines in move
lines without altering accounting in any way. As a consequence, we have
13.0 databases with lines of type note having values for fields who
couldn't have ones.

closes odoo/odoo#64962

X-original-commit: 677edafeaf8d691764178f5e7e9639017b0249a8
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2021-01-22 17:12:07 +00:00
Andrea Grazioso (agr-odoo) e08e4826d7 [FIX] account: allow to skip account constraint
To fully allow f4e67d8ae174d7e2ee75a1de1083b31a6ff2af8b
we need also to disable to check on account when
the constraint field has been used to set the account on
the journal

opw-2394959

closes odoo/odoo#64792

X-original-commit: 655597e9a3637abbaeffddcc78663e8733070db4
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-20 12:14:56 +00:00
Wolfgang Taferner 03f14189cb [FIX] account/purchase: onchange on purchase create bill does not work
closes odoo/odoo#64777

X-original-commit: 0f36bbd257ba5e8e03462f675d81fdbdece1893a
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-20 08:42:21 +00:00
Nasreddin (bon) b86207a418 [FIX] account: Set memo to ref if not payment_reference
Issue

	- Install "Accounting" module
	- Create a new bill :
	- Set vendor
	- Set no payment reference
	- Set a bill reference
	- Add products to bill
	- Confirm and click on Register Payment

	Memo field has no value.

Cause

	The memo field is based on lines name.
	Lines name is computed in `_onchange_payment_reference`
	and depends only on payment_referecence.

Solution

	If no `payment_reference`, fallback on `ref` to set line name.

opw-2440389

closes odoo/odoo#64692

X-original-commit: 31bc04afc3ed4ea74cd20f71ea10943b1026629c
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-01-18 13:29:17 +00:00
Ivan Yelizariev 090b7f1153 [FIX] account: make group_id readonly
WHY: it's computed field that is not supposed to be editable. In previous task
it was asked to make it visible, not editable.

closes odoo/odoo#64676

X-original-commit: f7788fdf03bcf81710f5b01fbf67a90aa30e1e58
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-01-18 11:54:44 +00:00
oco-odoo 88b5491c2f [FIX] account: fix typo
closes odoo/odoo#64675

X-original-commit: 00d69cdaf755271d954c3102dfd49ddcdaae112b
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-18 11:53:13 +00:00
Laurent Smet 5af64d1758 [FIX] account: Fix statement line rounding issue multi-currency
When reconciling a statement line with multiple lines in a multi-currency environment, it could lead to a rounding issue due to the currency rates. It could lead to an auto-generated open-balance of 0.01 amount to auto-balance the journal entry but the result is wrong since the partner has an open amount left on the receivable/payable account.

closes odoo/odoo#64636

X-original-commit: 4d4e6e588d14742f153a1c6b67d510e0c21e5d64
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-15 17:21:20 +00:00
Florian Gilbert 4c51bd91bb [FIX] account: Support the context key "tracking_disable" for the tracking system of account.move.line
The tracking system causes some performances issues, this fix will allow to bypass the tracking for
heavy tasks.

closes odoo/odoo#64639

X-original-commit: e59aef66fb97da37b2fdcf282c7bd43c9beeedb9
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Florian Gilbert <FlorianGilbert@users.noreply.github.com>
2021-01-15 17:24:37 +00:00
oco-odoo e09fd75efd [FIX] account: correct tag inversion for lines of invoices with tags, but no tax
This use case can happen in case an invoice is imported without recreating all the taxes, only keeping the VAT information.

closes odoo/odoo#64638

X-original-commit: 7ad61842c703ceb031b2f917ad8bbc26d7d0b780
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-15 17:24:04 +00:00
Laurent Smet 68aa40de06 [IMP] account: introduce a new field on move lines to avoid inverting tax tags
The sign of tax tags sometimes could get inverted explicitly. It typically happened for misc operations, so :
    - manual entries
    - CABA entries
    - writeoffs created from the reconciliation widget

We had to do things this way in stable to fix those use cases, but it's not ideal, as the tags shown to the user were inverted, so it was a bit confusing, as one would have expected to see the exact same tags as on tax configuration.

We fix that by using a boolean field on account.move.line telling whether or not the sign must be inverted. This allows keeping the same tags as in the tax config, and simplifies the computation of the tax report's multiplicator, making the overall model more intuitive for both user and developper.

Task 2363287

closes #62536

closes odoo/odoo#64627

Related: odoo/enterprise#15031
Related: odoo/upgrade#1983
X-original-commit: 4e8581b6846ef8ee4601c994b0d586734a4fe117
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-15 15:40:16 +00:00
jbw 9408e0d9db [IMP] account: Improve the validation process thanks to the "to check" boolean
- keep track of to_check changes in chatter
- add "set as checked" button
- make the "to_check" field optional in list view
- vendor bill / customer invoice : remove "entry" from "cancel entry" button.

Task: 2389849
2021-01-15 14:45:59 +00:00
Nicolas (vin) 85f2c8b58a [IMP] account: Set accounting date to today when posting before lock date
When posting an account move before the tax lock date, Odoo will
automatically set its accounting date to the lock date + 1.

This can cause the chronology to be broken, which is not something we
want when automatically setting the date.

This will change that behavior to set the accounting date to today in
such case.

Task id #2411150

closes odoo/odoo#62787

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-14 14:22:37 +00:00
Paul Morelle 97c0a110e8 [FIX] account: fix regexp when partner name contains +
When the name of a partner contains a regular expression operator, such
as grouping parenthesis, +, *, brackets... the resulting regexp may
match wrong names or worse be invalid and lead to an exception.

With this commit, we create a regular expression from only the words
formed from at least 3 of [a-zA-Z0-9], ignoring all other characters,
including those who may have a meaning in a regular expression.

This avoids these issues:
- regexp injection (security issue)
- punctuation resulting in erroneous regular expression ("ABC + SPRL"
  resulted in "(?=.*ABC.*)(?=.*+.*)(?=.*SPRL.*)" which is invalid at
  the ".*+" part)
- false positives due to words that are too small (\b were added, and
  the minimal matching word size is 3)
- accentuation mismatch (both sides are filtered through unaccent)
- special cases in unicode that have a special behavior with lower().

See the discussion on odoo/odoo#63145 for a detailled explaination about
these issues.

OPW-2360687

closes odoo/odoo#64510

X-original-commit: 3c5296863f0030acc5d3dba0ff73a6f1b42d1255
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
2021-01-13 18:42:10 +00:00
oco-odoo b6616b0945 [FIX] account: reconciliation models: allow disabling bypass of matching amount check for more advanced cases
Reconciliation models can now create partial payment on invoices. Because of that, the default behavior is not anymore to fully pay the invoice and create an open balance write off.

In some cases, though, this is what we want (exchange difference, ...). The solution for that is to create a reconciliation model with write off lines (telling it it must only apply if there is a 90% percent match on the amount, for example), and then create another one not checking the amount to just match the things to reconcile partially by using the partner.

However, as it is now, reconciliation models always bypass the check made on the amount in case the statement line's label matches the invoice's payment reference exactly. This can lead to cases where we are matching elements we shouldn't with the rule doing the write off.

Example:

- use only two 'invoice matching' reconciliation models, in the following application sequence:
	- model 1, matching partner if with amount matching percentage is 90%, and doing a write-off for the unmatched amount
	- model 2, matching partner with no amount matching percentage, and no write off

- create an invoice with payment refrence INV1 for partner A, amount: 100

- create an invoice with payment refernce INV2 for partner A, amount: 200

- create a statement with two lines:
	- line 1, with 99 for partner A, label= INV1.
	- line 2, with 1 for partner A, label= INV2.

- Open the reconciliation widget

==> Before the fix:
model 1 is applied on both statement lines, as their label match payment references. This is what we want for line 1, but probably not for line 2, which will create a write off of 199, while we'd have wished for a partial payment, leaving the invoice with 199 open.

==> After the fix
The behavior is the same unless the config_parameter is set. If it is:
	- line 1 will be matched by model 1 (as 99 - 9,9 < 100 < 99 + 9,9). INV1 will be paid with a write off of 1.
	- line 2 will not be matched by model 1 (as 200 is not between 1 - 0,1 and 1 + 0,1), but it will be by model 2 (since line 2 and INV 2 share the same partner). So, INV2 will be partially reconciled with line 2.

OPW 2419030

closes odoo/odoo#64504

X-original-commit: ed023e208736e58d14649aa2fd91fb00510f20c1
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2021-01-13 16:19:49 +00:00
wan d9ab32fef8 [FIX] account: dashboard view cash statements
Fine tuning of 78286851034b8f3ef4dcab78e50b7220c0bdd213

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

closes #64118

closes odoo/odoo#64279

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

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

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

Bug:

Impossible to select the correct account.

opw-2394959

closes odoo/odoo#64288

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

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

Task 2423231

closes odoo/odoo#64253

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

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

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

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

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

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

This commit restores the expected behavior.
2021-01-08 11:09:48 +00:00
Andrea Grazioso (agr-odoo) afed9f0d80 [FIX] account: label for internal transfer
Create two differnt journals for two different bank accounts (A, B).
Create an Internal Transfer in bank A to send money, then reconcile.
Create an Internal Transfer in bank B to receive money, then try to
reconcile

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

opw-2423161

closes odoo/odoo#64258

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

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

closes odoo/odoo#64115

X-original-commit: 8d34e1606f930deaa148563ffd40c69457650305
Related: odoo/enterprise#15577
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-01-05 18:38:05 +00:00
Jorge Pinna Puissantandwilliam-andre 27a2701ff0 [FIX] account: new journal name sequence on old journal
- Create a new sales journal;
- Start creating a new invoice using the new journal (the name/sequence
    will be editable) and before saving, change the journal to the
    old one;

Before this commit, the invoice will be on the old journal and will have
the new journal name/sequence and after validate the invoice all the new
invoices on the old journal will have the new journal name/sequence.

Now, when you change to the old journal the name of the invoice came
back to 'Draft'.

opw-2415975

closes odoo/odoo#64146

X-original-commit: 3b64640076af472b64a72c7061696772d0e118de
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Co-authored-by: william-andre <wan@odoo.com>
2021-01-06 11:39:15 +00:00
Raphael Collet 664ac15b59 [FIX] account: flushing while recomputing fields is not a good idea
The Python constraint method `_check_unique_sequence_number` performs an
SQL query, and therefore needs to `flush()` the some fields before doing
so.  However, it uses a generic call to `flush()`.  In some situations,
the call to `flush()` ends up into recursive flushing, and that's the
beginning of a nightmare:
 - write on account.move.state,
 - which calls account.move._check_unique_sequence_number(),
 - which calls flush(),
 - which computes purchase.order.line.qty_invoiced,
 - which reads field purchase.order.line.invoice_lines,
 - which calls flush() for account.move.line.move_name,
 - which computes account.move.line.move_name,
 - which computes account.move.name,
 - which calls account.move._check_unique_sequence_number(),
 - which calls flush(),
 - which computes purchase.order.invoice_status,
 - which uses the not-yet-computed value of purchase.order.line.qty_invoiced,
   and computes an incorrect value.

We fix it simply by making the call to `flush()` more specific: we only
need to flush 4 fields.  This avoids the nightmare above.

X-original-commit: cf5f50a733ddfd87985a39ffe7daffc48cfb582f
2021-01-04 09:16:20 +00:00
shreya thakrar 3b63b3a4d7 [IMP] account: add kanban view for the 'Generated Documents'
This commits adds kanban view for the 'Generated Documents' for better
readability on mobile devices. Also, for consistency, this commit
adds 'Upload' button on the invoice kanban view as well.

Task-ID: 2152183
2020-12-29 13:39:37 +00:00
Adrien Dieudonne 04ed2dec6f [FIX] account: open form view when single invoice generated
Before this commit, there was no difference whether multiple invoices
were uploaded or not. The list view was always opened.

Now, the form view is automatically opened when a single bill
is uploaded.

Task-ID: 2152183
2020-12-29 13:32:55 +00:00
Wolfgang Taferner 1e6dce9d4e [FIX] account: onchange of product and uom should not use currency rounding
As the price_unit and the uom rounding can be more detailed than the currency/accounting rounding (2 decimals as a standard) to cut the number before subtotal is wrong.

closes odoo/odoo#63817

X-original-commit: 1b4005f50ac45b53a73e0b95cfb661e8ccf040cd
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-12-28 10:21:46 +00:00
Adrien Widart 2f93435642 [FIX] account: cascade delete of reconcile lines
When deleting an `account_reconcile_model`, it does not delete the
corresponding `account_reconcile_model_line`. Moreover, this may prevent
the user from using the l10n_de_skr04 module.

To reproduce the error:
(Use demo data)
1. Go to Apps
2. Install "Germany SKR04 - Accounting"
3. Change the company
	- Select "DE03 Company"
4. Go to Settings > Invoicing > Fiscal Localization
5. Change the package
	- Select "Deutscher Kontenplan SKR04"
6. Save

=> A validation error is displayed: "The operation cannot be completed:
another model requires the record being deleted[...]".

When changing for SKR04, the module's installation first deletes some
models, among them: `account_reconcile_model` and later `account_tax`. The
validation error appears on `account_tax` deletion. Since version 14, an
`account_reconcile_model` is composed of `account_reconcile_model_line`
and the latter is linked to `account_tax` (with `ondelete='restrict'`).
Here is the issue: when deleting the `account_reconcile_model` model,
the corresponding lines are not deleted. As a result: later, when trying
to delete all the `account_tax`, since some `account_reconcile_model_line`
are still present in database, it triggers the `ondelete='restrict'`
constraint.

OPW-2416066

closes odoo/odoo#63649

X-original-commit: 8c9a038c6527f06b680d6346ba5569fedce4794d
Signed-off-by: adwid <adwid@users.noreply.github.com>
2020-12-21 14:42:49 +00:00
Alpesh Valaki 315a598fe5 [IMP] account: type on docstring
fix typo on docstring of _get_last_sequence method

closes odoo/odoo#63619

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-12-21 10:24:18 +00:00
Jigar Vaghela 29c82528d0 [FIX] account: correct management of groups of taxes on misc operations
Using group of taxes with type_tax_use='none' children messed up the sign of the tax_base_amount and line tags.

closes odoo/odoo#63479

X-original-commit: 3642c429899c4d5def27c9ba10ae76c763a8a566
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-12-16 17:46:30 +00:00
wan 1023479af2 [FIX] account: compute used on account.account
The field is exportable but always returns false

opw-2409324

closes odoo/odoo#63340

X-original-commit: f5c1ba1556c7db2a882740c6572127b28d064b57
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-12-14 14:34:06 +00:00
Thomas (det) d0efcd8538 [FIX] account: Negative fixed taxes on 100% discount
This commit fix a previous fix : https://github.com/odoo/odoo/pull/62244

opw-23789781~[FIX] account: Negative fixed taxes on 100% discount

closes odoo/odoo#63349

X-original-commit: da6b1667ab3566a88765f38f812df6a20c0abb03
Signed-off-by: tdetry (det-odoo) <tdetry@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-12-14 16:13:00 +00:00
oco-odoo addd40a09f [FIX] account: reconciliation models: fix auto-reconciliation result when the reconciliation doesn't cover the whole invoice
Before that, using an auto-validate reconciliation model to match an invoice with a statement line with a lesser amount resulted in the creation of an payment entry with which the invoice got fully reconciled, and the difference amount was fowarded to the suspsense account in an additional line. This wasn't correct, as we expect the invoice to be only partially paid in that case (with an amount equal to the statement line's).

closes odoo/odoo#63303

X-original-commit: 7393aa3ebcea7b80762b729315f1c890bc677efb
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-12-14 10:16:22 +00:00
Swapnesh Shah 3e0d5e54f6 [FIX] addons: incorrect field help
Field's help doesn't match with field's Usage.

closes odoo/odoo#63249

X-original-commit: a48ba4672e90a7e9f3143de5ede0099a8e28d4cd
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-12-11 14:12:11 +00:00
Wolfgang Taferner ccdfa1498f [FIX] account: if the base_tags are empty, it won't be updated
If you have a move line which was having tag_ids before and you apply a new tax
which has no values defined and result in an empty list, the assignment does not work on a x2m field,
so we do offer the proper notation for such a use case.

Closes #62934

closes odoo/odoo#63176

X-original-commit: f7cbbe381950699f2aeb26c454a4a955ed3bf2b4
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-12-10 14:25:33 +00:00
Laurent Smet 79f98810b1 [IMP] account: Allow locking the period with cancelled statement lines
This case shouldn't appear in a normal usage of the statement lines because there is no way to cancel them.
However, this case should be supported in 14.0 due to a choice we made for the migration.
Indeed, we don't want to create draft journal entries in a locked period during the migration but the statement lines that are not reconciled in a locked period shouldn't be deleted in order to keep the statement starting/ending balance consistency.
So, the journal entries created in a locked period for not reconciled statement lines are cancelled and then, we don't want to block the locking of any period because of that.

closes odoo/odoo#63104

X-original-commit: b5e186124de69061e91f657e1a330ba019614256
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-12-09 15:13:24 +00:00
Florian Gilbert 61dad4d471 [FIX] account: check statement balance at each step
Previously, the check to see if a statement ending balance is the same as the computed balance was only done when moving from draft to posted which is wrong as people can modify the balance of posted statement programmatically which is the case when using online synchronization for example. Now perform that check at each change of state: draft->posted and posted->processed. Also the indication in the view to indicate that the balance was not the same was only displayed in draft, we removed that constraints as user should always see if there is a problem.

closes odoo/odoo#62879

X-original-commit: 69fc9b71e991983b5bcddc948ac4c3749e305a3f
Related: odoo/enterprise#15155
Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
Signed-off-by: Florian Gilbert <FlorianGilbert@users.noreply.github.com>
2020-12-04 12:02:14 +00:00
Adrian Torres 679185f3e8 [IMP] *: replace all raises inside unlink by api.ondelete
With this commit, all instances of errors being raised inside
`BaseModel.unlink` overrides are moved into methods decorated with
`api.ondelete` which is safer.
2020-12-04 09:16:16 +00:00
Laurent Smet 4f3ecc41c3 [FIX] account: Fix payment consistency with edited journal configuration
After a migration, if the payment is using the bank account instead of the oustanding one, we shouldn't block the user in any case when checking the payment consistency.
For example, when writing the matching number on a journal item will trigger the check consistency on the payment. So, you are unable to reconcile any journal items until you replace the account by the outstanding.

closes odoo/odoo#62842

X-original-commit: 28bc59e794f15bf4f7de31e24f496e707ba639dc
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-12-03 16:20:15 +00:00
Nasreddin (bon) eb0b664349 [FIX] account: Negative fixed taxes on 100% discount
Issue

	- Install 'Accounting' module
	- Create a new 'Tax' X with a fixed price (e.g.: O.O57 $)
	- Create a new 'Customer Invoice'
	- Add a product P and set unit price to 0 $
	- Set tax X to product P

	Total tax amount : - 0.06 $ .

Solution

	The sign must be forced to a negative sign in case the balance is on credit
	to avoid negatif taxes amount.

enterprise PR : https://github.com/odoo/enterprise/pull/15035

opw-2378978

closes odoo/odoo#62758

X-original-commit: 684855529e8aaafa0cb90f958d19c563d6e2a897
Related: odoo/enterprise#15105
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-12-02 15:51:55 +00:00
oco-odoo 6576e1388e [IMP] account: introduce a new field on move lines to avoid inverting tax tags
The sign of tax tags sometimes could get inverted explicitly. It typically happened for misc operations, so :
    - manual entries
    - CABA entries
    - writeoffs created from the reconciliation widget

We had to do things this way in stable to fix those use cases, but it's not ideal, as the tags shown to the user were inverted, so it was a bit confusing, as one would have expected to see the exact same tags as on tax configuration.

We fix that by using a boolean field on account.move.line telling whether or not the sign must be inverted. This allows keeping the same tags as in the tax config, and simplifies the computation of the tax report's multiplicator, making the overall model more intuitive for both user and developper.

Task 2363287

closes odoo/odoo#62536

Related: odoo/enterprise#15031
Related: odoo/upgrade#1983
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-12-01 12:40:44 +00:00
Nicolas Martinelli 8bde0c810c [FIX] account, stock_account: invoice in multi-currency
- Activate Anglo-Saxon accounting
- Set a foreign currency rate to 2.0
- Create a product A:
  Inventory Valuation: 'Automated'
  Costing Method: 'Standard Price'
  Cost: 10.0
  Public Price: 100.0
- Create an invoice in foreign currency
- Add 1 unit of A => the total amount is 200.0
- Confirm the invoice

The Amount Due is 100.0 instead of 200.0.

This happens because the Anglo-Saxon lines have the company currency,
while the other lines have the foreign currency. Because of this, the
`_compute_amount` method considers the move as multi-currency to compute
the various amount. However, the Anglo-Saxon lines should be neglected.

This happens from 14.0 because all lines have a currency. In previous
versions, lines in the company currency didn't have the `currency_id`
set.

opw-2390107

closes odoo/odoo#62657

X-original-commit: 9e1aec7873a935b287b4b3c5dbc2688acee5422a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-12-01 08:33:53 +00:00
wan cf182dec8c [FIX] account: allow to bypass sync of date/sequence before date
Databases that already have issues are not able to fix the issues
because it is impossible to reset the items to draft in order to change
the date/sequence. Or do anything else, really.
By allowing to bypass the constraint before a certain date, users can
now edit problematic documents.

Disabling the constraint will however make it possible to entirely
break the sequences; use it with the lowest possible date.

closes odoo/odoo#62663

X-original-commit: a35d7e646d7ac419d09d5f97b2886eddc9dee0e0
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
2020-12-01 09:21:42 +00:00
oco-odoo 89971a5ba5 [FIX] account: allow setting taxes on a miscellaneous journal entry
https://github.com/odoo/odoo/commit/1b273d4c11e3e8d8583de302b71b2522a71f4d1d added the 'general' value to invoice_filter_type_domain, neglecting that this field was used for filtering tax_ids field of account.move.line, and hence making it impossible to select any tax in that field when creating a misc. operation manually. This commit does what the initial fix intended without breaking the taxes.

closes odoo/odoo#62628

X-original-commit: fad10e505f8e2f0d64c97460144afe1be0ba808d
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-11-30 15:26:27 +00:00