Commit Graph
180 Commits
Author SHA1 Message Date
Nicolas Martinelli 3c4f853365 [FIX] account: aged partner report
Let's consider an aged partner balance with a period of 30 days as of
2019-02-08. The specific dates used in the report are:

``` python
bisou = datetime.strptime('2019-02-08', "%Y-%m-%d").date()
for x in [0, 1, 30, 31, 60, 61, 90, 91, 120, 121]:
    print(x, bisou + relativedelta(days=-x))

0   2019-02-08
1   2019-02-07
30  2019-01-09
31  2019-01-08
60  2018-12-10
61  2018-12-09
90  2018-11-10
91  2018-11-09
120 2018-10-11
121 2018-10-10
```

However, the current periods generated are incorrect:

```
{'name': '0-30', 'stop': '2019-02-08', 'start': '2019-01-09'}
{'name': '30-60', 'stop': '2019-01-08', 'start': '2018-12-09'}
{'name': '60-90', 'stop': '2018-12-08', 'start': '2018-11-08'}
{'name': '90-120', 'stop': '2018-11-07', 'start': '2018-10-08'}
{'name': '+120', 'stop': '2018-10-07', 'start': False}
```

There is a clear inconsistency between the name of the period and the
date used. Moreover, the name is misleading: 0-30 includes the -0 date,
while 30-60 doesn't include the -30 date.

After the fix, the name and the periods are consistent. We also change
the first period to 1-30 since including 0 would mean to include amounts
which are not due yet.

```
{'name': '1-30', 'stop': '2019-02-07', 'start': '2019-01-09'}
{'name': '31-60', 'stop': '2019-01-08', 'start': '2018-12-10'}
{'name': '61-90', 'stop': '2018-12-09', 'start': '2018-11-10'}
{'name': '91-120', 'stop': '2018-11-09', 'start': '2018-10-11'}
{'name': '+120', 'stop': '2018-10-10', 'start': False}
```

opw-1886633

closes odoo/odoo#27294
2018-10-10 15:21:24 +00:00
Xavier Morel 9f8eae34d1 [FIX] undefined variables (potential nameerror)
Backport 9ec0455abc and
6a601fe6dc as they fixed various
possible NameError but did so in later sub-releases.
2018-07-19 13:37:10 +02:00
Christophe Simonis 3656999f5e [MERGE] forward port branch saas-15 up to f0e280e5eb 2018-07-16 17:53:02 +02:00
Christophe Simonis f0e280e5eb [MERGE] forward port branch saas-14 up to ed99894ac6 2018-07-16 16:40:46 +02:00
Christophe Simonis ed99894ac6 [MERGE] forward port branch 10.0 up to 13e321325b 2018-07-16 16:25:59 +02:00
Lucas Perais (lpe) c8c5bc2c1b [FIX] account: test: prevent aged report to crash on july, 16th and after
Before this commit, the test aged report crashed on date Year/07/16 (and probably after, too) because:
- we create a partial reconcile today (create_date = Year/07/16)  when making the payment to the invoice
- the report date is set as Year/07/15, so, the partial reconciliation, if tested after that date, always appears in another period,
which is not the use case we test, hence the crash of the test

After this commit, we force the create date of the partial reconciliation to *before* the report is called,
thus, no error occurs

closes #25785
2018-07-16 15:22:05 +02:00
Christophe Simonis e354142ce7 [MERGE] forward port branch saas-15 up to c22e479246 2018-07-10 13:21:06 +02:00
Christophe Simonis c22e479246 [MERGE] forward port branch saas-14 up to 5d8076c842 2018-07-10 12:22:55 +02:00
Lucas Perais (lpe) 5fc392e34a [FIX] account: revert reconciled payment with exchange difference entry
Company is in USD
Do an invoice in EUR with a specific rate (and post it)
Do a payment on this invoice with another rate (and post it)

revert the payment's move

Before this commit, the move_lines of the original/reverted move pair were not reconciled
to one another
This could cause problems in some reports (aged reports for example)

After this commit, the lines in the original/revert move pair are reconciled
provided that they *can* be reconciled
Which is either belonging to a reconciliable account, or to an account of type liquidity

OPW 1861273
closes #25592
2018-07-09 10:07:36 +02:00
Lucas Perais (lpe) 42e74aae51 [FIX] account: revert reconciled payment with exchange difference entry
This is essentially a backport of 7544c22de9
and
4f40c9da7b

Company is in USD
Do an invoice in EUR with a specific rate (and post it)
Do a payment on this invoice with another rate (and post it)

revert the payment's move

Before this commit, the move_lines of the original/reverted move pair were not reconciled
to one another
This could cause problems in some reports (aged reports for example)

After this commit, the lines in the original/revert move pair are reconciled
provided that they *can* be reconciled
Which is either belonging to a reconciliable account, or to an account of type liquidity

