[FIX] account : replaced *args with context argument in action_move_create method of account/account_invoice.py
bzr revid: bde@tinyerp.com-20111214111527-9tgwh4u9lrg5ukvy
This commit is contained in:
parent
f699ba12d9
commit
25965aa35d
|
@ -794,12 +794,13 @@ class account_invoice(osv.osv):
|
|||
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,13 +812,12 @@ class account_invoice(osv.osv):
|
|||
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})
|
||||
context.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, context=ctx)
|
||||
iml = self._get_analytic_lines(cr, uid, inv.id, context=context)
|
||||
# check if taxes are all computed
|
||||
compute_taxes = ait_obj.compute(cr, uid, inv.id, context=ctx)
|
||||
compute_taxes = ait_obj.compute(cr, uid, inv.id, context=context)
|
||||
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
|
||||
|
||||
if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0):
|
||||
|
@ -835,7 +835,7 @@ class account_invoice(osv.osv):
|
|||
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, context=ctx)
|
||||
iml += ait_obj.move_line_get(cr, uid, inv.id, context=context)
|
||||
|
||||
entry_type = ''
|
||||
if inv.type in ('in_invoice', 'in_refund'):
|
||||
|
@ -864,10 +864,10 @@ class account_invoice(osv.osv):
|
|||
if totlines:
|
||||
res_amount_currency = total_currency
|
||||
i = 0
|
||||
ctx.update({'date': inv.date_invoice})
|
||||
context.update({'date': inv.date_invoice})
|
||||
for t in totlines:
|
||||
if inv.currency_id.id != company_currency:
|
||||
amount_currency = cur_obj.compute(cr, uid, company_currency, inv.currency_id.id, t[1], context=ctx)
|
||||
amount_currency = cur_obj.compute(cr, uid, company_currency, inv.currency_id.id, t[1], context=context)
|
||||
else:
|
||||
amount_currency = False
|
||||
|
||||
|
@ -926,9 +926,9 @@ class account_invoice(osv.osv):
|
|||
'narration':inv.comment
|
||||
}
|
||||
period_id = inv.period_id and inv.period_id.id or False
|
||||
ctx.update({'company_id': inv.company_id.id})
|
||||
context.update({'company_id': inv.company_id.id})
|
||||
if not period_id:
|
||||
period_ids = period_obj.find(cr, uid, inv.date_invoice, context=ctx)
|
||||
period_ids = period_obj.find(cr, uid, inv.date_invoice, context=context)
|
||||
period_id = period_ids and period_ids[0] or False
|
||||
if period_id:
|
||||
move['period_id'] = period_id
|
||||
|
|
Loading…
Reference in New Issue