<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/account/models, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[FIX] account, mail: link attachments to invoice</title>
<updated>2021-05-31T07:21:02+00:00</updated>
<author>
<name>Adrien Widart</name>
<email>awt@odoo.com</email>
</author>
<published>2021-05-04T14:51:12+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=e6c69a8cf00cd858a45ebf321a190666322c0897'/>
<id>e6c69a8cf00cd858a45ebf321a190666322c0897</id>
<content type='text'>
When using the "Send &amp; Print" functionality, if the user adds an
attachment, the latter won't be linked to the record.

To reproduce the error:
1. Open a posted invoice
2. Send &amp; Print
3. Attach a file &gt; Select a file on your device
4. Send the email

Error: The invoice's PDF is added to record's attachments, but not the
other file (from step 3).

When the module selects the attachments that need to be linked to the
invoice, it only keeps the ones currently linked to `mail.compose.message`:
https://github.com/odoo/odoo/blob/6441ab71cb68648aa735057952bf757677a20ee3/addons/mail/models/mail_thread.py#L1719-L1725
This is correct when the user creates a message directly in the chatter.
However, when the mail is created thanks to `Send &amp; Print` functionality,
the attachment is linked to `account.invoice.send`.

Another flow have a similar issue: from invoices list, select few ones,
Action &gt; Send &amp; Print: the generated PDF won't be attached to their
invoice. In such a situation, here is the source of the problem:
https://github.com/odoo/odoo/blob/05ad6c477f7da2a495e5baf5b4629323b9d11fa0/addons/mail/wizard/mail_compose_message.py#L363-L367
There isn't any information about the invoice, therefore it is not
possible to linked the attachment to it.

OPW-2438457

closes odoo/odoo#71425

X-original-commit: e87f599d4eb22250b628d650b9f59b54db8d043c
Signed-off-by: Adrien Widart &lt;adwid@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When using the "Send &amp; Print" functionality, if the user adds an
attachment, the latter won't be linked to the record.

To reproduce the error:
1. Open a posted invoice
2. Send &amp; Print
3. Attach a file &gt; Select a file on your device
4. Send the email

Error: The invoice's PDF is added to record's attachments, but not the
other file (from step 3).

When the module selects the attachments that need to be linked to the
invoice, it only keeps the ones currently linked to `mail.compose.message`:
https://github.com/odoo/odoo/blob/6441ab71cb68648aa735057952bf757677a20ee3/addons/mail/models/mail_thread.py#L1719-L1725
This is correct when the user creates a message directly in the chatter.
However, when the mail is created thanks to `Send &amp; Print` functionality,
the attachment is linked to `account.invoice.send`.

Another flow have a similar issue: from invoices list, select few ones,
Action &gt; Send &amp; Print: the generated PDF won't be attached to their
invoice. In such a situation, here is the source of the problem:
https://github.com/odoo/odoo/blob/05ad6c477f7da2a495e5baf5b4629323b9d11fa0/addons/mail/wizard/mail_compose_message.py#L363-L367
There isn't any information about the invoice, therefore it is not
possible to linked the attachment to it.

OPW-2438457

closes odoo/odoo#71425

X-original-commit: e87f599d4eb22250b628d650b9f59b54db8d043c
Signed-off-by: Adrien Widart &lt;adwid@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account: digest email revenu values correction</title>
<updated>2021-05-10T10:03:33+00:00</updated>
<author>
<name>BVE</name>
<email>bve@odoo.com</email>
</author>
<published>2021-05-07T13:09:57+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=279dcbe7232fbd331902ec557f6c85b51ca522c0'/>
<id>279dcbe7232fbd331902ec557f6c85b51ca522c0</id>
<content type='text'>
The value taken into account in the SQL for the calculation were wrong:
- Not based on the state of the invoices (cancelled and draft
were taken into account)
- Had the tax included

opw-2464004
feedback-2478356

closes odoo/odoo#70586

X-original-commit: fafea72843e25e0fee091ca935df61edb9133f6f
Signed-off-by: Laurent Smet &lt;smetl@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The value taken into account in the SQL for the calculation were wrong:
- Not based on the state of the invoices (cancelled and draft
were taken into account)
- Had the tax included

opw-2464004
feedback-2478356

closes odoo/odoo#70586

