← Back to team overview

credativ team mailing list archive

[Merge] lp:~credativ/openobject-addons/fix-885714 into lp:openobject-addons

 

Dmitrijs Ledkovs (credativ) has proposed merging lp:~credativ/openobject-addons/fix-885714 into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #885714 in OpenERP Addons: "[CRITICAL]  Payable & Receivable not calculate if (debit or credit) sum is NULL"
  https://bugs.launchpad.net/openobject-addons/+bug/885714

For more details, see:
https://code.launchpad.net/~credativ/openobject-addons/fix-885714/+merge/81161

 * Make debit/credit required fields
 * Make default value of 0.00

Without above the sql constraint

  ('credit_debit1', 'CHECK (credit*debit=0)',  'Wrong credit or debit value in accounting entry !')

can be by-passed if credit or debit is NULL
and as a side effect any SQL-reports/queries that do (debit-credit) will return NULL if one of the debit/credit is null and result in bugs as seen in bug #885714 (paybles&receivibles fields wrong in the partner record and aged partner balance report is wrong), from accounting point of view these are critical.

Affects trunk, 6.0
-- 
https://code.launchpad.net/~credativ/openobject-addons/fix-885714/+merge/81161
Your team Credativ is subscribed to branch lp:~credativ/openobject-addons/fix-885714.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2011-10-17 15:21:47 +0000
+++ account/account_move_line.py	2011-11-03 15:07:27 +0000
@@ -481,8 +481,8 @@
         '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 @@
         '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)


Follow ups