2014-01-31 60 views
0
禁用多於10場

我創建了一個新的模塊,並加入10個字段it.Now我應該能夠第一隻5字段中輸入並支付我應該能夠進入下一個5 fields.Can任何人都請幫助我。需要的OpenERP

我希望我的銷售人員先輸入基本的詳細信息(如姓名,地址及電話號碼),後來付款後我想更新家長的全部細節和他們的聯繫信息。 感謝的提前

我的代碼是

lead_view.xml

<?xml version="1.0" encoding="utf-8"?> 
<openerp> 
<data> 
<!-- ===================== This is tree layout =============================--> 
<record id="lead_tree" model="ir.ui.view"> 
     <field name="name">Lead</field> 
     <field name="model">res.partner</field> 
     <field name="arch" type="xml"> 
      <tree string="lead"> 
       <field name = "name"/> 
      </tree> 
     </field> 
    </record> 

<!-- ========================This is Form layout===============================--> 
    <record id="view_res_partner_inherited" model="ir.ui.view"> 
     <field name="name">view.res.partner.inherited</field> 
     <field name="model">res.partner</field> 
     <field name="inherit_id" ref="base.view_partner_form" /> 
     <field name="arch" type="xml"> 
      <data> 
       <field name="website" position="replace"/> 
       <field name="title" position="replace"/> 
       <field name="function" position="replace"/> 
       <field name="category_id" position="replace"/> 
       <page string="Internal Notes" position="before"> 
        <page string="Contract"> 
         <group> 
          <group> 
           <h3>Contract Details</h3><br/> 
           <field name="storagedetails"/> 
           <field name="insurancecompany"/> 
           <field name="insurancenumber"/> 
           <field name="healthfund_name"/> 
           <field name="healthfund_number"/> 
           <field name="service"/> 
           <field name="annualfee"/> 
           <field name="paymentplan"/> 
           <field name="transport_insurance"/> 
           <field name="sarm"/> 
           <field name="cost_free_donation"/> 
           <field name="hla_test"/> 
           <field name="twins"/> 
           <field name="repeated_customer"/> 
          </group> 
          <group> 
           <h3>Relevant Dates</h3><br/> 
           <field name="contactadded_date"/> 
           <field name="clientadded_date"/> 
           <field name="expectedbirth_date"/> 
           <field name="bloodrecieved_date"/> 
           <field name="bloodstorage_date"/> 
           <field name="cordrecieved_date"/> 
           <field name="cordstored_date"/> 
           <br/><br/> 
           <h3>End Contract</h3><br/> 
           <field name="termination_contract_date"/> 
           <field name="termination_reason"/> 
           <field name="allocation_cordblood"/> 
           <field name="endstorage_cordblood"/> 
           <field name="allocation_cord"/> 
           <field name="endstorage_cord"/> 
          </group> 
         </group> 
        </page> 
       </page> 
       <page string="Internal Notes" position="after"> 
        <page string="Parent Details"> 
         <group> 
          <group> 
           <h3><label string="Mother Details"/></h3> 
           <br/> 
           <field name="mother_lastname"/> 
           <field name="mother_firstname"/> 
           <field name="mother_dob"/> 
          </group> 
          <group> 
           <h3><label string="Father Details"/></h3> 
           <br/> 
           <field name="father_lastname"/> 
           <field name="father_firstname"/> 
           <field name="father_dob"/> 
          </group> 
          <group> 
           <h3><label string="Child Deatils"/></h3> 
           <br/> 
           <field name="child_lastname"/> 
           <field name="child_firstname"/> 
           <field name="child_dob"/> 
          </group> 
         </group> 
        </page> 
        <page string="Contact Info"> 
         <notebook> 
          <page string="Parent Details"> 
           <group> 
            <group> 
             <h3>Mother</h3><br/> 
             <field name="mother_telephone"/> 
             <field name="mother_mobile"/> 
             <field name="mother_email"/> 
             <field name="mother_fax"/> 
             <field name="mother_fiscalcode"/> 
             <field name="mother_iban"/> 
             <field name="mother_bankaccountspain"/> 
             <field name="mother_decaseddate"/> 
            </group> 
            <group> 
             <h3>Father</h3><br/> 
             <field name="father_telephone"/> 
             <field name="father_mobile"/> 
             <field name="father_email"/> 
             <field name="father_fax"/> 
             <field name="father_fiscalcode"/> 
             <field name="father_iban"/> 
             <field name="father_bankaccountspain"/> 
             <field name="father_decaseddate"/> 
            </group> 
           </group> 
          </page> 
          <page string="Child Details"> 
           <group> 
            <field name="child_telephone"/> 
            <field name="child_mobile"/> 
            <field name="child_email"/> 
            <field name="child_fax"/> 
            <field name="child_fiscalcode"/> 
            <field name="child_iban"/> 
            <field name="child_bankaccountspain"/> 
            <field name="child_decaseddate"/> 
           </group> 
          </page> 
         </notebook> 
        </page> 
        </page> 
       </page> 
      </data>  
     </field> 
    </record> 

