title: How to create custom config for custom Module in openerp 7
body: <p>How can i create the custom config for cuatom module in openerp 7as shown below</p>
  
  <p><img src="https://i.stack.imgur.com/SLn8g.png" alt="enter image description here"></p>
  
  <p>my python file</p>
  
  <pre><code>import logging
  import shipment_utility
  from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
  from openerp.osv import fields, osv
  
  _logger = logging.getLogger(__name__)
  
  class shipment_config_settings(osv.osv_memory):
      _name = 'shipment.config.settings'
      _inherit = 'res.config.settings'
      _columns = {
          'default_us_custom_id': fields.many2one('res.partner', 'Us Customs', domain=[('supplier', '=', 1)], help='Select The Us Customs For Generation of Custom statements Invoices'),
          'default_invoice_account_id': fields.many2one('account.account', 'Invoice Account',),
          'default_invoice_journal_id': fields.many2one('account.journal', 'Invoice Journal',),
          'default_invoice_line_account_id': fields.many2one('account.account', 'Invoice line Account',),
          'default_invoice_line_product_id': fields.many2one('product.product', 'Default Product',),
      }
  
      _defaults = {
          'default_us_custom_id': 1,
          #'default_invoice_account_id': "",
      }
  
      def get_default_us_custom_id(self, cr, uid, fields, context=None):
          search_ids = self.search(cr, uid, [])
          first_id = search_ids and min(search_ids)
          _logger.warning("ids " + str(search_ids))
          if not search_ids:
              return {'default_us_custom_id': ''}
          us_customs = self.browse(cr, uid, first_id, context)
          res = {}
          for field in fields:
              #_logger.warning("field " + str(field))
              res[field] = getattr(us_customs, field).id
          return res
  
      """def set_default_username(self, cr, uid, ids, context=None):
          #some code...
          #you can get the field content from some table and return it
          #as a example
          config = self.browse(cr, uid, ids[0], context)
          new_username = config.default_us_custom_id.id
          self.pool.get('shipment.config.settings').write(cr, uid, uid, {'default_us_custom_id': new_username})
  
  class shipment_config_settings_wizard(osv.osv_memory):
      _name = 'shipment.config.settings.wizard'
      _inherit = 'shipment.config.settings'
      _columns = {
          'default_us_custom_id': fields.many2one('res.partner', 'Us Customs', default_model='res.config.settings'),
      }"""
  
  
      def create(self, cr, uid, values, context=None):
          search_ids = self.search(cr, uid, [])
          first_id = search_ids and min(search_ids)
          #us_customs = self.browse(cr, uid, first_id, context)
          #_logger.warning("us custom " + str(us_customs.default_us_custom_id.name))
          res = {}
          #for field, val in values.iteritems():
          #    #_logger.warning("key = %s, val = %s" % (field, val))
          #    res[field] = val
          # DOWN STATEMENT IS DOING THE SAME WORK AS ABOVE COMMENTED LOOP
          res.update(values)
          if not first_id:
              return super(shipment_config_settings, self).create(cr, uid, res, context)
  
          self.write(cr, uid, first_id, res)
          return first_id
  </code></pre>
  
  <p>my view file </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;openerp&gt;
      &lt;data&gt;
          &lt;!-- Shipment config wizard --&gt;
          &lt;record id="view_shipment_config_settings" model="ir.ui.view"&gt;
              &lt;field name="name"&gt;Shipment Settings&lt;/field&gt;
              &lt;field name="model"&gt;shipment.config.settings&lt;/field&gt;
              &lt;field name="arch" type="xml"&gt;
                  &lt;form string="Configure Shipment" version="7.0" class="oe_form_configuration"&gt;
                      &lt;header&gt;
                          &lt;button string="Apply" type="object" name="execute" class="oe_highlight"/&gt;
                          or
                          &lt;button string="Cancel" type="object" name="cancel" class="oe_link"/&gt;
                      &lt;/header&gt;
                      &lt;div name="shipment.settings"&gt;
                          &lt;separator string="Shipment Configuration"/&gt;
                          &lt;group name="Supplier"&gt;
                              &lt;group&gt;
                                  &lt;field name="default_us_custom_id" class="oe_inline"/&gt;
                                  &lt;field name="default_invoice_account_id" class="oe_inline"/&gt;
                                  &lt;field name="default_invoice_journal_id" class="oe_inline"/&gt;
                                  &lt;field name="default_invoice_line_account_id" class="oe_inline"/&gt;
                                  &lt;field name="default_invoice_line_product_id" class="oe_inline"/&gt;
                              &lt;/group&gt;
                              &lt;group&gt;
                                  &lt;label for="default_us_custom_id" string="Select US Custom Supplier"/&gt;
                              &lt;/group&gt;
                          &lt;/group&gt;
                      &lt;/div&gt;
  
                      &lt;div name="config_other"/&gt;
                  &lt;/form&gt;
              &lt;/field&gt;
          &lt;/record&gt;
  
          &lt;record id="action_shipment_config" model="ir.actions.act_window"&gt;
              &lt;field name="name"&gt;Configure Shipment&lt;/field&gt;
              &lt;field name="type"&gt;ir.actions.act_window&lt;/field&gt;
              &lt;field name="res_model"&gt;shipment.config.settings&lt;/field&gt;
              &lt;field name="view_id" ref="view_shipment_config_settings"/&gt;
              &lt;field name="view_mode"&gt;form&lt;/field&gt;
              &lt;field name="target"&gt;inline&lt;/field&gt;
          &lt;/record&gt;
  
      &lt;menuitem id="base.menu_shipment_config" name="Shipment" parent="base.menu_config" sequence="10"
                action="action_shipment_config"/&gt;
  
          &lt;menuitem id="menu_item_config" parent="menu_section_config" name="US Custom Invoicing"
                    action="action_shipment_config"/&gt;
  
      &lt;/data&gt;
  &lt;/openerp&gt;
  </code></pre>