Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: cancel state on account.move

by
Acsone SA/NV, Stéphane Bidoul
- 06/10/2022 16:14:18
I just checked MIS Builder and it's consistent with what you say.

-sbi

On Thu, Oct 6, 2022 at 3:56 PM Alexis de Lattre <notifications@odoo-community.org> wrote:
Dear OCA friends,

Up to Odoo v12, the "state" of an account.move had 2 possible values : "draft" and "posted".
Starting from Odoo v13, the "state" field has one more possible value : "cancel". I hate that, but it's a fact :(

The problem is : how should we handle these "cancel" moves. In several wizards/models, we give the user the choice between "posted moves only" and "all moves" ; does "all moves" means draft+posted or draft+posted+cancel ? Maybe a developer would consider that "all moves" means draft+posted+cancel, but a user often considers that cancelled moves should never be taken into account and "all moves" means draft+posted.

Here is a summary of the situation on Odoo v14 in different modules :
  • account_financial_report : when the user selects "All entries", Odoo takes draft+posted
  • sale and purchase : the "Invoiced qty" on the sale.order.line/ purchase.order.line doesn't take into account the cancelled invoices (it only takes draft and posted invoices)
  • l10n_fr_fec : when the user selects "Non-official FEC report (posted and unposted entries)", Odoo takes draft+posted+cancel
  • lock dates : odoo allows to have moves with state="cancel" in a locked period (but moves in draft state are not allowed)
So the majority of modules considers that "all moves" means "draft + posted" and excludes "cancel" state. The fact that Odoo accepts cancel entries in a locked period confirms that cancelled moves should always be ignored, even when Odoo says "all entries".

I think l10n_fr_fec should be fixed to adopt this behavior (I can make a PR for l10n_fr_fec_oca).
The OCA modules account_cutoff_xxx from https://github.com/OCA/account-closing don't even have a field to say if you should select "all moves" (draft + po sted) or "posted moves only" (at the moment, it takes all moves including cancelled moves). I'll make a PR to fix this.

Do you know other modules that should be fixed on this ?

For v16, maybe we should switch from the term "All entries" to "Draft and Posted entries"... what do you think ?

--
Alexis de Lattre

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

Reference