Somesh Khare(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-577235-skh into
lp:openobject-addons/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-577235-skh/+merge/118350
Helo Sir,
[FIX]account: Confirming a customer invoice with the account have secondary
currency as company currency does not work.
Steps to reproduce:
1. Create 3 Account type: receivable:
400000 : no secondary currency
400001 : secondary currency = company currency (=EUR)
400002 : secondary currency = USD
2. Create a Customer Invoice "Invoice Currency = EUR" and select the account
400001 and Try to Confirm the invoice, Raise Error.
Kindly review the branch and please share your views on it.
Thanks
Somesh Khare
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-577235-skh/+merge/118350
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-577235-skh.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2012-07-04 16:33:07 +0000
+++ account/account_invoice.py 2012-08-06 13:00:32 +0000
@@ -924,6 +924,11 @@
_('You cannot create an invoice on a centralised journal. Uncheck the centralised counterpart box in the related journal from the configuration menu.'))
line = self.finalize_invoice_move_lines(cr, uid, inv, line)
+
+ currency_id = inv.company_id.currency_id.id
+ for i in line:
+ i[2]['currency_id'] = currency_id
+ i[2]['amount_currency'] = -i[2]['credit'] or i[2]['debit']
move = {
'ref': inv.reference and inv.reference or inv.name,
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py 2012-07-27 11:43:03 +0000
+++ account/account_move_line.py 2012-08-06 13:00:32 +0000
@@ -152,7 +152,6 @@
else:
move_line_total += (payment_line.debit - payment_line.credit)
line_total_in_company_currency += (payment_line.debit - payment_line.credit)
-
result = move_line_total
res[move_line.id]['amount_residual_currency'] = sign * (move_line.currency_id and self.pool.get('res.currency').round(cr, uid, move_line.currency_id, result) or result)
res[move_line.id]['amount_residual'] = sign * line_total_in_company_currency
@@ -1334,6 +1333,11 @@
'user_id': uid
})]
+ if not vals.get('currency_id'):
+ comp_curr = self.pool.get('res.company').browse(cr,uid,vals['company_id']).currency_id.id
+ vals.update(currency_id=comp_curr)
+
+
result = super(account_move_line, self).create(cr, uid, vals, context=context)
# CREATE Taxes
if vals.get('account_tax_id', False):
_______________________________________________
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