2017-12-08 10 views

答えて

5

ほとんどのOdooモジュールはこの種の問題に対して状態を使用します。フィールドを持っていなければならないという一般的な考え方があり、そのフィールドの値に基づいてボタンが表示されます。

例:あなたのビューで

# in you model 
    bool_field = fields.Boolean('Same text', default=False) 

:あなたのモデルで

<button name="some_method"......... attrs="{'invisible': [('bool_field', '=', True)]}" /> 
... 
... 
... 
<!-- keep the field invisible because i don't need the user to see 
     it, the value of this field is for technical purpuse --> 
<field name="bool_field" invisible="1"/> 

だから、
@api.multi 
def some_method(self): 
    # in this method i will make sure to change the value of the 
    # field to True so the button is not visible any more for user 
    self.bool_field = True 
    ... 
    ... 
    ... 

あなたはすべての準備は、ボタンの変更は、それはあなたの価値だというフィールドを持っている場合直接 を使用するか、この目的のために特別なフィールドを作成することができます。

+0

あなたは、Guesmi、ALG – Cherif

関連する問題