Commit Graph

633 Commits

Author SHA1 Message Date
qdp-odoo 1e8d9e1c64 [REV] account: revert fix made on ea1eca2.
When an account.move.reconcile was unlinked, the reconcile_ref on the related move lines was no longer cleared.
2017-01-17 11:21:17 +01:00
Pedro M. Baeza ea1eca22d3 [FIX] account: Don't trigger twice the reconcile_ref compute method. Was PR #14892
Both store triggers on reconcile_ref are triggered by the same condition,
but seen on 2 tables different, but they always happen together, so no
need for both.

On regular Odoo, the only problem is the performance: the write operation
is performed twice, but on a system with connector or other parallelization
technology, this provokes lot of concurrency problems.
2017-01-17 10:48:56 +01:00
Goffin Simon ea021ff17a [FIX] account: taxes with analytic account
The account move line created for a tax must have the right account_analytic_id
according CONDITION.

CONDITION(inspired from function compute defined on model "account.invoice.tax")

if the tax is for an "in_invoice" or an "out_invoice" => tax_code = 'tax_code_id'
=> the account_analytic_id of the tax must be set to 'account_analytic_collected_id'

if the tax is for an "out_refund" or an "in_refund" => tax_code = 'ref_tax_code_id'
=> the account_analytic_id of the tax must be set to 'account_analytic_paid_id'

note:forward-port upto saas-6

opw:694821
2016-12-13 10:10:35 +01:00
Nicolas Martinelli cd440312ce [FIX] account: partial payment reconciliation
When processing a partial reconciliation in a foreign currency, a
currency exchange difference might be generated during the
reconciliation process (see OPW for a detailed use case).

This prevents the user to process the reconciliation since he will get
the error: 'You have to provide an account for the write off/exchange
difference entry.'

The fix is to use the company-related foreign echange gain and loss
accounts automatically to book this difference.