OPW 1861273
closes #25600
2018-07-09 10:05:18 +02:00
Christophe Simonis bda926034a [MERGE] forward port branch saas-14 up to c9a01ab30a 2018-06-26 13:13:05 +02:00
Christophe Simonis c9a01ab30a [MERGE] forward port branch 10.0 up to 58c92d9374 2018-06-26 12:57:31 +02:00
Lucas Perais (lpe) 5de096dbf2 [FIX] account: aged balance shouldn't display fully reconciled on a period
Backport of 5f105d144d from v11.0

Commit 45c5a07d89 deals with displaying on the aged balance reports
the lines that zero out each other: an invoice and a payment of the same amount for the same partner
However, that commit overlooked that when there is a chain of reconciliation
that puts the report line to zero, it was displayed as well.

This present commit corrects this by making sure there are amls that detail the report lines

OPW 1857860

closes #25421
2018-06-22 13:23:59 +02:00
Lucas Perais (lpe) 5f105d144d [FIX] account: aged balance shouldn't display fully reconciled on a period
Commit 45c5a07d89 deals with displaying on the aged balance reports
the lines that zero out each other: an invoice and a payment of the same amount for the same partner
However, that commit overlooked that when there is a chain of reconciliation
that puts the report line to zero, it was displayed as well.

This present commit corrects this by making sure there are amls that detail the report lines

OPW 1858963

closes #25359
2018-06-21 09:36:58 +02:00
Christophe Simonis e7f0dffb6a [MERGE] forward port branch saas-15 up to c301122b5f 2018-06-05 15:10:45 +02:00
Christophe Simonis c301122b5f [MERGE] forward port branch saas-14 up to a002210d93 2018-06-05 12:00:11 +02:00
Christophe Simonis a002210d93 [MERGE] forward port branch 10.0 up to c25b68f324 2018-06-05 11:50:03 +02:00
Lucas Perais (lpe) 2039753ef4 [FIX] account: reconcile in liquidity accounts.
Make one Payment
Reverse the entry of this payment.

Before this commit, only the lines in the receivable were reconciled.
The lines in the liquidity were'nt, leaving the two entries appearing
in some reports

After this commit, the four lines are reconciled two by two, even in the liquidity
account

OPW 1816641
closes #25026
2018-06-05 09:47:28 +02:00
Christophe Simonis 97d611fcd4 [MERGE] forward port branch 9.0 up to 66a60c70f3 2018-06-04 18:06:44 +02:00
Laurent Smet fb59b56014 [FIX] account: fix test on closed period since account_lock module
Module account_lock has been introduced by:
https://github.com/odoo/odoo/commit/2eb344f23b3a9daa8e7c7ddaead145a8b05b39bf

A new constrains appears on the lock dates: their must not be set
after the last day of the previous month.
Then, it breaks the test on closed period that set the lock date 'yesterday'.
2018-05-31 13:13:14 +02:00
Christophe Simonis 810603f4ef [MERGE] forward port branch saas-14 up to 55ce6aff10 2018-05-02 14:49:58 +02:00
Christophe Simonis 55ce6aff10 [MERGE] forward port branch 10.0 up to 79bbd1dcb8 2018-05-02 13:52:12 +02:00
Nicolas Martinelli da27836f45 [FIX] account: unreconcile payment
- Company currency in EUR
- Create 2 rates for USD:
  1.0 on 2018-01-01
  0.5 on 2018-02-01
- Create an invoice on 2018-01-02 of 111 USD
- Register a payment on 2018-02-02 of 111 USD
- Unreconcile the payment

An error occurs: 'You are trying to reconcile some entries that are
already reconciled!'

In this specific case where the rate decreases, the exchange rate entry
is reconciled with the payment, so we need to keep the payment entries.
2018-04-26 08:37:33 +02:00
Nicolas Martinelli 32e7dfe0c4 [FIX] account: unreconcile payment
- Company currency in EUR
- Create 2 rates for USD:
  1.0 on 2018-01-01
  0.5 on 2018-02-01
- Create an invoice on 2018-01-02 of 111 USD
- Register a payment on 2018-02-02 of 111 USD
- Unreconcile the payment

An error occurs: 'You are trying to reconcile some entries that are
already reconciled!'

In this specific case where the rate decreases, the exchange rate entry
is reconciled with the payment, so we need to keep the payment entries.
2018-04-25 14:53:42 +02:00
Christophe Simonis e8f630e44d [MERGE] forward port branch saas-15 up to 7a45296cf1 2018-03-21 18:20:22 +01:00
Christophe Simonis 7a45296cf1 [MERGE] forward port branch saas-14 up to 78dced6bc2 2018-03-21 16:49:15 +01:00
Christophe Simonis 78dced6bc2 [MERGE] forward port branch 10.0 up to c2b3ad1899 2018-03-21 15:55:26 +01:00
Nicolas Martinelli 6d195ee603 [FIX] account: unreconcile payment
- Create a SO for a customer of 100 $
- Create Invoice for the Sales Order and Register the payment
- Create a Refund Invoice, Validate it and keep it in "Open" state
- Create a second SO for 5 $
- Create an invoice for this order and validate it
- It will show you outstanding payments
- Apply the credit and the invoice will be fulfilled => Now you have a
  credit left for 95 $