X-original-commit: fafea72843e25e0fee091ca935df61edb9133f6f
Signed-off-by: Laurent Smet &lt;smetl@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account: fix reconcile rule percentage calculation</title>
<updated>2021-05-18T13:21:02+00:00</updated>
<author>
<name>jbw</name>
<email>jbw@odoo.com</email>
</author>
<published>2021-05-17T11:26:15+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=5800f20ccf63ef8482d1460f46c8c5fe30eac822'/>
<id>5800f20ccf63ef8482d1460f46c8c5fe30eac822</id>
<content type='text'>
In https://github.com/odoo/odoo/pull/52529/commits/078a3a0f760ff24d02070a343f28d2249a8b5ba7#diff-c217a13a40a3cc27dc516b899793abecfac8cab9a42fed407d4776bcbc9de9a8R812
the way the percentage is calculated is changed.
This implies that a reconciliation rule allowing a 90% matching amount will not allow to reconcile
a 90$ bank statement with a 100$ invoice (as it will calculate the % as 88.89%, not meeting the required 90 %)

After cited commit:
invoice 200, bank statement 180:
(|-180| - |20|) / |-180| * 100 = 88.89%
invoice 200, bank statement 220:
(|-220| - |-20|) / |-220| * 100 = 90.91%
credit note 200, bank statement -180:
(|180| - |-20|) / |180| * 100 = 88.89%
credit note 200, bank statement -220:
(|220| - |20|) / |220| * 100 = 90.91%

Now:
invoice 200, bank statement 180:
100 - |20| / |(-180 - 20)| * 100 = 90%
invoice 200, bank statement 220:
100 - |-20| / |(-220 - -20)| * 100 = 90%
credit note 200, bank statement -180:
100 - |-20| / |(180 - -20)| * 100 = 90%
credit note 200, bank statement -220:
100 - |20| / |(220 - 20)| * 100 = 90%

closes odoo/odoo#70948

Task: 2427089
Signed-off-by: William André (wan) &lt;wan@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In https://github.com/odoo/odoo/pull/52529/commits/078a3a0f760ff24d02070a343f28d2249a8b5ba7#diff-c217a13a40a3cc27dc516b899793abecfac8cab9a42fed407d4776bcbc9de9a8R812
the way the percentage is calculated is changed.
This implies that a reconciliation rule allowing a 90% matching amount will not allow to reconcile
a 90$ bank statement with a 100$ invoice (as it will calculate the % as 88.89%, not meeting the required 90 %)

After cited commit:
invoice 200, bank statement 180:
(|-180| - |20|) / |-180| * 100 = 88.89%
invoice 200, bank statement 220:
(|-220| - |-20|) / |-220| * 100 = 90.91%
credit note 200, bank statement -180:
(|180| - |-20|) / |180| * 100 = 88.89%
credit note 200, bank statement -220:
(|220| - |20|) / |220| * 100 = 90.91%

Now:
invoice 200, bank statement 180:
100 - |20| / |(-180 - 20)| * 100 = 90%
invoice 200, bank statement 220:
100 - |-20| / |(-220 - -20)| * 100 = 90%
credit note 200, bank statement -180:
100 - |-20| / |(180 - -20)| * 100 = 90%
credit note 200, bank statement -220:
100 - |20| / |(220 - 20)| * 100 = 90%

closes odoo/odoo#70948

Task: 2427089
Signed-off-by: William André (wan) &lt;wan@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account: Fix corner cases of https://github.com/odoo/odoo/pull/70303</title>
<updated>2021-05-14T14:23:07+00:00</updated>
<author>
<name>Laurent Smet</name>
<email>las@odoo.com</email>
</author>
<published>2021-05-14T09:04:22+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=87f6a2fd3f86d13ebe320c058336d752362b8f44'/>
<id>87f6a2fd3f86d13ebe320c058336d752362b8f44</id>
<content type='text'>
Original issue:
Create a payment like follow:

Payment type: receive money
Partner type: customer
Destination account: whatever receivable
Amount: define an amount (i.e. 90.00)
On Save, open the draft jounral entry created.
Lower the liquidity or counterpart amount and add a writeoff
Go back to the payment, change the amount and save.
The journal entry writeoff will swap from debit to credit at every
change made to the amount. This occur also when changing currency on the
payment

