qdp (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/trunk-improve-addons27-vja into 
lp:openobject-server.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-improve-addons27-vja/+merge/139434
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-improve-addons27-vja/+merge/139434
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/trunk-improve-addons27-vja.
=== modified file 'openerp/addons/base/res/res_company.py'
--- openerp/addons/base/res/res_company.py	2012-11-02 16:28:05 +0000
+++ openerp/addons/base/res/res_company.py	2012-12-12 10:45:56 +0000
@@ -123,7 +123,7 @@
         'street2': fields.function(_get_address_data, fnct_inv=_set_address_data, size=128, type='char', string="Street2", multi='address'),
         'zip': fields.function(_get_address_data, fnct_inv=_set_address_data, size=24, type='char', string="Zip", multi='address'),
         'city': fields.function(_get_address_data, fnct_inv=_set_address_data, size=24, type='char', string="City", multi='address'),
-        'state_id': fields.function(_get_address_data, fnct_inv=_set_address_data, type='many2one', domain="[('country_id', '=', country_id)]", relation='res.country.state', string="Fed. State", multi='address'),
+        'state_id': fields.function(_get_address_data, fnct_inv=_set_address_data, type='many2one', relation='res.country.state', string="Fed. State", multi='address'),
         'bank_ids': fields.one2many('res.partner.bank','company_id', 'Bank Accounts', help='Bank accounts related to this company'),
         'country_id': fields.function(_get_address_data, fnct_inv=_set_address_data, type='many2one', relation='res.country', string="Country", multi='address'),
         'email': fields.function(_get_address_data, fnct_inv=_set_address_data, size=64, type='char', string="Email", multi='address'),
@@ -160,7 +160,11 @@
             res += '\n%s: %s' % (title, ', '.join(name for id, name in account_names))
 
         return {'value': {'rml_footer': res, 'rml_footer_readonly': res}}
-
+    def onchange_state(self, cr, uid, ids, state_id, context=None):
+        if state_id:
+            country_id = self.pool.get('res.country.state').browse(cr, uid, state_id, context).country_id.id
+            return {'value':{'country_id':country_id}}
+        return {}
     def on_change_country(self, cr, uid, ids, country_id, context=None):
         currency_id = self._get_euro(cr, uid, context=context)
         if country_id:

=== modified file 'openerp/addons/base/res/res_company_view.xml'
--- openerp/addons/base/res/res_company_view.xml	2012-11-06 07:31:56 +0000
+++ openerp/addons/base/res/res_company_view.xml	2012-12-12 10:45:56 +0000
@@ -46,7 +46,7 @@
                                         <field name="street2"/>
                                         <div>
                                             <field name="city" placeholder="City" style="width: 40%%"/>
-                                            <field name="state_id" class="oe_no_button" placeholder="State" style="width: 24%%" options='{"no_open": True}'/>
+                                            <field name="state_id" class="oe_no_button" placeholder="State" on_change="onchange_state(state_id)" style="width: 24%%" options='{"no_open": True}'/>
                                             <field name="zip" placeholder="ZIP" style="width: 34%%"/>
                                         </div>
                                         <field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}' on_change="on_change_country(country_id)"/>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to