Skip to content

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

@Honeyxilia

Description

@Honeyxilia

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions