2014-10-10 4 views
0

간반 (Kanban)보기에서 변경시 기능을 호출하려고합니다. 하지만 어떻게 부를 수 있을지 모르겠다. 여러 가지 방법을 시도했지만 여전히 오류가 있습니다. 그러나 출력 없음. 그리고 Kanban보기에 또 다른 질문이 있습니다. 하나에서 다른 것으로 드래그하면 일부 값이 변경됩니다. 어떻게 구현할 수 있습니까?openerp의 kanban보기에서 onchange 함수를 호출하는 방법은 무엇입니까?

<record model="ir.ui.view" id="hr_kanban_view_transfer"> 
    <field name="name">Employee Transfer Kanban</field> 
    <field name="model">employee.transfer</field> 
    <field name="arch" type="xml"> 
     <kanban default_group_by="site1"> 
      <field name="site1"/> 
      <field name="color"/> 
      <field name="location1"/> 
      <field name="location2" /> 
      <field name="site2"/> 

      <templates> 
       <t t-name="kanban-tooltip"> 
        <ul class="oe_kanban_tooltip"> 
         <li t-if="record.employee_id.raw_value"><b>Employee:</b> <field name="employee_id"/></li> 
         <li t-if="record.site1.raw_value"><b>Current Project:</b> <field name="site1"/></li> 
         <li t-if="record.location1.raw_value"><b>Source Location:</b> <field name="location1"/></li> 
         <li t-if="record.date.raw_value"><b>Date:</b> <field name="date"/></li> 
        </ul> 
       </t> 

       <t t-name="kanban-box"> 
        <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click oe_semantic_html_override"> 
         <div class="oe_dropdown_toggle oe_dropdown_kanban"> 
          <span class="oe_e">i</span> 
          <ul class="oe_dropdown_menu"> 
           <t t-if="widget.view.is_action_enabled('delete')"><li><a type="delete">Delete</a></li></t> 
           <!-- <li><a name="action_makeMeeting" type="object">Schedule Interview</a></li> --> 
           <li><ul class="oe_kanban_colorpicker" data-field="color"/></li> 
          </ul> 
         </div> 
         <div class="oe_kanban_content" tooltip="kanban-tooltip"> 
          <div> 
           <t t-if="record.employee_id.raw_value"><b><field name="employee_id"/></b><br/></t> 
           <i><field name="employee_id"/></i><br/> 
           <field name="site1"/><br/> 
           <field name="site2"/><br/> 
           <t t-if="record.source_location.raw_value">Source Location: <field name="location1"/><br/></t> 
           <!-- <t t-if="record.title_action.raw_value"><field name="title_action"/><br/></t> --> 
           <field name="date"/> 
          </div> 
          <div class="oe_kanban_right"> 

           <img t-att-src="kanban_image('hr.employee', 'image_small', record.employee_id.raw_value)" t-att-title="record.employee_id.value" width="24" height="24" class="oe_kanban_avatar"/> 

          </div> 
         <!-- <div class="oe_kanban_footer_left" style="margin-top:5px;"> 
           <t t-raw="record.message_summary.raw_value"/> 
           <field name="categ_ids"/> 
          </div>--> 
         </div> 
         <div class="oe_clear"></div> 
        </div> 
       </t> 
      </templates> 
     </kanban> 
    </field> 
</record> 

직원을 다른 사이트 (site1에서 site2)로 이전 할 때 코드를 어떻게 바꿀 수 있습니까? Kanban보기에서 가능합니까?

답변

0

모델의 쓰기 방법을 무시할 수 있습니다. site1 필드 값을 확인하십시오. 그것이 존재하고 변화 한 경우에 당신이 좋아하는 모든 것을하십시오.

def write(self, cr, user, ids, vals, context=None): 
    if 'site1' in vals: 
     # your code 
    return super(your_model, self).write(cr, user, ids, vals, context)