- Create a third Sales order for the same customer for 5 $
- Create an Invoice for it
- It will show you outstanding credit (95 $)
- Apply the credits
- Now 90 $ are left
- In the same invoice, the credit which you applied, Unreconcile it
- It should have shown you 95 $, but it shows you 100 $ which means it
  removed the credit which we applied to second SO

The unreconcile process does not filter the partial reconciliations of
the selected invoice. All partial reconciliations on the AML are
removed instead.

opw-1819602
2018-03-21 08:37:23 +01:00
Christophe Simonis d67b410dfc [MERGE] forward port branch saas-15 up to cb87388d72 2018-03-07 17:42:02 +01:00
Christophe Simonis cc86634b81 [MERGE] forward port branch saas-14 up to 5ddb3fdb0e 2018-03-06 14:19:32 +01:00
Christophe Simonis ac89023155 [MERGE] forward port branch 10.0 up to 5e6bb745e8 2018-03-06 12:28:30 +01:00
Christophe Simonis 2534bd19fb [MERGE] forward port branch 9.0 up to 6deed451ee 2018-03-05 18:50:51 +01:00
qdp-odoo 6deed451ee [FIX] account: fix the runbot after commit 0e881fcd3a
The previous commit forbids to change the currency of a company having accounting entries, but there are some created by demo data and some tests were trying to set a different currency (to set up a fix environment). So in order to allow that in tests, we do it via a SQL query directly
2018-03-05 17:39:10 +01:00
Goffin Simon 0da5d63f52 [FIX] account: Register a partial payment as fully paid
Due to this commit: 3267e76520

Steps to reproduce the bug:

When registering a payment for a customer invoice in an other currency than
the company currency and marking it as fully paid, it raised an error:
"Wrong credit or debit value in accounting entry !".

Reason: counterpart_aml['debit'] and counterpart_aml['credit'] were both incremented
and it violated the constraint credit*debit=0

opw:815465
2018-02-22 11:52:52 +01:00
Christophe Simonis b37cc1f9b7 [MERGE] forward port branch saas-16 up to a2ea4ba095 2017-12-12 18:39:43 +01:00
Christophe Simonis 0fd602ba34 [MERGE] forward port branch saas-15 up to 791e0cf47a 2017-12-11 09:17:53 +01:00
Christophe Simonis 791e0cf47a [MERGE] forward port branch saas-14 up to 9bd8a49820 2017-12-08 16:18:44 +01:00
Christophe Simonis 0fda9fba0b [MERGE] forward port branch 10.0 up to cd31e82689 2017-12-07 17:38:40 +01:00
Lucas Perais (lpe) bf119dcff6 [FIX] account: predicting receivable/payable on partner in tests
Before this commit, when a localization defined default payable or receivable
accounts on partners (like l10n_do does)
The reconciliation tests that involve an invoice on the one hand and a payment on the other hand
broke just because the accounts of the payment and the one of the invoice did not match

After this commit, we force the receivable or payable account to be the partner's (if available)
and the tests do not break
2017-12-06 17:18:45 +01:00
Christophe Simonis a094f6318b [MERGE] forward port branch saas-16 up to 745d00362a 2017-11-16 12:40:36 +01:00
Christophe Simonis 5877b7b38c [MERGE] forward port branch saas-15 up to 73e4dacf78 2017-11-15 15:50:36 +01:00
Christophe Simonis 0e1ac93e2d [MERGE] forward port branch saas-14 up to abfd662109 2017-11-13 15:03:56 +01:00
Christophe Simonis 5c304a6e71 [MERGE] forward port branch 10.0 up to ae2cbc7a01 2017-11-10 16:56:07 +01:00
Christophe Simonis ae2cbc7a01 [MERGE] forward port branch 9.0 up to ce818f1f8f 2017-11-10 15:43:49 +01:00
Laurent Smet ce818f1f8f [REVERT] account, point_of_sale: revert complex taxes computation
Reverts:
f85c8843c9
6c996723b2
455b5aaff8
c6a9bab074
6366150484
33d20a2241
47c0cfc6e7
6e46ba7b46
5afb5ecd04
2017-11-10 15:22:45 +01:00
Christophe Simonis 45958ab312 [MERGE] forward port branch saas-16 up to 5f9c3f51a8 2017-11-07 11:45:42 +01:00
Christophe Simonis 5f9c3f51a8 [MERGE] forward port branch saas-15 up to db4886d511 2017-11-07 11:01:14 +01:00
Christophe Simonis db4886d511 [MERGE] forward port branch saas-14 up to 928a284b11 2017-11-07 10:59:45 +01:00
Christophe Simonis 88c641e6dc [MERGE] forward port branch 10.0 up to 6c1c1f6e9e 2017-11-06 12:42:56 +01:00
Christophe Simonis bf102b4cbc [MERGE] forward port branch 9.0 up to 6c996723b2 2017-11-03 14:36:22 +01:00