[IMP]: account: [FOR TESTING ONLY] try to fix problem of opening move form view from web client
bzr revid: rpa@tinyerp.com-20120201114441-bmmn15cwr76bd6p7
This commit is contained in:
parent
7d8e648eaf
commit
534f64d798
|
@ -1271,7 +1271,9 @@ class account_move(osv.osv):
|
|||
'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}, select=True),
|
||||
'narration':fields.text('Internal Note'),
|
||||
'company_id': fields.related('journal_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),
|
||||
'balance': fields.float('balance', digits_compute=dp.get_precision('Account')),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'name': '/',
|
||||
'state': 'draft',
|
||||
|
@ -1354,6 +1356,15 @@ class account_move(osv.osv):
|
|||
'WHERE id IN %s', ('draft', tuple(ids),))
|
||||
return True
|
||||
|
||||
def onchange_line_id(self, cr, uid, ids, line_ids, context=None):
|
||||
print 'onchange_line_id..........', ids, line_ids
|
||||
balance = 0.0
|
||||
for line in line_ids:
|
||||
if line[2]:
|
||||
print line[2]['debit'], line[2]['credit']
|
||||
balance += (line[2]['debit'] or 0.00)- (line[2]['credit'] or 0.00)
|
||||
return {'value': {'balance': balance}}
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
|
|
@ -212,6 +212,7 @@ class account_move_line(osv.osv):
|
|||
return context
|
||||
|
||||
def _default_get(self, cr, uid, fields, context=None):
|
||||
print '___default get', context.get('lines')
|
||||
if context is None:
|
||||
context = {}
|
||||
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
|
||||
|
@ -228,13 +229,13 @@ class account_move_line(osv.osv):
|
|||
# Compute simple values
|
||||
data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
|
||||
# Starts: Manual entry from account.move form
|
||||
if context.get('lines',[]):
|
||||
total_new = 0.00
|
||||
for i in context['lines']:
|
||||
if i[2]:
|
||||
total_new += (i[2]['debit'] or 0.00)- (i[2]['credit'] or 0.00)
|
||||
for item in i[2]:
|
||||
data[item] = i[2][item]
|
||||
if context.get('lines'):
|
||||
total_new = context.get('lines', 0.00)
|
||||
# for i in eval(context['lines']):
|
||||
# if i[2]:
|
||||
# total_new += (i[2]['debit'] or 0.00)- (i[2]['credit'] or 0.00)
|
||||
# for item in i[2]:
|
||||
# data[item] = i[2][item]
|
||||
if context['journal']:
|
||||
journal_data = journal_obj.browse(cr, uid, context['journal'], context=context)
|
||||
if journal_data.type == 'purchase':
|
||||
|
|
|
@ -1364,7 +1364,10 @@
|
|||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Journal Items">
|
||||
<field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list" context="{'lines':line_id ,'journal':journal_id }">
|
||||
<field name="balance"/>
|
||||
<field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list"
|
||||
on_change="onchange_line_id(line_id)"
|
||||
context="{'lines': balance , 'journal': journal_id }">
|
||||
<form string="Journal Item">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name"/>
|
||||
|
|
Loading…
Reference in New Issue