Ravish(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-932825-rmu into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #932825 in OpenERP Addons: "compute_invoice_totals method of
account.invoice loses context"
https://bugs.launchpad.net/openobject-addons/+bug/932825
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-932825-rmu/+merge/114177
Hello,
I have added context in account invoice's compute_invoice_totals method.
because,context values set by 'compute' method of 'res.currency' are lost.Now
working fine.
Thanks ..!!!
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-932825-rmu/+merge/114177
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-932825-rmu.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2012-06-01 12:15:47 +0000
+++ account/account_invoice.py 2012-07-10 12:15:35 +0000
@@ -767,17 +767,20 @@
if not key in tax_key:
raise osv.except_osv(_('Warning !'), _('Taxes are missing!\nClick on compute button.'))
- def compute_invoice_totals(self, cr, uid, inv, company_currency, ref, invoice_move_lines):
+ def compute_invoice_totals(self, cr, uid, inv, company_currency, ref, invoice_move_lines,context=None):
+ if context is None:
+ context={}
total = 0
total_currency = 0
cur_obj = self.pool.get('res.currency')
for i in invoice_move_lines:
if inv.currency_id.id != company_currency:
+ context.update({'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
i['currency_id'] = inv.currency_id.id
i['amount_currency'] = i['price']
i['price'] = cur_obj.compute(cr, uid, inv.currency_id.id,
company_currency, i['price'],
- context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
+ context=context)
else:
i['amount_currency'] = False
i['currency_id'] = False
@@ -887,7 +890,7 @@
# create one move line for the total and possibly adjust the other lines amount
total = 0
total_currency = 0
- total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml)
+ total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml,context=ctx)
acc_id = inv.account_id.id
name = inv['name'] or '/'
_______________________________________________
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