Merge lp://staging/~camptocamp/account-financial-tools/account-constrinat-parent-object into lp://staging/~account-core-editors/account-financial-tools/7.0

Proposed by Joël Grand-Guillaume @ camptocamp
Status: Merged
Merge reported by: Joël Grand-Guillaume @ camptocamp
Merged at revision: not available
Proposed branch: lp://staging/~camptocamp/account-financial-tools/account-constrinat-parent-object
Merge into: lp://staging/~account-core-editors/account-financial-tools/7.0
Diff against target: 157 lines (+124/-1)
2 files modified
account_constraints/__openerp__.py (+7/-0)
account_constraints/account_constraints.py (+117/-1)
To merge this branch: bzr merge lp://staging/~camptocamp/account-financial-tools/account-constrinat-parent-object
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp Approve
Alexandre Fayolle - camptocamp code review, no test Needs Fixing
Review via email: mp+144113@code.staging.launchpad.net

Description of the change

On Account constraints:

  Remove the possibility to modify or delete a move line related to an
  invoice or a bank statement, no matter what the status of the move
  (draft, validated or posted). This is usefule in standard context but
  moreover if you're using : account_default_draft_move. This way you ensure
  user cannot make mistake even in draft, he must pass through the
  parent object to make his modification.

To post a comment you must log in.
100. By Joël Grand-Guillaume @ camptocamp

[FIX] Add the key 'from_parent_object' in context when creating move from invoice.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

in description: s/usefule/useful/
                s/in standard/in a standard/
                s/moreover/even more/
                s/using : account_default_draft_move/using `account_default_draft_move`/
                s/ensure user/ensure that the user/
                s/mistake/mistakes/
                s/in draft/in draft state/

line 42: s/Error!/Error/

line 58, line 71: s/Add the verification of:/Add the following checks:/

line 63, line 76: s/if you use the all move in/if you use the module setting all moves in/

line 99, line 120: s/buton cancel/"Cancel" button/

review: Needs Fixing (code review, no test)
101. By Joël Grand-Guillaume @ camptocamp

[FIX] Typo regarding MP comments

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

104, 112, 125, 132: the context is mutable, I think it would be safer to propagate a modified copy of the context.

review: Needs Fixing
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

> 104, 112, 125, 132: the context is mutable, I think it would be safer to
> propagate a modified copy of the context.

The only risk is if some other module uses the key we are adding to the context for some other purpose, or am I missing something.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> > 104, 112, 125, 132: the context is mutable, I think it would be safer to
> > propagate a modified copy of the context.
>
> The only risk is if some other module uses the key we are adding to the
> context for some other purpose, or am I missing something.

If a module implements a method which:

 1. call create_move_from_st_line on an account.bank.statement
 2. then call unlink directly on a move line

The 'from_parent_object' will be propagated to the second call, which is not what we want.

I admit this scenario is extremely improbable, but if such a bug happens, it will also be extremely hard to find.

Am I wrong?

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

I agree with you Guewen... Would you or Alex please make the changes till end of week ? I will not be able to do them right now and we really need those constraints to be put in place...

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

On mer. 23 janv. 2013 15:36:18 CET, Joël Grand-Guillaume @ camptocamp
wrote:
> I agree with you Guewen... Would you or Alex please make the changes till end of week ? I will not be able to do them right now and we really need those constraints to be put in place...

Not sure I'll be able to make before friday, because I have a lot of
work for a customer meeting on monday.

Should be able to tackle it next tuesday, though.

--
Alexandre Fayolle
Chef de Projet
Tel : + 33 (0)4 79 26 57 94

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com

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

Alright ! Thank you !

--

camptocamp
INNOVATIVE SOLUTIONS
BY OPEN SOURCE EXPERTS

Joël Grand-Guillaume
Division Manager
Business Solutions

+41 21 619 10 28

www.camptocamp.com

102. By Guewen Baconnier @ Camptocamp

[FIX] copy the context to avoid to propagate the 'from_parent_object' key to callers' context

103. By Guewen Baconnier @ Camptocamp

[FIX] initialize context to a dict if it is None as we want to get a key

104. By Guewen Baconnier @ Camptocamp

[FIX] cut some long lines, remove trailing whitespaces, indentation

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

I made the changes.
LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches