2016-07-07 3 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> 

データが表示されないツリービューで、ツリービューで表示を表示しません。以下。 しかし、私はこの状態を "Draft Quotation"というステータスバーで背景を青にする必要があります。

_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

ハハハによって死にslayed得ることはありません:D ..... – weelDaw

答えて

2

あなたは基本的に状態があれば、空の作成ビュー(レコードがデータベースに存在しない場合に示さビュー)を表示するようにodooを言っている。このライン

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

を取り除く、ありがとうデフォルトでdraftsentまたはcancel andに設定されているあなたはdraft

に新しく作成されたレコードの状態を設定したり、それを置くための別の方法は

です

は、その状態not indraftsentまたはcancel私は、コード例を短縮しました

+1

大変ありがとうございました。 :) – weelDaw

関連する問題