opw-687975
2016-11-25 10:21:01 +01:00
Alexandre Fayolle 65c685ad24 [FIX] context mutations (#10368)
when extending these methods with the new api, the context is a frozendict
so we need to copy before mutating.

this patch was made by searching for key addition to context and calls to the
update() method on the 8.0 addons, and checking if a copy was made before in
the method.
2016-10-12 12:30:42 +02:00
Stefan Rijnhart 4712fddd88 [FIX] account: never allow modification of posted entries
Posted moves are not protected from modification if the journal is set
to 'autopost'.

If an account move is posted in a journal with 'Autopost' set, it is
possible to modify the associated move lines without any restriction.
This can for example lead to the creation of unbalanced moves.

The original issue fixed by this extra condition
(https://bugs.launchpad.net/openobject-addons/+bug/615268) does not
occur if the commit is reverted.

This reverts 4e95e4223

Closes #12014
opw-683165
2016-07-25 15:50:47 +02:00
Goffin Simon 08416b2335 [FIX] account: partner_id set on a bank fee
Used case:

-Create several customer invoices and validate them
-Register a payment without any partner_id and in a bank statement for an amount
a bit lower than the total of the invoice (the difference is the paypal fees)
-Reconcile the invoices with the payment and create a write-off for the paypal fees
-When you close the bank statement, check the journal items, the paypal fees are
automatically assigned with a partner.

Fix:

-When creating the account move line for the fee, if all the account move lines
linked to the move are for different partners then you cannot determine the partner
of the fee.

opw:674822
2016-05-24 09:55:32 +02:00
Nicolas Seinlet f207ef5fae [IMP] account: improve reconciliation speed
- Only invalidate cache for fields and records we modify
 - Rewrite query to be more efficient
 - Avoid o2m commands to be more efficient; write directly on reverse m2o
2016-05-12 11:41:13 +02:00
Adrien Peiffer (ACSONE) e664d3074c [FIX] account: A negative amount with sale taxes on bank statement line must be considered as a refund. Courtesy of Adrien Peiffer (ACSONE). PR #11877 2016-05-04 11:31:20 +02:00
Adrien Peiffer (ACSONE) 600f884524 [FIX] account: Allow to select sale taxes in bank statement reconciliation process. Courtesy of adrienpeiffer. PR #11673 2016-04-22 15:25:10 +02:00
Denis Ledoux d8d1681a13 [FIX] account: check journal centralization performances
This revision is related to 99d8cd6

Avoid to check the journal centralization
mutliple times, for each move lines.
Checking the journal centralization
for each journal for each period just
before the call to `super` is enough.

Before this revision,
if a large number of move lines
was passed in the `ids` parameter
of the `write` method, with all
the same journal / period, this
could lead to huge performances issues,
the `_check_moves` being called
a large number of times for the same
journal and period couple, uselessly.

opw-672797
2016-03-23 18:48:59 +01:00
Nicolas Martinelli 7b7f3fa76a [FIX] account: filter out special periods
When computing the balance, debit and/or credit, the opening period must
be filtered out. Otherwise, the invoices which are still opened at the
time of the period closing will be counted twice.

opw-670584
2016-03-16 09:59:13 +01:00
Goffin Simon d96050d3e0 [FIX] account: view_header_get
In "Search Journal Items", for the the field 'journal_id', the name
of the current searched journal was written in the context with the key
'journal_id'. Then in the function "view_header_get", the 'journal_id'
was expected to be an id. This is why the key has been replaced in the
view as 'journal_name'.

opw:660591
2016-01-04 09:31:45 +01:00
Danimar Ribeiro 1ac94db8e8 [FIX] context to map_tax
Missing context to map_tax calls
Fixes #9909
2015-12-15 16:10:16 +01:00
Olivier Dony 2ae6481233 [FIX] account, crm, l10n_fr: avoid exceptions when processing parameters 2015-11-03 21:38:53 +01:00
Goffin Simon ddd2a3e97c [FIX] account: prepare_move_lines_for_reconciliation_widget
In the case where target_currency == company_currency, the actual_debit or the
actual_credit must be equal to the amount_residual defined on the account.move.line
and expressed in the currency of the company. The actual_debit/actual_credit must
take into account the possible partial reconciliations and this is done by the
residual amount.

opw:648744
2015-09-24 12:54:49 +02:00
Christophe Simonis 9654b54d3c [MERGE] forward port of branch saas-3 up to b15461b 2015-07-10 16:46:40 +02:00
Christophe Simonis b15461baba [MERGE] forward port of branch 7.0 up to 1d01872 2015-07-10 16:30:48 +02:00
Guewen Baconnier 4fe0c6bd60 [IMP] account: updated index to optimize _default_get of account.move.line
A log analysis showed that the normalized query below was executed very often
with a slow explain plan using a seq scan.

```sql

SELECT move_id, date
FROM account_move_line
WHERE journal_id = <journal_id>
AND period_id = <period_id>
AND create_uid = <user_id>
AND state = 'draft'
ORDER BY id DESC LIMIT 0;

```

This query is called in the _default_get of account.move.line to find the last
unbalanced move line.

The existing index can be improved to cover this query as well, showing an
impressive improvement of the explain plan as explained here:
https://github.com/odoo/odoo/pull/7430#issuecomment-119521031

Closes #7430
2015-07-08 13:56:20 +02:00
Nicolas Martinelli 589f1efd5d [FIX] account: user of the analytic line should be the salesperson of the invoice
Fixes #7259
opw-643262
2015-06-29 15:04:13 +02:00
Daniel Dico 6f60153e5d [IMP] account: useless records browsing
A variable "lines" is instancied few lines above,
with the exact same browse call, and there is no
operation that could lead to an update of the result
between these two browse calls.

Closes #1394
2015-06-26 15:56:17 +02:00
Julien Legros 1c0f0dd43c [FIX] account: multi currency reconciliation
When invoicing in currency A and being paid in currency B, the exchange
rate between those currencies might differ between the invoice date and
the payment date.

When reconciling, invoiced amounts should be converted using the invoice
date exchange rate.

opw-640248
2015-06-23 17:27:07 +02:00
Christophe Simonis e20dcda50d [MERGE] forward port of branch 7.0 up to 99c87b6 2015-05-21 16:33:45 +02:00
Olivier Dony 99c87b6273 [FIX] account: prevent crashes when mixing types in context parameters 2015-05-21 16:08:17 +02:00
Olivier Dony 96402a8f3a [FIX] account: prevent crashes when mixing types in context parameters 2015-05-21 16:02:58 +02:00
Christophe Simonis 327e471c9b [MERGE] forward port of branch saas-3 up to b62ee07 2015-05-21 14:19:24 +02:00
Christophe Simonis b62ee0734c [MERGE] forward port of branch 7.0 up to eaaca65 2015-05-21 14:11:39 +02:00
xmo-odoo 6de6662ecb Merge pull request #6789 from savoirfairelinux/7.0-fix_account_move_line_exception_translation
[FIX] incorrect translation marking
2015-05-21 10:14:40 +02:00
Joao Alfredo Gama Batista 2e123fbb85 [FIX] Fix exception translation 2015-05-20 11:22:25 -04:00
Denis Ledoux 9335fed9fe [FIX] account: debit/credit values for move lines in foreign currencies
When the target currency is the company currency, there
is no need to re-compute the debit/credit amounts of the move lines,
since these debit/credit values already contains the amount
of the move line within the company currency.

Avoiding the recomputation prevents gain/loss during currencies exchanges

opw-631748
opw-632133
opw-631895
2015-05-06 18:29:47 +02:00
Christophe Simonis 2492503dcc [MERGE] forward port of branch saas-3 up to 50665b4 2015-04-16 19:25:53 +02:00
Christophe Simonis 50665b499a [MERGE] forward port of branch 7.0 up to d0ef1b9 2015-04-16 19:13:56 +02:00
Martin Trigaux 884864c40f [FIX] account: do not show empty partners in manual reconciliation
When doing a manual reconciliation, the current filter could restrict the
visibility of move lines and show empty results for some partners (e.g. filter
the lists on only one partner will show empty list of moves for other partners).
This is also the case for multicompany restrictions.
Integrate the current filter to the search to only get results for displayed
lines.
Fixes #3817, opw 618134
Fixes #5221, opw 632095
2015-04-15 17:10:01 +02:00
Christophe Simonis d3e7a8ef5e [MERGE] forward port of branch 7.0 up to 856bc6f 2015-04-10 18:24:46 +02:00
Somesh Khare 39010d3856 [FIX] account: wrong amount for tax included
Backport of 8.0 code, rev f61339b
Create a new journal item with an tax included, the automatically created tax
line had the amount computed as tax excluded.
Fixes #3731, opw 618305
2015-04-10 12:17:52 +02:00
Christophe Simonis d780014248 [MERGE] forward port of branch saas-3 up to ce69064 2015-03-26 18:00:06 +01:00
Christophe Simonis ce690649e9 [MERGE] forward port of branch 7.0 up to 2a0c018 2015-03-26 17:56:05 +01:00
Nicolas Lempereur aaf9badbce [FIX] account: context/domain in move line tree
On a line write in a account.move.line tree view, the on_write return all the
sibling move lines of the written move line. The lines are then displayed even
if they do not match the current search domain.

This fix adds the context on the given on_write callback request, and in
on_create_write use a on_write_domain in this context to filter the returned ids.

fixes #3161, closes #5727

opw-630093
2015-03-26 08:59:23 +01:00
Christophe Simonis 416f0246ac [MERGE] forward port of branch saas-3 up to 4a3c471 2015-03-09 12:03:22 +01:00
Christophe Simonis 4a3c4713e9 [MERGE] forward port of branch 7.0 up to 209ce6f 2015-03-09 11:24:32 +01:00
Laetitia Gangloff f18304c0cd [IMP] account: Add auto_join on account move line
As the number of journal entries can grow quickly, domains such as
[('move_id.state', 'in', ['draft'])] will degrade very quickly.
Fixes #5573
2015-03-04 14:55:17 +01:00
Olivier Dony f55a6046a8 [FIX] account.move.line: no move revalidation for trivial changes
Many trivial changes to journal items, such as the
"blocked" flag for litigation (follow-up), do not affect
the balance of the whole entry. These should not cause
the account.move to be (re)validated.

For example it should be possible to change trivial
fields even on journal entries recorded in a closed
fiscal period.
2015-02-20 12:24:49 +01:00
Arthur Maniet 6c37747057 [FIX] account: don't create move lines that have neither an amount or a tax code
Fixes 51e9f90981
2015-02-20 06:07:56 +01:00
Arthur Maniet 51e9f90981 [FIX] account: avoid 0.0 tax lines
Don't create useless journal entries for taxes whose amount is 0.0.
Keep tax code lines creation unmodified.
Fixes #5036, opw 627055
2015-02-17 17:39:29 +05:30
Arthur Maniet 058a010456 [FIX] account: in bank statement reconciliation widget, make sure a move line 'ref' is an empty string if the field has no value
Fixes #5272
2015-02-17 11:30:34 +01:00
Denis Ledoux c9154e08aa [FIX] api: environment recomputation
In a workflow context (for instance, in the invoice workflow),
context is not passed.

Therefore, relying on the 'recompute' key being the context
in order to not recompute the fields does not work with Workflows.

It leads to huge performance issues,
as fields are recomputed recursively (instead of sequentially)
when several records are implied.
For instance, when reconciling several invoices with one payment
(100 invoices with 1 payment for instance),
records of each invoice are recomputed uselessly in each workflow call
(for each "confirm_paid" method done for each invoice).

With a significant number of invoices (100, for instance),
it even leads to a "Maximum recursion depth reached" errror.

closes #4905
2015-02-12 14:57:31 +01:00
Denis Ledoux ee8919af84 [MERGE] forward port of branch saas-3 up to fe8845a 2015-02-12 11:05:00 +01:00
Denis Ledoux fe8845ade6 [MERGE] forward port of branch 7.0 up to 0b5271e9 2015-02-12 11:04:36 +01:00
Denis Ledoux 0b5271e90d [FIX] account: always use a copy when altering a context
To avoid wrong context propagation
2015-02-12 11:03:54 +01:00
Martin Trigaux 16374dfa33 [FIX] account: error message not translated 2015-02-04 15:28:56 +01:00