Tryton - Issues

 

Issue7938

Title Re-create accounts when an account is overwrite template or inactive
Priority bug Status resolved
Superseder Nosy List ced, resteve, reviewbot, roundup-bot
Type behavior Components account
Assigned To ced Keywords
Reviews 54551002
View: 54551002

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

Messages
New changeset d48a794599b1 by Cédric Krier in branch '5.0':
Do not recreate models that have template override is True
https://hg.tryton.org/modules/account/rev/d48a794599b1

New changeset b812aae86970 by Cédric Krier in branch '4.8':
Do not recreate models that have template override is True
https://hg.tryton.org/modules/account/rev/b812aae86970
New changeset 71234def8714 by Cédric Krier in branch 'default':
Do not recreate models that have template override is True
https://hg.tryton.org/tryton-env/rev/71234def8714
New changeset 10df9d79188c by Cédric Krier in branch 'default':
Do not recreate models that have template override is True
https://hg.tryton.org/modules/account/rev/10df9d79188c

New changeset aee315f1c291 by Cédric Krier in branch 'default':
Add test update chart of account with override and active test
https://hg.tryton.org/modules/account/rev/aee315f1c291
review54551002 updated at https://codereview.tryton.org/54551002/#ps20001
msg47111 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-02-19.12:16:54
Here is review54551002 which fix the recreation when override is True. I also added a test for the active test but it was already fixed by issue4491.
New review54551002 at https://codereview.tryton.org/54551002/#ps1
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
2019-03-16 23:21:16roundup-botsetmessages: + msg47684
2019-03-08 18:49:51roundup-botsetmessages: + msg47494
2019-03-08 18:49:42roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg47493
2019-03-01 17:14:28reviewbotsetnosy: + reviewbot
messages: + msg47295
2019-02-19 12:16:54cedsetstatus: chatting -> testing
assignedto: ced
messages: + msg47111
keyword: - review
nosy: - reviewbot
2019-02-19 12:16:12reviewbotsetnosy: + reviewbot
messages: + msg47110
2019-02-19 12:16:11reviewbotsetreviews: 54551002
keyword: + review
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