<!-- ========================= Action Layout ============================= --> 
    <record id="action_lead" model="ir.actions.act_window"> 
     <field name="name">Lead</field> 
     <field name="type">ir.actions.act_window</field> 
     <field name="res_model">res.partner</field> 
     <field name="view_type">form</field> 
     <field name="view_mode">tree,form</field> 
     <field name="view_id" ref="lead_tree"/> 
    </record> 
    <record id="create_customer" model="ir.actions.act_window"> 
     <field name="name">Lead</field> 
     <field name="type">ir.actions.act_window</field> 
     <field name="res_model">res.partner</field> 
     <field name="view_type">form</field> 
     <field name="view_mode">form</field> 
     <field name="view_id" ref="view_res_partner_inherited"/> 
    </record> 


     <!-- ===========================Menu Settings=========================== --> 
    <menuitem name = "Lead" id = "menu_lis_lab" action="action_lead"/> 
     <menuitem name="Lead Info" id="sublead_menu" parent="menu_lis_lab"/> 
      <menuitem name="Generate Lead" id="generate_leads" parent="sublead_menu" action="create_customer"/>  
</data> 
</openerp> 

lead.py

from osv import osv 
from osv import fields 

class res_partner(osv.osv): 
_inherit = "res.partner" 
_description = "adding fields to res.partner" 
_columns = { 
    'mothername': fields.char('Mother Name',size=64,required=True), 
    'fathername': fields.char('Father Name',size=64,required=True), 
    'mother_lastname': fields.char('Last name',size=64), 
    'mother_firstname': fields.char('First Name',size=64), 
    'mother_dob': fields.date('Date of Birth'), 
    'father_lastname': fields.char('Last name',size=64), 
    'father_firstname': fields.char('First Name',size=64), 
    'father_dob': fields.date('Date of Birth'), 
    'child_lastname': fields.char('Last name',size=64), 
    'child_firstname': fields.char('First name',size=64), 
    'child_dob': fields.date('Date of Birth'), 
    'storagedetails': fields.selection([('A','21 years')],'Storage Details',help="Storage for no.of years"), 
    'insurancecompany': fields.char('Insurance Company',size=64), 
    'insurancenumber': fields.char('Insurance No:',size=20), 
    'healthfund_name': fields.char('Health Fund Name',size=64), 
    'healthfund_number': fields.char('Healt Fund No:',size=20), 
    'service': fields.char('Service',size=20,help="Service for no.of years"), 
    'annualfee': fields.char('Annual Fee',size=20,help="Annual fee for the service"), 
    'paymentplan':fields.char('Payment Plan',size=20,help="Payment plans"), 
    'transport_insurance': fields.boolean('Transport Insurance',help="Transport Insurance is taken"), 
    'sarm': fields.boolean('Sarm',help="Sarm"), 
    'cost_free_donation': fields.boolean('Cost Free Donation',help="Cost Free Donation"), 
    'hla_test': fields.boolean('HLA Test',help="HLA Test"), 
    'twins': fields.boolean('Twins',help="Are they twins"), 
    'repeated_customer': fields.boolean('Repeated Customer',help="Is he repeated customer"), 
    'contactadded_date': fields.date('Contact added Date',help="On which date contact has been added"), 
    'clientadded_date': fields.date('Client added Date',help="On which day the client is added"), 
    'expectedbirth_date': fields.date('Expected Birth Date',help="Expected Date of Delivery for the baby"), 
    'bloodrecieved_date': fields.date('Blood Recieved on:',help="When the blood sample is recieved"), 
    'bloodstorage_date': fields.date('Blood Stored on:',help="When the blood is stored in Dewar"), 
    'cordrecieved_date': fields.date('Cord Recieved on:',help="When the Cord is recieved"), 
    'cordstored_date': fields.date('Cord Stored on:',help="When the Cord is stored in Dewar"), 
    'termination_contract_date': fields.date('termination_contract_date',help="Your contract will be terminated on "), 
    'termination_reason': fields.char('Termination Reason',size=64,help="Reason for contract Termination"), 
    'allocation_cordblood': fields.date('Allocation CordBlood',help="CordBlood is allocated on"), 
    'endstorage_cordblood': fields.date('End Storage CordBlood',help="End date of storing of CordBlood is"), 
    'allocation_cord': fields.date('Allocation Cord',help="Cord is allocated on"), 
    'endstorage_cord': fields.date('End Storage Cord',help="End date of storing of Cord is"), 
    'mother_telephone':fields.char('Telephone',size=20), 
    'mother_mobile':fields.char('Mobile',size=20), 
    'mother_email': fields.char('Email',size=64), 
    'mother_fax': fields.char('Fax',size=20), 
    'mother_fiscalcode': fields.char('Fiscal Code',size=64), 
    'mother_iban': fields.char('IBAN',size=64), 
    'mother_bankaccountspain': fields.char('Bank accounts pain',size=64), 
    'mother_decaseddate': fields.date('Decased Date'), 
    'father_telephone':fields.char('Telephone',size=20), 
    'father_mobile':fields.char('Mobile',size=20), 
    'father_email': fields.char('Email',size=64), 
    'father_fax': fields.char('Fax',size=20), 
    'father_fiscalcode': fields.char('Fiscal Code',size=64), 
    'father_iban': fields.char('IBAN',size=64), 
    'father_bankaccountspain': fields.char('Bank accounts pain',size=64), 
    'father_decaseddate': fields.date('Decased Date'), 
    'child_telephone':fields.char('Telephone',size=20), 
    'child_mobile':fields.char('Mobile',size=20), 
    'child_email': fields.char('Email',size=64), 
    'child_fax': fields.char('Fax',size=20), 
    'child_fiscalcode': fields.char('Fiscal Code',size=64), 
    'child_iban': fields.char('IBAN',size=64), 
    'child_bankaccountspain': fields.char('Bank accounts pain',size=64), 
    'child_decaseddate': fields.date('Decased Date'), 
} 
+0

