OCA/account-financial-tools

[14.0, 15.0] account_move_name_sequence error with credit note on supplier bill

remi-filament opened this issue · 2 comments

Module

account_move_name_sequence

Describe the bug

When creating a credit note on supplier bill, the following validation error is raised :

A move can not be posted with name "/" or empty value
Check the journal sequence, please

To Reproduce

Affected versions: 14.0, 15.0

Steps to reproduce the behavior:

  1. Create a vendor bill and post it
  2. Click on Add credit note
  3. Select "Full refund" or "Full refund and new draft invoice" on wizard then click on Reverse

Expected behavior
Supplier bill should be properly reversed.

Additional context
It took me a while to figure out why this happened only on vendor bills (not on customer invoices) and only when using this reversal wizard, not when posting a proper vendor bill (otherwise it would have been spotted before !).

It seems that the issue is linked to the flushing of account_move fields in account_move _check_duplicate_supplier_reference() function here : https://github.com/odoo/odoo/blob/17a182fb3ee652a8a52654c5707c0ed265404630/addons/account/models/account_move.py#L1798-L1801
Because of new constraint added on account_move from account_move_name_sequence here, this raises the reported ValidationError.

Hi @alexis-via @moylop260 I am not sure how to properly handle this issue, if you have any idea, let me know I could try to propose a PR accordingly !

Thanks !

@remi-filament

Could you test the fix, please?

#1514