opw-2475223

Otherwise, this fix is not covering all cases:
inbound with write-off in debit
inbound with write-off in credit
outbound with write-off in debit
outbound with write-off in credit

closes odoo/odoo#70807

Signed-off-by: Laurent Smet &lt;smetl@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Original issue:
Create a payment like follow:

Payment type: receive money
Partner type: customer
Destination account: whatever receivable
Amount: define an amount (i.e. 90.00)
On Save, open the draft jounral entry created.
Lower the liquidity or counterpart amount and add a writeoff
Go back to the payment, change the amount and save.
The journal entry writeoff will swap from debit to credit at every
change made to the amount. This occur also when changing currency on the
payment

opw-2475223

Otherwise, this fix is not covering all cases:
inbound with write-off in debit
inbound with write-off in credit
outbound with write-off in debit
outbound with write-off in credit

closes odoo/odoo#70807

Signed-off-by: Laurent Smet &lt;smetl@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account:Auto Post scheduler action threads killed by timeout.</title>
<updated>2021-05-14T16:41:53+00:00</updated>
<author>
<name>Roopam Rathod</name>
<email>rrt@odoo.com</email>
</author>
<published>2021-02-18T13:16:54+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=819321c3a129613890ce49e3efe9a903c3218070'/>
<id>819321c3a129613890ce49e3efe9a903c3218070</id>
<content type='text'>
Before this commit:

  When there is too much records to post and it's take time more than 15 minutes then server was restarted.
  So scheduler action will do the process with the same records again and again.

After this commit:

  post record in batch of 1000

opw-2451446

closes odoo/odoo#69738

X-original-commit: b87612d6fc8d9ec27a8cf0803369c90df00c5f57
Signed-off-by: William André (wan) &lt;wan@odoo.com&gt;
Signed-off-by: rrt-odoo &lt;rrt-odoo@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit:

  When there is too much records to post and it's take time more than 15 minutes then server was restarted.
  So scheduler action will do the process with the same records again and again.

After this commit:

  post record in batch of 1000

opw-2451446

closes odoo/odoo#69738

X-original-commit: b87612d6fc8d9ec27a8cf0803369c90df00c5f57
Signed-off-by: William André (wan) &lt;wan@odoo.com&gt;
Signed-off-by: rrt-odoo &lt;rrt-odoo@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account: bug fix and rewrite query of function _adapt_parent_account_group and _adapt_parent_account_group</title>
<updated>2021-05-14T14:05:13+00:00</updated>
<author>
<name>Jigar Vaghela</name>
<email>jva@odoo.com</email>
</author>
<published>2021-04-15T13:29:40+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=5f8fab2edb80ca1b88850472da80018271a15177'/>
<id>5f8fab2edb80ca1b88850472da80018271a15177</id>
<content type='text'>
before this commit:

_adapt_parent_account_group or _adapt_parent_account_group call with multi-company record then raise singleton error

after this commit:

singleton error is fixed

closes odoo/odoo#69323

Signed-off-by: William André (wan) &lt;wan@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
before this commit:

_adapt_parent_account_group or _adapt_parent_account_group call with multi-company record then raise singleton error

after this commit:

singleton error is fixed

closes odoo/odoo#69323

Signed-off-by: William André (wan) &lt;wan@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account: speeds up `account.payment` deletion</title>
<updated>2021-05-11T19:55:36+00:00</updated>
<author>
<name>Denis Ledoux</name>
<email>dle@odoo.com</email>
</author>
<published>2021-05-11T19:55:36+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=29a9cf981729cfe8e55caaadf6bf14a8a4a7708e'/>
<id>29a9cf981729cfe8e55caaadf6bf14a8a4a7708e</id>
<content type='text'>
The deletion of `account.payment` were slowed down
because of the missing index

