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
=== modified file 'account_invoice_merge/invoice.py'
--- account_invoice_merge/invoice.py 2014-03-19 12:17:03 +0000
+++ account_invoice_merge/invoice.py 2014-07-02 08:34:34 +0000
@@ -129,7 +129,8 @@
129 o_line = invoice_infos['invoice_line'].setdefault(line_key, {})129 o_line = invoice_infos['invoice_line'].setdefault(line_key, {})
130 if o_line:130 if o_line:
131 # merge the line with an existing line131 # merge the line with an existing line
132 o_line['quantity'] += invoice_line.quantity * invoice_line.uos_id.factor / o_line['uom_factor']132 uos_factor = invoice_line.uos_id and invoice_line.uos_id.factor or 1.0
133 o_line['quantity'] += invoice_line.quantity * uos_factor / o_line['uom_factor']
133 else:134 else:
134 # append a new "standalone" line135 # append a new "standalone" line
135 for field in ('quantity', 'uos_id'):136 for field in ('quantity', 'uos_id'):

Subscribers

People subscribed via source and target branches