Merge lp://staging/~camptocamp/account-financial-tools/7.0-add-account_move_batch_validate-lep into lp://staging/~account-core-editors/account-financial-tools/7.0

Proposed by Leonardo Pistone
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: 162
Merged at revision: 156
Proposed branch: lp://staging/~camptocamp/account-financial-tools/7.0-add-account_move_batch_validate-lep
Merge into: lp://staging/~account-core-editors/account-financial-tools/7.0
Diff against target: 987 lines (+929/-0)
11 files modified
account_move_batch_validate/__init__.py (+24/-0)
account_move_batch_validate/__openerp__.py (+80/-0)
account_move_batch_validate/account.py (+134/-0)
account_move_batch_validate/account_view.xml (+28/-0)
account_move_batch_validate/i18n/account_move_batch_validate.pot (+191/-0)
account_move_batch_validate/i18n/fr.po (+185/-0)
account_move_batch_validate/test/batch_validate.yml (+48/-0)
account_move_batch_validate/test/batch_validate_then_unmark.yml (+62/-0)
account_move_batch_validate/wizard/__init__.py (+22/-0)
account_move_batch_validate/wizard/move_marker.py (+89/-0)
account_move_batch_validate/wizard/move_marker_view.xml (+66/-0)
To merge this branch: bzr merge lp://staging/~camptocamp/account-financial-tools/7.0-add-account_move_batch_validate-lep
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no tests Approve
Nicolas Bessi - Camptocamp (community) code review, no test Approve
Leonardo Pistone Abstain
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Frederic Clementi - Camptocamp (community) functional Approve
Review via email: mp+201187@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Just about these lines:

135 + session_hdl = ConnectorSessionHandler(cr.dbname, uid)
136 + with session_hdl.session() as session:

session_hdl.session() will open a new transaction (new cr), and commit the jobs at the end of the context manager.
I'm not sure that's what you want.

My opinion is that if something fails in the main transaction of the wizard, the jobs should not be created. In that case, you would need to create a Session with the current cursor (instead of creating a new cursor).

    session = Session(cr, uid, context=context)

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Guewen,

that means that the session is the one we use to create the jobs, not the one the jobs use? In that case, you're right, creating the jobs is in the same transaction as the wizard.

Thanks!

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

On 01/13/2014 11:55 AM, Leonardo Pistone @ camptocamp wrote:
> Guewen,
>
> that means that the session is the one we use to create the jobs, not the one the jobs use? In that case, you're right, creating the jobs is in the same transaction as the wizard.
>
> Thanks!
>

The session here is the one used for the INSERT of the job. A fresh
session will be created to execute the job, but you don't have to bother
with that.

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Guewen,

for the session: ok, fixed.

Another thing: how do you suggest to test that? Maybe as you do in connector/tests/test_job.py? Or maybe on a yaml test I create the wizard and run it, and then check that it created a job?

I suppose I cannot simply wait for the job to be done in the test, I need something better than that )

thanks a lot

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Implemented the ability to stop jobs in bulk, by unmarking the lines (same wizard, action='unmark').

Added two tests for the two workflows (mark and post normally, and mark and change your mind).

The date/period filters are not there yet, but I am asking for a review anyway (it should mark/unmark all moves, without filters)

Thanks!

152. By Leonardo Pistone

[fix] store the job after changing the state

153. By Leonardo Pistone

[imp] implement date and period filters

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Note: the date and period filters now work.

154. By Leonardo Pistone

[fix] typo

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

Hi,

Thanks for the contribs ! A few remarks of mine:

 * In import, use full path : from . import blabla (line 28, 29, 399)
 * In __openerp__.py:
   * please update the tag (update_xml, init_xml, ... are obsolete) use "data" instead
   * In the description, I will very much appreciate you explain here why to use this module , why it has been made so the user can understand what it bring compared to standard OpenERP
 * Add a i18n folder and the .pot file for translation

Otherwise LGTM, thanks for providing tests with it !

review: Needs Fixing (code review, no tests)
155. By Leonardo Pistone

[imp] relative imports

156. By Leonardo Pistone

[imp] batch_validate: manifest

157. By Leonardo Pistone

[add] batch validate: i18n template

Revision history for this message
Leonardo Pistone (lepistone) wrote :

joel, done, thanks for reviewing

Revision history for this message
Frederic Clementi - Camptocamp (frederic-clementi) wrote :

Test Ok on my side.

Just one comment : the current 'post entried' menu in periodical processing must be hidden if this module is installed

Thanks

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

Hi,

Thanks for the corrections, LGTM now !

Regards,

Joël

review: Approve (code review, no tests)
Revision history for this message
Leonardo Pistone (lepistone) wrote :

I checked about would happen in a multi-company environment where it is not OK that 'admin' does anything directly.

It turns out that my module does the post with the user taken from the session, which is the one that ran the wizard in the first place. Does that sound correct to you Frédéric?

thanks!

review: Needs Information
Revision history for this message
Frederic Clementi - Camptocamp (frederic-clementi) wrote :

sounds perfect
thanks :)

Revision history for this message
Leonardo Pistone (lepistone) wrote :

ok!

Then I 'abstain' to lift my own 'needs information'.

review: Abstain
158. By Leonardo Pistone

[imp] hide old menu for normal users

Revision history for this message
Leonardo Pistone (lepistone) wrote :

After a suggestion from Frédéric, I hid the old menuitem.

thanks

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Leonardo Pistone (lepistone) wrote :

Hi all,

thanks for you reviews, but another question came up just now.

Look at line 181:
i write the job UUID on the move, and then choose only the moves that have no UUIDs. Advantage: we never create many jobs for posting the same move.

Do you think this could be dangerous? Maybe there is a case where we actually need to create a new job to post the same move?

thanks!

159. By Leonardo Pistone

[fix] mark moves for posting a bit at a time to avoid MemoryError

160. By Leonardo Pistone

[imp] account_move_batch_validate: hide job uuid, make mark readonly

161. By Leonardo Pistone

[fix] typo

162. By Leonardo Pistone

[add] account_move_batch_validate: fr.po

Revision history for this message
Leonardo Pistone (lepistone) wrote :

I added the last 4 commits after an internal functional review.

It is just a little fix + translations added + view tweaks, so your reviews are not wasted!

thanks

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM Thanks !

review: Approve (code review, no tests)

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