[12.0 -> 14.0] account.move records created based on account.asset have invalid names

Aperta
#5,502 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start with _deduce_sequence_number_reset in odoo/addons/account/models/account_move.py, which the issue says picks an existing journal move to infer the sequence format, and with the _setup_move_data to create_move path in account_asset_management. Reproduce by migrating a 12.0 database with asset-generated moves and running Compute Assets. The issue does not say what the fix should be, so agree on an approach with maintainers before coding. Done means asset-created moves no longer block new move creation after migration.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Module

account_asset_management from 12.0 to 13.0 onward, after the fusion of the account.invoice/account.move tables.

Describe the bug

  • In V12.0, account.move records created from account.asset records use the asset's name

  • In v13.0 onwards, the fusion of account.move/account.invoice mean that both table follow the same sequence generator for new invoice/move numbers.
    Fittingly, the _setup_move_data method used in asset_compute->_compute_entries->create_move no longer sets the name field on newly created account.move records.

  • However, account.move records created from account.asset (using the Compute Assets action) in the version 12.0 can mess with the sequence number generation - Indeed, from Odoo 14.0, the _deduce_sequence_number_reset tries to extrapolate the sequence number format by taking an existing move in the journal.
    If the created account.move is not a refund, it looks for account.move in the same journal,which are not of out_refund and in_refund, which inclues entry moves created from assets, that can have non-standard names if created in previous Odoo versions.
    That causes a ValidationError since the name is not standard
    (see the _deduce_sequence_number_reset method in odoo/addons/account/models/account_move.py)

To Reproduce

Affected versions: 14.0 onwards

Steps to reproduce the behavior:

  1. Create a v12.0 database
  2. Create assets and moves related to these assets
  3. Migrated the database to v14.0
  4. Try to use the Compute Assets action

Expected behavior
The account.move entities created from account.asset in previous Odoo versions, which do not possess standard sequence number names, shouldn't bar the creation of new account.move entities when the database is migrated.

I'm not sure if people have already surrounded the issue (renamed account.move records, simply didn't compute assets before a migration), but I'm interested in people's suggestions which might have migrated an Odoo database with the same module.

Lingua principale
Python
Stelle
995
Fork
837
Merge medio
5g 6h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OCA/OpenUpgrade

Tutte le issue di OCA/OpenUpgrade

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.