2016-07-07 2 views
0

sale_order.pyOpenERP 7 데이터는 데이터베이스에 저장하지만이 코드의 코드 <pre>'state': 'draft',</pre>를 추가 할 때/

class glimsol_bopas(osv.osv): 
    _name = 'glimsol.bopas' 
    _inherit = ['mail.thread', 'ir.needaction_mixin'] 

    _columns = { 
     'state': fields.selection([ 
      ('draft', 'Draft Quotation'), 
      ('sent', 'Quotation Sent'), 
      ('cancel', 'Cancelled'), 
      ('waiting_date', 'Waiting Schedule'), 
      ('progress', 'Sales Order'), 
      ('manual', 'Sale to Invoice'), 
      ('invoice_except', 'Invoice Exception'), 
      ('done', 'Done'), 
      ], 'Status', readonly=True, track_visibility='onchange', 
      help="Gives the status of the quotation or sales order. \nThe exception status is automatically set when a cancel operation occurs in the processing of a document linked to the sales order. \nThe 'Waiting Schedule' status is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True), 
      # other fields 
    } 
    _defaults = { 
     'state': 'draft', 
     # other defaults 
    } 

    # methods 
<?xml version="1.0" encoding="utf-8"?> 
    <openerp> 
     <data> 
      <!-- view definitions --> 

      <record id="glimsol_bopas_action" model="ir.actions.act_window"> 
       <field name="name">B.O.Pull-out Authorization Slip (BOPAS)</field> 
       <field name="type">ir.actions.act_window</field> 
       <field name="res_model">glimsol.bopas</field> 
       <field name="view_type">form</field> 
       <field name="view_mode">tree,form,calendar,graph</field> 
       <field name="view_id" ref="glimsol_bopas_tree"/> 
       <!-- <field name="search_view_id" ref="glimsol_bopas_search"/> --> 
       <field name="context">{}</field> 
       <field name="domain">[('state','not in',('draft','sent','cancel'))]</field> 
       <field name="help" type="html"> 
       <p class="oe_view_nocontent_create"> 
        Click to create a B.O.- P.A.S. 
       </p><p> 
        B.O.- P.A.S quotation. 
       </p> 
       </field> 
      </record> 
      <menuitem id="glimsol_bopas_menu" action="glimsol_bopas_action" parent="base.menu_sales" sequence="10" name="B.O.- P.A.S"/> 
     </data> 
    </openerp> 

데이터가 표시되지 않습니다 트리 뷰 트리 뷰에서 표시를 표시하지 않습니다 이하. 하지만 상태 "상태 인용 줄"의 상태 표시 줄이 파란색으로 배경이되게하려면이 작업을 수행해야합니다.

_defaults = { 
      'date_order': fields.date.context_today, 
      'order_policy': 'manual', 
      'state': 'draft', 
      'user_id': lambda obj, cr, uid, context: uid, 
      'name': lambda obj, cr, uid, context: '/', 
     } 

도와주세요!

+0

인 기록을보기 때문에 다른 사용자는 ;-) – CZoellner

+0

하하하 사형을 죽 였죠되지 않습니다 : D ..... – weelDaw

답변

2

당신은 기본적으로 국가가 경우 빈 만들어보기 (레코드가 데이터베이스에 존재하지 않을 때 표시되는 뷰를) 보여 odoo을 이야기하고이 라인

<field name="domain">[('state','not in',('draft','sent','cancel'))]</field> 

제거하십시오, 감사 당신이 draft

또는 넣을 수있는 또 다른 방법으로 새로 생성 된 레코드의 상태를 설정 기본적으로 draft, sent 또는 cancel and로 설정하는 것은

입니다

는 그 상태 not indraft, sent 또는 cancel 내가 코드 예제를 단축 한

+1

대단히 감사합니다. @danidee 당신이 저의 하루를 구했습니다. :) – weelDaw