[REF]
bzr revid: mra@mra-laptop-20101018084434-jrvqfwc000qz6yau
This commit is contained in:
parent
0c6848602b
commit
637d2d53b1
|
@ -611,18 +611,18 @@ class account_voucher(osv.osv):
|
||||||
credit = 0.0
|
credit = 0.0
|
||||||
|
|
||||||
move_line = {
|
move_line = {
|
||||||
'name':inv.name or '/',
|
'name': inv.name or '/',
|
||||||
'debit':debit,
|
'debit': debit,
|
||||||
'credit':credit,
|
'credit': credit,
|
||||||
'account_id':inv.account_id.id,
|
'account_id': inv.account_id.id,
|
||||||
'move_id':move_id,
|
'move_id': move_id,
|
||||||
'journal_id':inv.journal_id.id,
|
'journal_id': inv.journal_id.id,
|
||||||
'period_id':inv.period_id.id,
|
'period_id': inv.period_id.id,
|
||||||
'partner_id':inv.partner_id.id,
|
'partner_id': inv.partner_id.id,
|
||||||
'currency_id':inv.currency_id.id,
|
'currency_id': inv.currency_id.id,
|
||||||
'amount_currency':inv.amount,
|
'amount_currency': inv.amount,
|
||||||
'date':inv.date,
|
'date': inv.date,
|
||||||
'date_maturity':inv.date_due
|
'date_maturity': inv.date_due
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0):
|
if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0):
|
||||||
|
@ -639,21 +639,20 @@ class account_voucher(osv.osv):
|
||||||
if not line.amount:
|
if not line.amount:
|
||||||
continue
|
continue
|
||||||
amount = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
|
amount = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
|
||||||
|
|
||||||
move_line = {
|
move_line = {
|
||||||
'journal_id':inv.journal_id.id,
|
'journal_id': inv.journal_id.id,
|
||||||
'period_id':inv.period_id.id,
|
'period_id': inv.period_id.id,
|
||||||
'name':line.name and line.name or '/',
|
'name': line.name and line.name or '/',
|
||||||
'account_id':line.account_id.id,
|
'account_id': line.account_id.id,
|
||||||
'move_id':move_id,
|
'move_id': move_id,
|
||||||
'partner_id':inv.partner_id.id,
|
'partner_id': inv.partner_id.id,
|
||||||
'currency_id':inv.currency_id.id,
|
'currency_id': inv.currency_id.id,
|
||||||
'amount_currency':line.amount,
|
'amount_currency': line.amount,
|
||||||
'analytic_account_id':line.account_analytic_id and line.account_analytic_id.id or False,
|
'analytic_account_id': line.account_analytic_id and line.account_analytic_id.id or False,
|
||||||
'quantity':1,
|
'quantity': 1,
|
||||||
'credit':0.0,
|
'credit': 0.0,
|
||||||
'debit':0.0,
|
'debit': 0.0,
|
||||||
'date':inv.date
|
'date': inv.date
|
||||||
}
|
}
|
||||||
if amount < 0:
|
if amount < 0:
|
||||||
amount = -amount
|
amount = -amount
|
||||||
|
@ -671,7 +670,7 @@ class account_voucher(osv.osv):
|
||||||
|
|
||||||
if inv.tax_id and inv.type in ('sale', 'purchase'):
|
if inv.tax_id and inv.type in ('sale', 'purchase'):
|
||||||
move_line.update({
|
move_line.update({
|
||||||
'account_tax_id':inv.tax_id.id,
|
'account_tax_id': inv.tax_id.id,
|
||||||
})
|
})
|
||||||
if move_line.get('account_tax_id', False):
|
if move_line.get('account_tax_id', False):
|
||||||
tax_data = tax_obj.browse(cr, uid, [move_line['account_tax_id']], context=context)[0]
|
tax_data = tax_obj.browse(cr, uid, [move_line['account_tax_id']], context=context)[0]
|
||||||
|
@ -716,12 +715,12 @@ class account_voucher(osv.osv):
|
||||||
|
|
||||||
def copy(self, cr, uid, id, default={}, context=None):
|
def copy(self, cr, uid, id, default={}, context=None):
|
||||||
default.update({
|
default.update({
|
||||||
'state':'draft',
|
'state': 'draft',
|
||||||
'number':False,
|
'number': False,
|
||||||
'move_id':False,
|
'move_id': False,
|
||||||
'line_cr_ids':False,
|
'line_cr_ids': False,
|
||||||
'line_dr_ids':False,
|
'line_dr_ids': False,
|
||||||
'reference':False
|
'reference': False
|
||||||
})
|
})
|
||||||
if 'date' not in default:
|
if 'date' not in default:
|
||||||
default['date'] = time.strftime('%Y-%m-%d')
|
default['date'] = time.strftime('%Y-%m-%d')
|
||||||
|
@ -774,7 +773,7 @@ class account_voucher_line(osv.osv):
|
||||||
'company_id': fields.related('voucher_id','company_id', relation='res.company', string='Company', store=True),
|
'company_id': fields.related('voucher_id','company_id', relation='res.company', string='Company', store=True),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'name': lambda *a: ''
|
'name': ''
|
||||||
}
|
}
|
||||||
|
|
||||||
def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}):
|
def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}):
|
||||||
|
@ -918,4 +917,4 @@ class account_bank_statement_line(osv.osv):
|
||||||
|
|
||||||
account_bank_statement_line()
|
account_bank_statement_line()
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:=======
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:=======
|
Loading…
Reference in New Issue