Tryton - Issues

 

Issue7999

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

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

Messages
review64571002 updated at https://codereview.tryton.org/64571002/#ps1
msg46002 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) 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) (Tryton translator) 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-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
2019-01-16 14:15:12semariesettype: behavior
2019-01-16 13:52:29semariesetstatus: chatting -> unread
messages: + msg45982
2019-01-16 13:40:40pokolisetstatus: unread -> chatting
nosy: + pokoli
messages: + msg45980
2019-01-16 13:36:18semariecreate