Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-578981-ado into
lp:openobject-addons/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
Related bugs:
Bug #1047656 in OpenERP Addons: "Journal Entry of supplier invoice with
account price diferent and back order is incorrect"
https://bugs.launchpad.net/openobject-addons/+bug/1047656
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578981-ado/+merge/123683
Hello,
"[FIX] journal entry is incorrect due to loop is executed twice if we have same
product in two lines of supplier invoice"
Steps:
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 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.
Regards,
Amit Dodiya
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578981-ado/+merge/123683
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-578981-ado.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2012-08-20 15:52:57 +0000
+++ account/account_invoice.py 2012-09-11 06:11:20 +0000
@@ -1476,6 +1476,7 @@
def move_line_get_item(self, cr, uid, line, context=None):
return {
+ 'id': line.id,
'type':'src',
'name': line.name[:64],
'price_unit':line.price_unit,
=== modified file 'account_anglo_saxon/invoice.py'
--- account_anglo_saxon/invoice.py 2012-02-15 16:06:28 +0000
+++ account_anglo_saxon/invoice.py 2012-09-11 06:11:20 +0000
@@ -28,6 +28,7 @@
def move_line_get(self, cr, uid, invoice_id, context=None):
res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context)
+ move_line_res = dict(map(lambda x: (x['id'], x), res))
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
company_currency = inv.company_id.currency_id.id
def get_price(cr, uid, inv, company_currency,i_line):
@@ -114,7 +115,9 @@
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
diff_res = []
# calculate and write down the possible price difference between invoice price and product price
- for line in res:
+ # get the movelines by comparing with line id
+ line = move_line_res.get(i_line.id, False)
+ if line:
if a == line['account_id'] and i_line.product_id.id == line['product_id']:
uom = i_line.product_id.uos_id or i_line.product_id.uom_id
standard_price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, i_line.product_id.standard_price, i_line.uos_id.id)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp