[FIX] account: import payment lines on bank statement wizard now taking correct account for move line
bzr revid: vth@tinyerp.com-20101006052059-sujoj1g4n72gofda
This commit is contained in:
@@ -55,6 +55,7 @@ class account_bank_statement(osv.osv):
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_statement_from_invoice')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
context.update({'statement_id': ids[0]})
|
||||
|
||||
return {
|
||||
'name': _('Import Invoice'),
|
||||
'context': context,
|
||||
@@ -242,6 +243,7 @@ class account_bank_statement(osv.osv):
|
||||
account_id = st.journal_id.default_credit_account_id.id
|
||||
else:
|
||||
account_id = st.journal_id.default_debit_account_id.id
|
||||
|
||||
acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id
|
||||
amount = res_currency_obj.compute(cr, uid, st.currency.id,
|
||||
company_currency_id, st_line.amount, context=context,
|
||||
|
||||
@@ -143,6 +143,7 @@ class account_cash_statement(osv.osv):
|
||||
res[statement.id] -= res_currency_obj.compute(cursor,
|
||||
user, company_currency_id, currency_id,
|
||||
line.credit, context=context)
|
||||
|
||||
if statement.state in ('draft', 'open'):
|
||||
for line in statement.line_ids:
|
||||
res[statement.id] += line.amount
|
||||
@@ -383,7 +384,7 @@ class account_cash_statement(osv.osv):
|
||||
for end in st.ending_details_ids:
|
||||
cash_box_line_pool.write(cr, uid, [end.id], {'number':0})
|
||||
return True
|
||||
|
||||
|
||||
account_cash_statement()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -71,6 +71,10 @@ class account_payment_populate_statement(osv.osv_memory):
|
||||
ctx['date'] = line.ml_maturity_date # was value_date earlier,but this field exists no more now
|
||||
amount = currency_obj.compute(cr, uid, line.currency.id,
|
||||
statement.currency.id, line.amount_currency, context=ctx)
|
||||
|
||||
context.update({'move_line_ids': [line.move_line_id.id]})
|
||||
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context)
|
||||
|
||||
if line.partner_id:
|
||||
# line['partner_id'] = mv.partner_id.id
|
||||
if amount < 0 :
|
||||
@@ -83,7 +87,7 @@ class account_payment_populate_statement(osv.osv_memory):
|
||||
'name': line.name,
|
||||
'partner_id': line.partner_id.id,
|
||||
'journal_id': statement.journal_id.id,
|
||||
'account_id': account,
|
||||
'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id),
|
||||
'company_id': statement.company_id.id,
|
||||
'currency_id': statement.currency.id,
|
||||
'date': line.date or time.strftime('%Y-%m-%d'),
|
||||
@@ -91,8 +95,6 @@ class account_payment_populate_statement(osv.osv_memory):
|
||||
'period_id': statement.period_id.id
|
||||
}
|
||||
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
|
||||
context.update({'move_line_ids': [line.move_line_id.id]})
|
||||
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context)
|
||||
voucher_line_dict = False
|
||||
if result['value']['line_ids']:
|
||||
for line_dict in result['value']['line_ids']:
|
||||
|
||||
@@ -349,7 +349,6 @@ class account_voucher(osv.osv):
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
move_pool = self.pool.get('account.move')
|
||||
line_pool = self.pool.get('account.voucher.line')
|
||||
@@ -454,6 +453,7 @@ class account_voucher(osv.osv):
|
||||
default['value']['pre_line'] = 1
|
||||
elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
|
||||
default['value']['pre_line'] = 1
|
||||
|
||||
return default
|
||||
|
||||
def onchange_date(self, cr, user, ids, date, context={}):
|
||||
@@ -674,6 +674,7 @@ class account_voucher(osv.osv):
|
||||
move_line.update({
|
||||
'account_tax_id':inv.tax_id.id,
|
||||
})
|
||||
|
||||
master_line = move_line_pool.create(cr, uid, move_line)
|
||||
if line.move_line_id.id:
|
||||
rec_ids = [master_line, line.move_line_id.id]
|
||||
@@ -697,6 +698,7 @@ class account_voucher(osv.osv):
|
||||
else:
|
||||
account_id = inv.partner_id.property_account_payable.id
|
||||
move_line['account_id'] = account_id
|
||||
|
||||
move_line_id = move_line_pool.create(cr, uid, move_line)
|
||||
|
||||
self.write(cr, uid, [inv.id], {
|
||||
@@ -862,6 +864,7 @@ class account_bank_statement(osv.osv):
|
||||
voucher_obj = self.pool.get('account.voucher')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line_id, context=context)
|
||||
|
||||
if st_line.voucher_id:
|
||||
voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
|
||||
wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)
|
||||
|
||||
@@ -171,6 +171,7 @@ class account_statement_from_invoice(osv.osv_memory):
|
||||
|
||||
line_ids = line_obj.search(cr, uid, args,
|
||||
context=context)
|
||||
|
||||
model_data_ids = mod_obj.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_account_statement_from_invoice_lines')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
return {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<form string="Import Entries">
|
||||
<group colspan="4" expand="1">
|
||||
<separator string="Payable and Receivables" colspan="4"/>
|
||||
<field height="300" width="700" name="line_ids" colspan="4" nolabel="1" domain="[('account_id.type','in',['receivable','payable']), ('reconcile_id','=',False), ('reconcile_partial_id','=',False)]"/>
|
||||
<field height="300" width="700" name="line_ids" colspan="4" nolabel="1" domain="[('account_id.type','in',['receivable','payable']),('reconcile_id','=',False), ('reconcile_partial_id','=',False)]"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
@@ -48,7 +48,7 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_view_account_statement_from_invoice_lines" model="ir.actions.act_window">
|
||||
<field name="name">Import Entries</field>
|
||||
<field name="res_model">account.statement.from.invoice.lines</field>
|
||||
|
||||
Reference in New Issue
Block a user