```
                                                                                  QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Delete on account_payment  (cost=20.37..44.45 rows=10 width=34) (actual time=0.449..0.450 rows=0 loops=1)
   -&gt;  Nested Loop  (cost=20.37..44.45 rows=10 width=34) (actual time=0.383..0.404 rows=10 loops=1)
         -&gt;  HashAggregate  (cost=19.95..20.05 rows=10 width=32) (actual time=0.378..0.380 rows=10 loops=1)
               Group Key: "ANY_subquery".id
               Batches: 1  Memory Usage: 24kB
               -&gt;  Subquery Scan on "ANY_subquery"  (cost=0.42..19.92 rows=10 width=32) (actual time=0.035..0.371 rows=10 loops=1)
                     -&gt;  Limit  (cost=0.42..19.82 rows=10 width=4) (actual time=0.032..0.365 rows=10 loops=1)
                           -&gt;  Nested Loop  (cost=0.42..186848.76 rows=96312 width=4) (actual time=0.031..0.364 rows=10 loops=1)
                                 -&gt;  Seq Scan on account_payment_pre_backup pay_backup  (cost=0.00..14763.48 rows=277317 width=4) (actual time=0.015..0.086 rows=53 loops=1)
                                       Filter: ((state)::text &lt;&gt; ALL ('{draft,cancelled}'::text[]))
                                       Rows Removed by Filter: 166
                                 -&gt;  Index Scan using account_payment_pkey on account_payment pay  (cost=0.42..0.62 rows=1 width=4) (actual time=0.005..0.005 rows=0 loops=53)
                                       Index Cond: (id = pay_backup.id)
                                       Filter: (move_id IS NULL)
                                       Rows Removed by Filter: 1
         -&gt;  Index Scan using account_payment_pkey on account_payment  (cost=0.42..2.44 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=10)
               Index Cond: (id = "ANY_subquery".id)
 Planning Time: 0.294 ms
 Trigger for constraint account_move_line_payment_id_fkey: time=1.236 calls=10
 Trigger for constraint account_payment_sale_order_rel_account_payment_id_fkey: time=0.195 calls=10
 Trigger for constraint credit_token_payment_id_fkey: time=1.308 calls=10
 Trigger for constraint payment_transaction_payment_id_fkey: time=0.288 calls=10
 Trigger for constraint account_invoice_payment_rel_payment_id_fkey1: time=0.191 calls=10
 Trigger for constraint account_move_payment_id_fkey: time=6015.799 calls=10
 Trigger for constraint account_payment_account_bank_statement__account_payment_id_fkey: time=0.444 calls=10
 Execution Time: 6019.988 ms
```

upg-12139

closes odoo/odoo#70712

Signed-off-by: Denis Ledoux (dle) &lt;dle@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The deletion of `account.payment` were slowed down
because of the missing index

```
                                                                                  QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Delete on account_payment  (cost=20.37..44.45 rows=10 width=34) (actual time=0.449..0.450 rows=0 loops=1)
   -&gt;  Nested Loop  (cost=20.37..44.45 rows=10 width=34) (actual time=0.383..0.404 rows=10 loops=1)
         -&gt;  HashAggregate  (cost=19.95..20.05 rows=10 width=32) (actual time=0.378..0.380 rows=10 loops=1)
               Group Key: "ANY_subquery".id
               Batches: 1  Memory Usage: 24kB
               -&gt;  Subquery Scan on "ANY_subquery"  (cost=0.42..19.92 rows=10 width=32) (actual time=0.035..0.371 rows=10 loops=1)
                     -&gt;  Limit  (cost=0.42..19.82 rows=10 width=4) (actual time=0.032..0.365 rows=10 loops=1)
                           -&gt;  Nested Loop  (cost=0.42..186848.76 rows=96312 width=4) (actual time=0.031..0.364 rows=10 loops=1)
                                 -&gt;  Seq Scan on account_payment_pre_backup pay_backup  (cost=0.00..14763.48 rows=277317 width=4) (actual time=0.015..0.086 rows=53 loops=1)
                                       Filter: ((state)::text &lt;&gt; ALL ('{draft,cancelled}'::text[]))
                                       Rows Removed by Filter: 166
                                 -&gt;  Index Scan using account_payment_pkey on account_payment pay  (cost=0.42..0.62 rows=1 width=4) (actual time=0.005..0.005 rows=0 loops=53)
                                       Index Cond: (id = pay_backup.id)
                                       Filter: (move_id IS NULL)
                                       Rows Removed by Filter: 1
         -&gt;  Index Scan using account_payment_pkey on account_payment  (cost=0.42..2.44 rows=1 width=10) (actual time=0.002..0.002 rows=1 loops=10)
               Index Cond: (id = "ANY_subquery".id)
 Planning Time: 0.294 ms
 Trigger for constraint account_move_line_payment_id_fkey: time=1.236 calls=10
 Trigger for constraint account_payment_sale_order_rel_account_payment_id_fkey: time=0.195 calls=10
 Trigger for constraint credit_token_payment_id_fkey: time=1.308 calls=10
 Trigger for constraint payment_transaction_payment_id_fkey: time=0.288 calls=10
 Trigger for constraint account_invoice_payment_rel_payment_id_fkey1: time=0.191 calls=10
 Trigger for constraint account_move_payment_id_fkey: time=6015.799 calls=10
 Trigger for constraint account_payment_account_bank_statement__account_payment_id_fkey: time=0.444 calls=10
 Execution Time: 6019.988 ms
```

