Merge lp:~camptocamp/account-financial-tools/account-contraints-state-vre into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Vincent Renaville@camptocamp
Status: Work in progress
Proposed branch: lp:~camptocamp/account-financial-tools/account-contraints-state-vre
Merge into: lp:~account-core-editors/account-financial-tools/7.0
Diff against target: 11 lines (+1/-1)
1 file modified
account_constraints/account_constraints.py (+1/-1)
To merge this branch: bzr merge lp:~camptocamp/account-financial-tools/account-contraints-state-vre
Reviewer Review Type Date Requested Status
Joël Grand-Guillaume @ camptocamp code review, no tests Disapprove
Guewen Baconnier @ Camptocamp Needs Information
Review via email: mp+193884@code.launchpad.net

Description of the change

Hello,

When you generate entries lines from the previous year, the wizard validate all move lines from the previous year.
The constraint will raise because, the field state is not in the authorized field like reconcile_id and partial_reconcile_id
My fix add state in the authorised fields.

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Does this change allow to change a move from 'posted' to 'unposted' when it should not have been allowed? This constraint does maybe exist elsewhere, if it it does, so your fix seems correct to me. Otherwise, we should check that that the change is unposted→posted and not posted→unposted.

review: Needs Information
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

My opinion here that this fix is dangerous. The name of the method that use it is "_authorized_reconcile", which means, we check reconcile stuff not state stuff... The problem comes from another place.

May be you should use the "flag" : if not context.get('from_parent_object', False):

Add from_parent_object in context in the wizard that generate the end of year entries and you should not face this trouble anymore.

But please, do not allow state change, this is why we introduce the constraints ;)

Thanks,

Joël

review: Disapprove (code review, no tests)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Work needed for this one.

I set it in WIP

Unmerged revisions

125. By Vincent Renaville@camptocamp

[FIX] add state in authorized field to be write, due to Generate new fiscalyear wizard, that revalid current year move line

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_constraints/account_constraints.py'
2--- account_constraints/account_constraints.py 2013-07-11 08:33:18 +0000
3+++ account_constraints/account_constraints.py 2013-11-05 07:08:40 +0000
4@@ -51,7 +51,7 @@
5 """
6 if not vals:
7 return False
8- rec_keys = set(["reconcile_id", "reconcile_partial_id"])
9+ rec_keys = set(["reconcile_id", "reconcile_partial_id", "state"])
10 write_keys = set(vals)
11 return rec_keys.issuperset(write_keys)
12

Subscribers

People subscribed via source and target branches