Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Can I assign alternate button in tree view? For example: I want button1 if state is draft, and button2 for state confirm.
Is there any possibility to achieve this ? http://awesomescreenshot.com/09b2gg7h09
Take one selection field for changing the status of your record if haven't take.
For Eg : you have one state field on your model : state : fields.selection([('draft','Draft'),('progress','Progress'),('confirm','Confirm')], "Status")
Simply use the states property of button.
<button name="your_method" type="object" states="draft" string="Apply"/>
<button name="your_method" type="object" states='progress' string="Approved"/>
These button will only appear when your current record will be on that perticuler state.
When you call any method from button update the status of record so your button will be appear only on specific state.
These is how you can achive the feature.
Alternate Solution :
User Attrs property , you can hide your button based on such condition.
Hope this will help you.
Use the states attribute inside the button tag:
<button name="your_action_id1" string="Button 1" type="action/object" states="draft"/> <button name="your_action_id2" string="Button 2" type="action/object" states="confirm"/>
The button name is the action to perfom. Depending on the type this can either be a ir_action defined in your xml ("action"), or a python function (type="object")
Note: the states attributes value can also be a comma seperated list of states
If your button executes python code: Use one button and differ the action inside the code depending on the state or a button context.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 3/7/14, 5:04 AM|
|Seen: 1367 times|
|Last updated: 3/16/15, 8:10 AM|