Tryton - Issues

 

Issue7999

Title invoice not marked as paid
Priority bug Status resolved
Superseder Nosy List ced, pokoli, reviewbot, roundup-bot, semarie
Type behavior Components account_invoice
Assigned To ced Keywords review
Reviews 64571002,279231002
View: 64571002, 279231002

Created on 2019-01-16.13:36:18 by semarie, last changed by roundup-bot.

Messages
New changeset 504308c515fa by Cédric Krier in branch 'default':
Process reconciled invoice when posted
https://hg.tryton.org/tryton-env/rev/504308c515fa
New changeset 771e9d63c6e1 by Cédric Krier in branch 'default':
Process reconciled invoice when posted
https://hg.tryton.org/modules/account_invoice/rev/771e9d63c6e1
review279231002 updated at https://codereview.tryton.org/279231002/#ps279261003
review279231002 updated at https://codereview.tryton.org/279231002/#ps275281003
review279231002 updated at https://codereview.tryton.org/279231002/#ps279211016
msg48814 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-04-10.23:05:28
Here is review279231002 which use queue to call process and add a scenario for this case.
review64571002 updated at https://codereview.tryton.org/64571002/#ps1
msg46002 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2019-01-17.09:53:21
The first option seems OK for me, just check if the invoice is reconciled (there is a function field which does the computation) on the post transition ahd call invoice.paid() for all of them. 

Just take care that you will be forced to write the 'posted' state to this records, otherwise Workflow.transition will discard validated invoices if there is no _transition defined from validated to paid.
msg46000 (view) Author: [hidden] (semarie) Date: 2019-01-17.09:43:15
- when the Invoice is reconcilied, Reconciliation will call Invoice.process() method [1]
- the Invoice.process method only care about Invoice in 'posted' or 'paid' state [2]

so I see two possibilities:
- in Invoice.post(), calling Invoice.paid() if the invoice is already reconcilied (what Invoice.process do - but we can't just process() directly as it might call post() and entering in end-loop).
- in Invoice.process(), dealing with 'validated' state too, and automatically change the state to 'paid' if the invoice is reconcilied (or ignore it as now).

The first possibility seems more simple to implement. For the second, I am unsure if we can call Invoice.paid() on 'validated' invoice (if the state will effectively do 'validated'->'posted'->'paid' automatically or not)

[1] http://hg.tryton.org/modules/account_invoice/file/tip/account.py#l265
[2] http://hg.tryton.org/modules/account_invoice/file/tip/invoice.py#l1368
msg45982 (view) Author: [hidden] (semarie) Date: 2019-01-16.13:52:29
yes it is a valid workaround
msg45980 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2019-01-16.13:40:40
Probably unreconciling the lines and reconciling them another time will mark the invoice as paid.
msg45979 (view) Author: [hidden] (semarie) Date: 2019-01-16.13:36:17
I think I identified a possible bug in invoice state management regarding reconciliation.

I had the following scenario:
- create an invoice for Party "FOO" and only validate it (not posted)
- using Statement, create a Line of the amount the invoice and associate the party to "FOO"
- reconcile party account: the invoice is validated so a Move exist and reconciliation will succeed
- post the invoice

The invoice is in state "posted" whereas I would expect to it to be in "paid" state.

I dunno how to put it in "paid" state as the move is already reconcilied.
History
Date User Action Args
2019-04-15 22:12:22roundup-botsetmessages: + msg49062
2019-04-15 22:12:18roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg49061
2019-04-15 18:06:15reviewbotsetmessages: + msg49055
2019-04-15 16:41:51reviewbotsetmessages: + msg49052
2019-04-10 23:09:29reviewbotsetmessages: + msg48816
2019-04-10 23:05:28cedsetstatus: chatting -> testing
reviews: 64571002 -> 64571002,279231002
messages: + msg48814
nosy: + ced
assignedto: semarie -> ced
2019-02-11 20:46:16reviewbotsetnosy: + reviewbot
messages: + msg46952
2019-02-11 20:18:54semariesetreviews: 64571002
assignedto: semarie
keyword: + review
2019-01-17 09:53:21pokolisetmessages: + msg46002
2019-01-17 09:43:15semariesetstatus: unread -> chatting
messages: + msg46000

Showing 10 items. Show all history (warning: this could be VERY long)