← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-752876-pso into lp:openobject-addons

 

pso (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-752876-pso into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #752876 in OpenERP Addons: "The field account_id has a wrong domain in account move line tree view"
  https://bugs.launchpad.net/openobject-addons/+bug/752876

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-752876-pso/+merge/56761

Fixed bug: 752876 (https://bugs.launchpad.net/openobject-addons/+bug/752876)
account_id has a wrong domain in account move line tree view.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-752876-pso/+merge/56761
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-752876-pso.
=== modified file 'account/account_move_line.py'
--- account/account_move_line.py	2011-03-25 15:38:54 +0000
+++ account/account_move_line.py	2011-04-07 13:22:45 +0000
@@ -933,6 +933,12 @@
             'context':context,
         }
 
+    def onchange_journal_id(self, cr, user, ids, journal_id, context=None):
+        if journal_id:
+            return {'domain' : {'account_id' : [('journal_id', '=', journal_id), ('type','<>','view'), ('type','<>','closed')]}}
+        else:
+            return {'domain' : {'account_id' : [('type','<>','view'), ('type','<>','closed')]}}
+
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
         journal_pool = self.pool.get('account.journal')
         if context is None:
@@ -1013,13 +1019,13 @@
                 attrs.append("context=\"{'journal_id': journal_id}\"")
 
             elif field == 'account_id' and journal.id:
-                attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'&lt;&gt;\',\'view\'), (\'type\',\'&lt;&gt;\',\'closed\')]" on_change="onchange_account_id(account_id, partner_id)"')
+                attrs.append('on_change="onchange_account_id(account_id, partner_id)"')
 
             elif field == 'partner_id':
                 attrs.append('on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"')
 
             elif field == 'journal_id':
-                attrs.append("context=\"{'journal_id': journal_id}\"")
+                attrs.append("on_change=\"onchange_journal_id(journal_id)\" context=\"{'journal_id': journal_id}\"")
 
             elif field == 'statement_id':
                 attrs.append("domain=\"[('state', '!=', 'confirm'),('journal_id.type', '=', 'bank')]\"")


Follow ups