Merge lp:~factorlibre/account-invoicing/account-invoicing-fix-merge-7.0 into lp:~account-core-editors/account-invoicing/7.0

Proposed by Hugo Santos (Factorlibre)
Status: Needs review
Proposed branch: lp:~factorlibre/account-invoicing/account-invoicing-fix-merge-7.0
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 13 lines (+2/-1)
1 file modified
account_invoice_merge/invoice.py (+2/-1)
To merge this branch: bzr merge lp:~factorlibre/account-invoicing/account-invoicing-fix-merge-7.0
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Leonardo Pistone Needs Fixing
Review via email: mp+225271@code.launchpad.net

Description of the change

UoS Maybe not defined in invoice line so is not possible to obtain the factor from there. In that case factor must be 1.0 like when assigning o_line['uom_factor']

To post a comment you must log in.
Revision history for this message
Leonardo Pistone (lepistone) wrote :

Hi Hugo.

can you include an automated test to show which situation breaks and is fixed with the patch?

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

This project is now hosted on https://github.com/OCA/account-invoicing. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting

Unmerged revisions

50. By Hugo Santos (Factorlibre)

[Fix] invoice line uos_id maybe not defined so factor can't be used from there

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_invoice_merge/invoice.py'
2--- account_invoice_merge/invoice.py 2014-03-19 12:17:03 +0000
3+++ account_invoice_merge/invoice.py 2014-07-02 08:34:34 +0000
4@@ -129,7 +129,8 @@
5 o_line = invoice_infos['invoice_line'].setdefault(line_key, {})
6 if o_line:
7 # merge the line with an existing line
8- o_line['quantity'] += invoice_line.quantity * invoice_line.uos_id.factor / o_line['uom_factor']
9+ uos_factor = invoice_line.uos_id and invoice_line.uos_id.factor or 1.0
10+ o_line['quantity'] += invoice_line.quantity * uos_factor / o_line['uom_factor']
11 else:
12 # append a new "standalone" line
13 for field in ('quantity', 'uos_id'):

Subscribers

People subscribed via source and target branches