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
closesodoo/odoo#27294
When paying an invoice in USD, using EUR as payment. The residual amount was shown in the payment currency instead of the original invoice residual currency.
closesodoo/odoo#26916
Steps to reproduce the bug:
- Create a contact without a parent company and set a country on it
- Link this contact to a parent company that has no country defined
- Create an invoice for the contact
- Go to Accounting / Reporting / Management / Invoicing, switch to Pivot view and group by country
=> the invoice for the contact is classified under "Undefined" even though it actually has a
country set when you go see the invoice
opw:1878819
Steps to reproduce:
Create a customer invoice with 2 product A and refund 1 product A.
Display account.invoice.report for this custumer.
Bug:
The quantity should be 1 not 3.
Fine tuning of this commit: e890682656
opw:1868116
Before this commit, the function that computes the aged partner balance
could return a list instead of a dict if no partner were found
After this commit, we make the function's signature consistent
closes#26095
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
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
amount_currency is a field that is expected in multi-currency
The general ledger report has a line
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/>
which crashes if amount_currency is None
opw-1859122
Replaces and closes#25240
Before that, partial payments on open invoices were ignored by the query, due to the fact we used checked "reconciled=false" instead of "full_reconcile_id is not null".
Before that, partial payments of invoices were not shown into the partner ledger unless the option to show reconciled entries was activated. This was due to the fact we checked full reconciliation with the field "reconciled" instead of the full_reconcile_id, so the query did not return the partial payments (which have reconciled=True, but don't have any full_reconcile_id unless the invoice is fully paid).
Make an invoice
Make a payment
Unreconcile them
Before this commit:
The invoice and the payment weren't display in the aged partner balance
After this commit:
Both payment and invoice *can* be included in the balance
OPW 1819359
- Create a customer invoice of 100, validate
- Refund the invoice
- Go to Accounting > Reports > Business Intelligence > Invoices
- A total of 200 is shown, while it should be 0.
- The same occurs with a vendor bill (-200 instead of 0)
The invoice lines have their sign modified at two places when used in
the report:
- in method `_compute_price` of `account.invoice.line`
- in method `_from` of `account.invoice.report`
The signs are computed with the following combination:
|Invoice type|`_compute_price`|`_from`|Report sign|
|------------|----------------|-------|-----------|
|out_invoice | +1| +1| +1|
|in_invoice | +1| -1| -1|
|out_refund | -1| -1| +1|
|in_refund | -1| +1| -1|
This is not correct: out_invoice and out_refund should have opposite
signs. Same applies to in_invoice and in_refund.
opw-772479
Closes#19954
Before this commit, the invoice analysis report summed the amount of invoices regardless of whether they were in or out,
as if it were an absolute sum.
This commit corrects the behavior back to v9's, where in_invoice have the minus sign and are hence subtracted
opw 769409. Was PR #19413
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.
All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.
Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.
Also removed some dead code or improved the API to remove unnecessary
conversions.