Merge lp:~camptocamp/account-invoicing/7.0_fix_period_in_refund_mdh into lp:~account-core-editors/account-invoicing/7.0

Proposed by Matthieu Dietrich @ camptocamp
Status: Merged
Approved by: Guewen Baconnier @ Camptocamp
Approved revision: 25
Merged at revision: 28
Proposed branch: lp:~camptocamp/account-invoicing/7.0_fix_period_in_refund_mdh
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 13 lines (+2/-2)
1 file modified
invoice_validation_wkfl/invoice.py (+2/-2)
To merge this branch: bzr merge lp:~camptocamp/account-invoicing/7.0_fix_period_in_refund_mdh
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Approve
Guewen Baconnier @ Camptocamp Approve
Review via email: mp+201180@code.launchpad.net

Commit message

[FIX] correctly retrieving period from form

Description of the change

Fixing an existing issue; if a period is filled out in the refund wizard, an issue is raised at validation: "Column 'period_id' is of type integer but expression is of type record".

I just fixed it as the journal above it; if it is present (aka. a record (id, name)), take the ID only instead of the tuple.

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

This is surely nitpicking, but you can just write:

    if form.get('period'):

As get() will return a None if the key is not present.

I made this tiny change.

review: Approve
25. By Guewen Baconnier @ Camptocamp

simplify statement

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I was going to propose the same change ;)

Regards.

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'invoice_validation_wkfl/invoice.py'
2--- invoice_validation_wkfl/invoice.py 2013-05-13 08:30:34 +0000
3+++ invoice_validation_wkfl/invoice.py 2014-01-10 13:21:26 +0000
4@@ -93,8 +93,8 @@
5 raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
6 if inv.reconciled and mode in ('cancel', 'modify'):
7 raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode))
8- if form['period']:
9- period = form['period']
10+ if form.get('period'):
11+ period = form['period'][0]
12 else:
13 period = inv.period_id and inv.period_id.id or False
14

Subscribers

People subscribed via source and target branches