view
  • openerp
  • 2014-01-27 149 views 1 likes 
    1

    我想創建一個模塊,存儲一個夥伴的多個地址。我的問題是與視圖部分,只有城市領域是可見的形式其他領域是不可見的,當單擊「添加項目」時,地址字段是隨機序列像郵政編碼先來,然後街道等。openerp one2many問題與視圖

    請建議如何繼續以便所有字段都可見?

    class extendcustomersaddress(orm.Model): 
        _name="res.partner" 
        _inherit = 'res.partner' 
        _columns = 
        { 
        'extraaddress':fields.one2many('seq.address','x_client_id','Address') 
        } 
    
    extendcustomersaddress() 
    
    class related_address(orm.Model): 
        _name="seq.address" 
        _columns = 
        { 
        'x_street' : fields.char('Street', size=170), 
        'x_street1' : fields.char('Street1', size=170), 
        'x_city' : fields.char('City', size=170), 
        'x_state' : fields.char('state', size=170), 
        'x_zip' : fields.char('Zip code', size=10), 
        'x_country' : fields.many2one('res.country', 'Country'), 
        'x_client_id': fields.many2one('res.partner', 'id',invisible=True) 
        } 
    
    related_address() 
    
    <openerp> 
        <data> 
        <record model="ir.ui.view" id="namelist_dailyupdate"> 
         <field name="name">res.partner.form</field> <field name="model">res.partner</field> 
    
         <field name="inherit_id" ref="base.view_partner_form" /> 
         <field name="type">form</field> 
         <field name="arch" type="xml"> 
         <notebook position="inside"> 
         <page string="Email"> 
          <separator string="Additional Emails" colspan="4"/> 
          <tree name="abcd" editable="Bottom"> 
           <field name="extraaddress" /> 
          </tree> 
    
         </page> 
         </notebook> 
    
        </field> 
        </record> 
    
        </data> 
    </openerp> 
    

    回答

    2

    試試這個,

    <openerp> 
        <data> 
        <record model="ir.ui.view" id="namelist_dailyupdate"> 
        <field name="name">res.partner.form</field> <field name="model">res.partner</field> 
    
        <field name="inherit_id" ref="base.view_partner_form" /> 
        <field name="type">form</field> 
        <field name="arch" type="xml"> 
        <notebook position="inside"> 
        <page string="Email"> 
         <separator string="Additional Emails" colspan="4"/> 
          <field name="extraaddress"> 
           <tree string="Extra Addresses" editable="bottom"> 
            <field name="x_street"/> 
            <field name="x_street1"/> 
            <field name="x_city"/> 
            <field name="x_zip"/> 
            <field name="x_state"/> 
            <field name="x_country"/> 
           </tree> 
          </field> 
         </page> 
         </notebook> 
        </field> 
        </record> 
        </data> 
    </openerp> 
    
    +0

    非常感謝曼西,它的工作原理。 – Vaibhav

    0

    你必須創建一個視圖模型seq.address您可以添加res.partner視圖或單獨視圖(包括treeform)內聯視圖

    對於〔實施例中銷售順序,請sale_view.xml

    相關問題