Merge lp:~openerp-dev/openobject-addons/trunk-opw-578981-port-mma into lp:openobject-addons

Proposed by Mayur Maheshwari(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-opw-578981-port-mma
Merge into: lp:openobject-addons
Diff against target: 33 lines (+4/-1)
2 files modified
account/account_invoice.py (+1/-0)
account_anglo_saxon/invoice.py (+3/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-opw-578981-port-mma
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+135322@code.launchpad.net

Description of the change

Hello,

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

Steps:
==>. Install account_Anglo_Saxon, select any product and set Inventory Valuation = "Real-time Automated", set price difference account & input account & output account, set a cost price = 330 on above product.

==>. Now make a supplier invoice with 2 line for same product with 1 quantity of 400(70 price difference) 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.

code is forward port from 6.1

Thanks,
Mayur

To post a comment you must log in.

Unmerged revisions

8086. By Amit Dodiya (OpenERP)

[FIX]account: 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/account_invoice.py'
2--- account/account_invoice.py 2012-11-20 11:36:00 +0000
3+++ account/account_invoice.py 2012-11-21 06:31:19 +0000
4@@ -1556,6 +1556,7 @@
5
6 def move_line_get_item(self, cr, uid, line, context=None):
7 return {
8+ 'id': line.id,
9 'type':'src',
10 'name': line.name.split('\n')[0][:64],
11 'price_unit':line.price_unit,
12
13=== modified file 'account_anglo_saxon/invoice.py'
14--- account_anglo_saxon/invoice.py 2012-11-15 12:38:51 +0000
15+++ account_anglo_saxon/invoice.py 2012-11-21 06:31:19 +0000
16@@ -28,6 +28,7 @@
17
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 = inv.company_id.currency_id.id
23 def get_price(cr, uid, inv, company_currency,i_line):
24@@ -114,7 +115,8 @@
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+ line = move_line_res.get(i_line.id, False)
30+ if line:
31 if a == line['account_id'] and i_line.product_id.id == line['product_id']:
32 uom = i_line.product_id.uos_id or i_line.product_id.uom_id
33 standard_price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.standard_price, i_line.uos_id.id)

Subscribers

People subscribed via source and target branches

to all changes: