Bharat Devnani (Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-710533-bde into
lp:openobject-addons.
Requested reviews:
Bharat Devnani (Open ERP) (bde-openerp)
Mustufa Rangwala (Open ERP) (mra-tinyerp)
Related bugs:
Bug #710533 in OpenERP Addons: "account invoice model translation problem
with no context param"
https://bugs.launchpad.net/openobject-addons/+bug/710533
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-710533-bde/+merge/85293
Hello Sir,
I have passed context agruments in some methods of account/account_invoice.py.
Thanks & Regards,
Devnani Bharat R.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-710533-bde/+merge/85293
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-710533-bde.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2011-12-14 09:35:31 +0000
+++ account/account_invoice.py 2011-12-15 09:10:29 +0000
@@ -794,12 +794,13 @@
line.append((0,0,val))
return line
- def action_move_create(self, cr, uid, ids, *args):
+ def action_move_create(self, cr, uid, ids, context=None):
"""Creates invoice related analytics and financial move lines"""
ait_obj = self.pool.get('account.invoice.tax')
cur_obj = self.pool.get('res.currency')
period_obj = self.pool.get('account.period')
- context = {}
+ if context is None:
+ context = {}
for inv in self.browse(cr, uid, ids):
if not inv.journal_id.sequence_id:
raise osv.except_osv(_('Error !'), _('Please define sequence on invoice journal'))
@@ -811,12 +812,12 @@
if not inv.date_invoice:
self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')})
company_currency = inv.company_id.currency_id.id
+ ctx = context.copy()
+ ctx.update({'lang': inv.partner_id.lang})
# create the analytical lines
# one move line per invoice line
- iml = self._get_analytic_lines(cr, uid, inv.id)
+ iml = self._get_analytic_lines(cr, uid, inv.id, context=ctx)
# check if taxes are all computed
- ctx = context.copy()
- ctx.update({'lang': inv.partner_id.lang})
compute_taxes = ait_obj.compute(cr, uid, inv.id, context=ctx)
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
@@ -835,7 +836,7 @@
raise osv.except_osv(_('Error !'), _("Can not create the invoice !\nThe related payment term is probably misconfigured as it gives a computed amount greater than the total invoiced amount."))
# one move line per tax line
- iml += ait_obj.move_line_get(cr, uid, inv.id)
+ iml += ait_obj.move_line_get(cr, uid, inv.id, context=ctx)
entry_type = ''
if inv.type in ('in_invoice', 'in_refund'):
@@ -906,7 +907,7 @@
date = inv.date_invoice or time.strftime('%Y-%m-%d')
part = inv.partner_id.id
- line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})),iml)
+ line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context=context)),iml)
line = self.group_lines(cr, uid, iml, line, inv)
@@ -1611,7 +1612,7 @@
t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount'])
return tax_grouped
- def move_line_get(self, cr, uid, invoice_id):
+ def move_line_get(self, cr, uid, invoice_id, context=None):
res = []
cr.execute('SELECT * FROM account_invoice_tax WHERE invoice_id=%s', (invoice_id,))
for t in cr.dictfetchall():
=== modified file 'account_analytic_plans/account_analytic_plans.py'
--- account_analytic_plans/account_analytic_plans.py 2011-10-16 01:28:00 +0000
+++ account_analytic_plans/account_analytic_plans.py 2011-12-15 09:10:29 +0000
@@ -380,7 +380,7 @@
res['analytics_id'] = x.get('analytics_id', False)
return res
- def _get_analytic_lines(self, cr, uid, id):
+ def _get_analytic_lines(self, cr, uid, id, context=None):
inv = self.browse(cr, uid, [id])[0]
cur_obj = self.pool.get('res.currency')
invoice_line_obj = self.pool.get('account.invoice.line')
@@ -391,7 +391,7 @@
else:
sign = -1
- iml = invoice_line_obj.move_line_get(cr, uid, inv.id)
+ iml = invoice_line_obj.move_line_get(cr, uid, inv.id, context=context)
for il in iml:
if il.get('analytics_id', False):
=== modified file 'analytic_journal_billing_rate/analytic_journal_billing_rate.py'
--- analytic_journal_billing_rate/analytic_journal_billing_rate.py 2011-04-29 08:49:48 +0000
+++ analytic_journal_billing_rate/analytic_journal_billing_rate.py 2011-12-15 09:10:29 +0000
@@ -100,8 +100,8 @@
class account_invoice(osv.osv):
_inherit = "account.invoice"
- def _get_analytic_lines(self, cr, uid, id):
- iml = super(account_invoice, self)._get_analytic_lines(cr, uid, id)
+ def _get_analytic_lines(self, cr, uid, id, context=None):
+ iml = super(account_invoice, self)._get_analytic_lines(cr, uid, id, context=context)
for il in iml:
if il['account_analytic_id'] and il.get('analytic_lines', False):
=== modified file 'hr_timesheet_invoice/hr_timesheet_invoice.py'
--- hr_timesheet_invoice/hr_timesheet_invoice.py 2011-11-16 14:59:58 +0000
+++ hr_timesheet_invoice/hr_timesheet_invoice.py 2011-12-15 09:10:29 +0000
@@ -169,8 +169,8 @@
class account_invoice(osv.osv):
_inherit = "account.invoice"
- def _get_analytic_lines(self, cr, uid, id):
- iml = super(account_invoice, self)._get_analytic_lines(cr, uid, id)
+ def _get_analytic_lines(self, cr, uid, id, context=None):
+ iml = super(account_invoice, self)._get_analytic_lines(cr, uid, id, context=context)
inv = self.browse(cr, uid, [id])[0]
if inv.type == 'in_invoice':
_______________________________________________
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