[FIX] Calculate correct parter payables & receivables if debit/credit are NULL

Set a "not null" constraint on debit and credit columns of account_move_lines
to prevent similar sql errors in the future.

lp bug: https://launchpad.net/bugs/885714 fixed

bzr revid: dmitrijs.ledkovs@credativ.co.uk-20111103145242-zu13vwjv2hdxbqjl
This commit is contained in:
Dmitrijs Ledkovs 2011-11-03 14:52:42 +00:00
parent ad7e2a5ee9
commit 3f8ae50046
1 changed files with 4 additions and 2 deletions

View File

@ -481,8 +481,8 @@ class account_move_line(osv.osv):
'quantity': fields.float('Quantity', digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very useful for some reports."),
'product_uom_id': fields.many2one('product.uom', 'UoM'),
'product_id': fields.many2one('product.product', 'Product'),
'debit': fields.float('Debit', digits_compute=dp.get_precision('Account')),
'credit': fields.float('Credit', digits_compute=dp.get_precision('Account')),
'debit': fields.float('Debit', digits_compute=dp.get_precision('Account'), required=True),
'credit': fields.float('Credit', digits_compute=dp.get_precision('Account'), required=True),
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
'move_id': fields.many2one('account.move', 'Move', ondelete="cascade", help="The move of this entry line.", select=2, required=True),
'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Internal Note'),
@ -559,6 +559,8 @@ class account_move_line(osv.osv):
'state': 'draft',
'currency_id': _get_currency,
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),
'credit': 0.0,
'debit': 0.0,
'account_id': lambda self, cr, uid, c: c.get('account_id', False),
'period_id': lambda self, cr, uid, c: c.get('period_id', False),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.move.line', context=c)