upg-12139

closes odoo/odoo#70712

Signed-off-by: Denis Ledoux (dle) &lt;dle@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account: Partial revert of https://github.com/odoo/odoo/commit/39fb6b2990e5d6fda0d5f12dbd64d26ef77b9d0c</title>
<updated>2021-05-11T12:59:42+00:00</updated>
<author>
<name>Laurent Smet</name>
<email>las@odoo.com</email>
</author>
<published>2021-05-11T12:59:42+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=9b3506523659b06440b46664eeb83952cc30694e'/>
<id>9b3506523659b06440b46664eeb83952cc30694e</id>
<content type='text'>
It seems some ppl are sharing the same bank account accross multiple journals.

issues:
2527148
2527994
2527894
...

closes odoo/odoo#70676

Signed-off-by: oco-odoo &lt;oco-odoo@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It seems some ppl are sharing the same bank account accross multiple journals.

issues:
2527148
2527994
2527894
...

closes odoo/odoo#70676

Signed-off-by: oco-odoo &lt;oco-odoo@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account: avoid change of payment type on 0 amount</title>
<updated>2021-05-07T12:31:25+00:00</updated>
<author>
<name>Andrea Grazioso (agr-odoo)</name>
<email>agr@odoo.com</email>
</author>
<published>2021-05-07T12:24:15+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=86a2819697d5d9d1c32ba902d8a1089acf6110f2'/>
<id>86a2819697d5d9d1c32ba902d8a1089acf6110f2</id>
<content type='text'>
Create a draft payment with payment type and 0 amount.
Save.

The payment type will be overwritten

opw-2495461

closes odoo/odoo#70603

Signed-off-by: Quentin De Paoli (qdp) &lt;qdp@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Create a draft payment with payment type and 0 amount.
Save.

The payment type will be overwritten

opw-2495461

closes odoo/odoo#70603

Signed-off-by: Quentin De Paoli (qdp) &lt;qdp@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] account: keep write off sign consistent</title>
<updated>2021-05-10T10:26:32+00:00</updated>
<author>
<name>Andrea Grazioso (agr-odoo)</name>
<email>agr@odoo.com</email>
</author>
<published>2021-05-04T09:04:14+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=7c0da92c486c2ab89fe424ce66904aa6a655fa09'/>
<id>7c0da92c486c2ab89fe424ce66904aa6a655fa09</id>
<content type='text'>
Create a payment like follow:
- Payment type: receive money
- Partner type: customer
- Destination account: whatever receivable
- Amount: define an amount (i.e. 90.00)
On Save, open the draft jounral entry created.
Lower the liquidity or counterpart amount and add a writeoff
Go back to the payment, change the amount and save.

The journal entry writeoff will swap from debit to credit at every
change made to the amount. This occur also when changing currency on the
payment

opw-2475223

closes odoo/odoo#70303

Signed-off-by: Laurent Smet &lt;smetl@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Create a payment like follow:
- Payment type: receive money
- Partner type: customer
- Destination account: whatever receivable
- Amount: define an amount (i.e. 90.00)
On Save, open the draft jounral entry created.
Lower the liquidity or counterpart amount and add a writeoff
Go back to the payment, change the amount and save.

The journal entry writeoff will swap from debit to credit at every
change made to the amount. This occur also when changing currency on the
payment

opw-2475223

closes odoo/odoo#70303

Signed-off-by: Laurent Smet &lt;smetl@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
