Tryton - Issues

 

Issue7938

Title Re-create accounts when an account is overwrite template or inactive
Priority bug Status chatting
Superseder Nosy List ced, resteve
Type behavior Components account
Assigned To Keywords
Reviews

Created on 2018-12-21.10:37:24 by resteve, last changed by resteve.

Messages
msg45435 (view) Author: [hidden] (resteve) Date: 2018-12-21.16:23:56
The duplication (or recreated) accounts is when upgrade the account chart without other extra modules (only account module and "Minimal Account Chart" option)

The problem is in template2account after upgrade method [1], that not return template ID 23 and will be create a new account in create_account method.

Example template2account values after update_account() and before create_account() in [1]:

>>> template2account
{22: 1, 24: 4, 25: 6, 26: 3, 27: 2, 28: 7}

ID 23 is missing because is mark "template_override". Same as "active" field in previous versions.

[1] https://bitbucket.org/tryton/account/src/7ebad68e53e09cb9388123574048e1f76f722c79/account.py#lines-2322
msg45427 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-12-21.11:14:30
template2account should be filled even if not template_override and the update process should be run with active_test to false.
msg45426 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-12-21.11:12:23
Ha, I understood. The account are not duplicated but recreated.
msg45425 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-12-21.11:09:52
Is it with only standard module? Because template are not copied: http://hg.tryton.org/modules/account/file/tip/account.py#l996
msg45424 (view) Author: [hidden] (resteve) Date: 2018-12-21.10:37:23
A. Scenario:

1- Create an account chart.
2- Mark "Overwrite template" option in an account (ID 5)
3- Upgrade the account chart. A new account was created (ID 8)

See an example after upgrade chart:

 id | code |         name          |        create_date         | template | template_override 
----+------+-----------------------+----------------------------+----------+-------------------
  8 |      | Main Receivable       | 2018-12-21 09:24:38.239456 |       23 | f    <- duplicated account. Same template that ID 23
  5 |      | Main Receivable       | 2018-12-11 12:52:28.10897  |       23 | t


B. Also in v4.8, same scenario with template_override and active field:

1- Create an account chart.
2- Mark "Overwrite template" or inactive an account
3- Upgrade the account chart. A new account was created.


  id  | code |               name                |        create_date         | template | active 
------+------+-----------------------------------+----------------------------+----------+--------
 1597 | 7002 | Ventas de mercaderías Exportación | 2018-12-21 09:11:21.064892 |     1468 | f
 1708 | 7002 | Ventas de mercaderías Exportación | 2018-12-21 09:15:28.718722 |     1468 | t  <- duplicated account. Same template that ID 1468
History
Date User Action Args
2018-12-21 16:23:56restevesetmessages: + msg45435
2018-12-21 11:14:30cedsetmessages: + msg45427
2018-12-21 11:12:23cedsetstatus: need-eg -> chatting
messages: + msg45426
title: Duplicate accounts when an account is overwrite template or inactive -> Re-create accounts when an account is overwrite template or inactive
2018-12-21 11:09:52cedsetstatus: chatting -> need-eg
nosy: + ced
messages: + msg45425
2018-12-21 10:37:24restevecreate

Showing 10 items. Show all history (warning: this could be VERY long)