Merge lp:~openerp-dev/openobject-addons/6.1-opw-578981-ado into lp:openobject-addons/6.1

Proposed by Amit Dodiya (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 6984
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-578981-ado
Merge into: lp:openobject-addons/6.1
Diff against target: 34 lines (+5/-1)
2 files modified
account/ (+1/-0)
account_anglo_saxon/ (+4/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-578981-ado
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Xavier ALT Pending
Review via email:

Description of the change


"[FIX] journal entry is incorrect due to loop is executed twice if we have same product in two lines of supplier invoice"

1). Install account_anglo_saxon, select any product and set Inventory Valuation = "Realtime Automated", set price diffrence account & input account & output account, set a cost price = 330 on above product.

2). Now make a supplier invoice with 2 line for same product with 1 quantity of 400(70 price diffrence) and validate the invoice.
You will see the residual amount is changed to 940 due to two extra move is created(of 70) for price difference so the residual is 940 instead of 800.

Amit Dodiya

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :


This bug was qualified as Confirmed on Trunk (means still existing and reproducible). A Merge Proposal for trunk was created to fix it. Here is the link to follow the MP on Launchpad and be informed once it's been merged in trunk: ... If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Naresh Soni

Unmerged revisions

6984. By Amit Dodiya<email address hidden>

[FIX] journal entry is incorrect due to loop is executed twice if we have same product in two lines of supplier invoice

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/'
2--- account/ 2012-08-20 15:52:57 +0000
3+++ account/ 2012-09-11 06:11:20 +0000
4@@ -1476,6 +1476,7 @@
6 def move_line_get_item(self, cr, uid, line, context=None):
7 return {
8+ 'id':,
9 'type':'src',
10 'name':[:64],
11 'price_unit':line.price_unit,
13=== modified file 'account_anglo_saxon/'
14--- account_anglo_saxon/ 2012-02-15 16:06:28 +0000
15+++ account_anglo_saxon/ 2012-09-11 06:11:20 +0000
16@@ -28,6 +28,7 @@
18 def move_line_get(self, cr, uid, invoice_id, context=None):
19 res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context)
20+ move_line_res = dict(map(lambda x: (x['id'], x), res))
21 inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
22 company_currency =
23 def get_price(cr, uid, inv, company_currency,i_line):
24@@ -114,7 +115,9 @@
25 a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
26 diff_res = []
27 # calculate and write down the possible price difference between invoice price and product price
28- for line in res:
29+ # get the movelines by comparing with line id
30+ line = move_line_res.get(, False)
31+ if line:
32 if a == line['account_id'] and == line['product_id']:
33 uom = i_line.product_id.uos_id or i_line.product_id.uom_id
34 standard_price = self.pool.get('product.uom')._compute_price(cr, uid,, i_line.product_id.standard_price,