Saurang Suthar(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1002941-ssu into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1002941 in OpenERP Addons: "[account] It is possible to create a Journal 
Item with the Amount Currency having the wrong sign"
  https://bugs.launchpad.net/openobject-addons/+bug/1002941

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1002941-ssu/+merge/132661

Hello,

I have fixed the issue of creating a Journal Item with the Amount Currency 
having the wrong sign by putting validation for amount_currency field if it 
will be negative.

Kindly review it.

Thank you.
Saurang Suthar
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1002941-ssu/+merge/132661
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1002941-ssu.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2012-10-24 20:14:24 +0000
+++ account/account_move_line.py	2012-11-02 08:49:22 +0000
@@ -613,12 +613,19 @@
                     return False
         return True
 
+    def _check_amount_currency(self, cr, uid, ids, context=None):
+        for l in self.browse(cr, uid, ids, context=context):
+            if l.amount_currency < 0.0:
+                return False
+        return True
+
     _constraints = [
         (_check_no_view, 'You cannot create journal items on an account of type view.', ['account_id']),
         (_check_no_closed, 'You cannot create journal items on closed account.', ['account_id']),
         (_check_company_id, 'Account and Period must belong to the same company.', ['company_id']),
         (_check_date, 'The date of your Journal Entry is not in the defined period! You should change the date or remove this constraint from the journal.', ['date']),
         (_check_currency, 'The selected account of your Journal Entry forces to provide a secondary currency. You should remove the secondary currency on the account or select a multi-currency view on the journal.', ['currency_id']),
+        (_check_amount_currency, 'The Amount Currency must not be less than zero.', ['amount_currency']),
     ]
 
     #TODO: ONCHANGE_ACCOUNT_ID: set account_tax_id

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to