Raphael Collet (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-res_rml_footer-rco into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-res_rml_footer-rco/+merge/124170

Reimplement a decent onchange method on res.company to generate the rml_footer.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-res_rml_footer-rco/+merge/124170
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-res_rml_footer-rco.
=== modified file 'account/account_bank.py'
--- account/account_bank.py	2012-07-10 23:35:03 +0000
+++ account/account_bank.py	2012-09-13 12:48:25 +0000
@@ -43,11 +43,15 @@
         "Return the name to use when creating a bank journal"
         return (bank.bank_name or '') + ' ' + bank.acc_number
 
-    def _prepare_name_get(self, cr, uid, bank_type_obj, bank_obj, context=None):
-        """Add ability to have %(currency_name)s in the format_layout of
-        res.partner.bank.type"""
-        bank_obj._data[bank_obj.id]['currency_name'] = bank_obj.currency_id and bank_obj.currency_id.name or ''
-        return super(bank, self)._prepare_name_get(cr, uid, bank_type_obj, bank_obj, context=context)
+    def _prepare_name_get(self, cr, uid, bank_dicts, context=None):
+        """Add ability to have %(currency_name)s in the format_layout of res.partner.bank.type"""
+        currency_ids = list(set(data['currency_id'][0] for data in bank_dicts if data['currency_id']))
+        currencies = self.pool.get('res.currency').browse(cr, uid, currency_ids, context=context)
+        currency_name = dict((currency.id, currency.name) for currency in currencies)
+
+        for data in bank_dicts:
+            data['currency_name'] = data['currency_id'] and currency_name[data['currency_id'][0]] or ''
+        return super(bank, self)._prepare_name_get(cr, uid, bank_dicts, context=context)
 
     def post_write(self, cr, uid, ids, context={}):
         if isinstance(ids, (int, long)):

=== modified file 'account/res_config.py'
--- account/res_config.py	2012-09-11 16:23:56 +0000
+++ account/res_config.py	2012-09-13 12:48:25 +0000
@@ -223,6 +223,16 @@
             return {'value': {'date_stop': end_date.strftime('%Y-%m-%d')}}
         return {}
 
+    def open_company_form(self, cr, uid, ids, context=None):
+        config = self.browse(cr, uid, ids[0], context)
+        return {
+            'type': 'ir.actions.act_window',
+            'name': 'Configure your Company',
+            'res_model': 'res.company',
+            'res_id': config.company_id.id,
+            'view_mode': 'form',
+        }
+
     def set_default_taxes(self, cr, uid, ids, context=None):
         """ set default sale and purchase taxes for products """
         ir_values = self.pool.get('ir.values')

=== modified file 'account/res_config_view.xml'
--- account/res_config_view.xml	2012-09-11 16:23:56 +0000
+++ account/res_config_view.xml	2012-09-13 12:48:25 +0000
@@ -224,10 +224,8 @@
                         <div>
                             <div>
                                 <label for="company_footer"/>
-                                <button name="%(action_bank_tree)d"
-                                    string="Configure your bank accounts"
-                                    icon="gtk-go-forward"
-                                    type="action"
+                                <button name="open_company_form" type="object"
+                                    string="Configure your company bank accounts" icon="gtk-go-forward"
                                     class="oe_inline oe_link"/>
                                 <field name="company_footer"/>
                             </div>

_______________________________________________
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