Bharat Devnani (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-791132-bde into 
lp:openobject-addons.

Requested reviews:
  Bharat Devnani (Open ERP) (bde-openerp)
  Mustufa Rangwala (Open ERP) (mra-tinyerp)
Related bugs:
  Bug #791132 in OpenERP Addons: "account_move_line insufficient error message"
  https://bugs.launchpad.net/openobject-addons/+bug/791132

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-791132-bde/+merge/63653

Hello Sir,

The warning message on wrong selection of journal is improved.

Thanks & Regards,
Devnani Bharat R.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-791132-bde/+merge/63653
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-791132-bde.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2011-05-30 14:14:51 +0000
+++ account/account_move_line.py	2011-06-09 09:52:32 +0000
@@ -1259,6 +1259,7 @@
                 else:
                     raise osv.except_osv(_('No piece number !'), _('Can not create an automatic sequence for this piece !\n\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.'))
         ok = not (journal.type_control_ids or journal.account_control_ids)
+        warning_msg = ''
         if ('account_id' in vals):
             account = account_obj.browse(cr, uid, vals['account_id'], context=context)
             if journal.type_control_ids:
@@ -1267,6 +1268,7 @@
                     if type.code == t.code:
                         ok = True
                         break
+                warning_msg += type.code
             if journal.account_control_ids and not ok:
                 for a in journal.account_control_ids:
                     if a.id == vals['account_id']:
@@ -1282,7 +1284,10 @@
                 vals['amount_currency'] = cur_obj.compute(cr, uid, account.company_id.currency_id.id,
                     account.currency_id.id, vals.get('debit', 0.0)-vals.get('credit', 0.0), context=ctx)
         if not ok:
-            raise osv.except_osv(_('Bad account !'), _('You can not use this general account in this journal !'))
+            if journal.type_control_ids and vals['account_id']:
+                raise osv.except_osv(_('Bad account !'), _("As '%s' Account Type is Restricted on '%s' journal so you can not create entries for '%s' (id:%d) Account !") % (warning_msg, journal.name, account.name, account.id))
+            if vals['account_id']:
+                raise osv.except_osv(_('Bad account !'), _("You can not create entries for '%s' (id:%d) Account as it is restricted on '%s' journal !") % (account.name, account.id, journal.name))
 
         if vals.get('analytic_account_id',False):
             if journal.analytic_journal_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