Issue 11077

Title
Default Customer Tax Rule value disappears when it is saved
Priority
bug
Status
resolved
Nosy list
ced, juanjogp, pokoli, reviewbot, roundup-bot, yangoon
Assigned to
ced
Keywords
review

Created on 2021-12-21.15:42:34 by juanjogp, last changed 3 months ago by roundup-bot.

Messages

New changeset f820604c9c53 by Cédric Krier in branch 'default':
Fill Value of MultiValue with the other default values
https://hg.tryton.org/tryton-env/rev/f820604c9c53
New changeset 5d979ddb683c by Cédric Krier in branch 'default':
Fill Value of MultiValue with the other default values
https://hg.tryton.org/trytond/rev/5d979ddb683c
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-12-21.16:19:50

@pokoli described correctly the problem. The default value is not send by the client because it did not changed and it is not filled because it is not a creation. And as all accounting values are stored on the same model, once it is created it is created with None value for all fields that are not modified.
This is the usual problem of global default. Should we store the default value and so it is no more inherited from the global configuration or we should consider None as not a real value and change it for the default global. As usual I do not like implicit behavior so for me we must have checkboxes to define if we use the default or not.
But now to fix the behavior for backport the multivalue storage model must use the default value of the party on creation. This should work by extending multivalue_record. But maybe we can have a generic fix in MultiValueMixin.

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-12-21.15:57:00

I think the problem is related because the get_multivalue retuns default values when no record is found (this is the case for point 12) but this value is not written back to the server after creating the second record.

Could you test which values are sent from the client when you set the receivable account for the second company? I will expect that both the tax rule and the receivable account are sent to the server and written to the multivalue model.

Author: [hidden] (juanjogp)
Date: 2021-12-21.15:42:34

I replicated this bug in https://demo6.2.tryton.org/:
(For the test, i will use the companies "Michael Scott Paper Company" and "Dunder Mifflin inc")
1. I'm going to start form the company "Michael Scott Paper Company":
2. Go to Financial -> Configuration -> Configuration
3. Create a "Default Customer Tax Rule", in this case Tax Test "Michael Scott Paper Company"
4. Do the same for the company "Dunder Mifflin inc"
5. Return to "Michael Scott Paper Company"
6. Create a party, for the test, i named it "Party Test"
7. In the same party, go to the Accounting page
8. Add a value in "Account Receivable" field
8. The field "Customer Tax Rule" must have a value (from the default field in Financial configuration)
9. Save
10. Go to the company "Dunder Mifflin inc"
11. Go to the same party we created in the "Michael Scott Paper Company" company
12. If we go again to Accounting Page, the only field with value will be the "Customer Tax Rule"
(this field will have the default value from the "Dunder Mifflin inc" Financial configuration)
13. If we add a value to the "Account Receivable" and save, the value from "Customer Tax Rule" will disappear

I also replicated this bug in a local Tryton with the party and account modules installed (and its requirements)

History
Date User Action Args
2022-02-21 00:52:39roundup-botsetmessages: + msg74244
2022-02-21 00:52:36roundup-botsetmessages: + msg74243
nosy: + roundup-bot
status: testing -> resolved
2022-02-02 23:05:11yangoonsetnosy: + yangoon
2022-02-02 19:12:52reviewbotsetmessages: + msg73721
2022-02-02 18:43:32reviewbotsetmessages: + msg73719
nosy: + reviewbot
2022-02-02 18:33:40cedsetcomponent: + trytond, - account, party
keyword: + review
reviews: 370761002
status: in-progress -> testing
2022-02-02 18:16:19cedsetassignedto: ced
status: chatting -> in-progress
type: behavior
2021-12-21 16:19:50cedsetmessages: + msg72854
nosy: + ced
2021-12-21 15:57:00pokolisetmessages: + msg72852
nosy: + pokoli
status: unread -> chatting
2021-12-21 15:42:34juanjogpcreate

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