顯示您的代碼。 – Mansi

+0

你的代碼似乎不完整。你如何知道付款已完成?我的意思是有任何特定的領域,它定義了支付狀態? – Mansi

+0

我是什麼計劃是我將有一個布爾值作爲付款Done.When我做的是particaular客戶支付我會啓用布爾然後只有一個可以進入家長的細節信息 – nitesh

回答

1

如果沒有針對第一過程和交易流程不同的形式,然後創建不同形成每個流程並添加適當的字段。

如果單形式不同的操作(如按鈕點擊狀態變化),那麼您可以顯示/隱藏組視圖。

[編輯]

e.g:

分配組付款字段。並在支付表格打開時顯示該組。您必須採取額外的布爾型字段調用「payment_active」,該調用在視圖中必須是不可見的。併爲其他表單分配「True」值和「False」。

在XML:

​​
+0

我是新來的OpenERP 。請分享例如鏈接 – nitesh

+0

例如,請檢查編輯的答案。 – Yajushi

1

做你有什麼計劃之後。回答你的問題是,要禁用字段,請在上面寫上atrrs。我會告訴你一個例子,就像你所說的一個布爾字段將顯示付款的付款方式 - 假設字段的字段名稱是「付款」,那麼所有那些你想要在付款尚未完成時禁用的字段

attrs="{'invisible': [('paid', '=', False)]}" 

使用該上要看不見的領域,你可以使用這樣

<field name="paid"/> <!--here, paid is the boolean field which shows status of payment --> 
<field name="service" attrs="{'invisible': [('paid', '=', False)]}"/> 

不僅在現場,你也可以給ATTRS到整個頁面這樣的,(所以包含所有字段的頁面在這將是不可見的)

<page string="Parent Details" attrs="{'invisible': [('paid', '=', False)]}">